summaryrefslogtreecommitdiff
path: root/ir.c
diff options
context:
space:
mode:
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;
+}