summaryrefslogtreecommitdiff
path: root/ir.c
diff options
context:
space:
mode:
authorWormHeamer2025-08-03 19:52:18 -0400
committerWormHeamer2025-08-03 19:52:18 -0400
commit1a90ef4318c18161aaccf7390016a61c635ac748 (patch)
tree90b6cd4e2dc1261bc2250972aad71c847be80844 /ir.c
parent62e4b45143e4ff24a1758a2ccd3af5dfe69706ec (diff)
add assignment statements
Diffstat (limited to 'ir.c')
-rw-r--r--ir.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ir.c b/ir.c
index 2e3e3b2..c75113e 100644
--- a/ir.c
+++ b/ir.c
@@ -306,3 +306,12 @@ NameBinding *scope_bind(Scope *scope, Str name, Node *value, LexSpan pos, Proc *
node_add(proc, value, proc->keepalive);
return prev;
}
+
+NameBinding *scope_update(Scope *scope, Str name, Node *to, Proc *proc) {
+ NameBinding *b = scope_find(scope, name);
+ if (!b) return NULL;
+ node_remove(proc, b->node, proc->keepalive);
+ node_add(proc, to, proc->keepalive);
+ b->node = to;
+ return b;
+}