From 4c3c0831a5d14c91f7b81b6f7392dffe1757bc8d Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 14 Jun 2024 21:26:15 +0200 Subject: Minor efficiency improvement --- src/parser.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/parser.c b/src/parser.c index 6e6838a..3554f03 100644 --- a/src/parser.c +++ b/src/parser.c @@ -52,11 +52,14 @@ parseblk(struct ast *ast, struct lexemes toks) if (toks.kinds[toksidx++] != LEXLBRACE) err("parser: Expected left brace"); + if (toks.kinds[toksidx] != LEXRBRACE) { + idx_t_ stmt = parsestmt(ast, toks); + ast->kids[i].lhs = ast->kids[i].rhs = stmt; + } + while (toks.kinds[toksidx] != LEXRBRACE) { idx_t_ stmt = parsestmt(ast, toks); ast->kids[i].rhs = stmt; - if (ast->kids[i].lhs == AST_EMPTY) - ast->kids[i].lhs = ast->kids[i].rhs; } toksidx++; /* Eat rbrace */ -- cgit v1.2.3