diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-06-14 21:26:15 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-06-14 21:26:15 +0200 |
commit | 4c3c0831a5d14c91f7b81b6f7392dffe1757bc8d (patch) | |
tree | bab75f28e47a0358b9eb06955cbdd8fe964b0a14 /src | |
parent | 267bf7fc3562fb87c28541b79af4a375fa7b22e4 (diff) |
Minor efficiency improvement
Diffstat (limited to 'src')
-rw-r--r-- | src/parser.c | 7 |
1 files changed, 5 insertions, 2 deletions
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 */ |