summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWormHeamer2025-08-04 23:05:46 -0400
committerWormHeamer2025-08-04 23:05:46 -0400
commita4eca17c4156863108cd9bec7834bbb1681c0bf7 (patch)
treec979e040bdf40277800972acc0f0f35824a774d0 /main.c
parent88b01f43312eeceba87a1378be5cd63bb11f167f (diff)
NODE_KEEP macro
Diffstat (limited to 'main.c')
-rw-r--r--main.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/main.c b/main.c
index 8533e49..3ce67dc 100644
--- a/main.c
+++ b/main.c
@@ -245,11 +245,11 @@ Node *parse_expr(Lexer *l, Proc *p) {
lex_next(l);
/* necessary because if lhs is a deduplicated literal, it may be an input to rhs
* and therefore culled by peephole optimizations */
- node_add(p, lhs, p->keepalive);
- Node *rhs = parse_expr(l, p);
- Node *n = node_peephole(node_new(p, nt, lhs, rhs), p, l);
- node_remove(p, lhs, p->keepalive);
- lhs = n;
+ Node *rhs;
+ NODE_KEEP(p, lhs, {
+ rhs = parse_expr(l, p);
+ });
+ lhs = node_peephole(node_new(p, nt, lhs, rhs), p, l);
}
lhs->src_pos = (LexSpan) { pos.ofs, l->pos.ofs - pos.ofs };
return lhs;