From 540274b57d3e991e1460bca3b8149255f1666d4d Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Fri, 16 Jun 2017 13:09:12 +1000 Subject: [PATCH] Don't over-generate temporary variables. --- cmd/puffs-gen-c/main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/puffs-gen-c/main.go b/cmd/puffs-gen-c/main.go index 6c4d6dea..b26f8205 100644 --- a/cmd/puffs-gen-c/main.go +++ b/cmd/puffs-gen-c/main.go @@ -960,14 +960,14 @@ func (g *gen) writeCallSuspendibles(n *a.Expr, depth uint32) error { return nil } - if g.perFunc.tempW > maxTemp { - return fmt.Errorf("too many temporary variables required") - } - temp := g.perFunc.tempW - g.perFunc.tempW++ - // TODO: delete these hacks that only matches "in.src.read_u8?()" etc. if isInSrcReadU8(g.tm, n) { + if g.perFunc.tempW > maxTemp { + return fmt.Errorf("too many temporary variables required") + } + temp := g.perFunc.tempW + g.perFunc.tempW++ + // TODO: suspend coroutine state. g.printf("if (%ssrc->ri >= %ssrc->wi) { status = "+ "%ssrc->closed ? puffs_%s_error_unexpected_eof : puffs_%s_status_short_read;",