diff options
Diffstat (limited to 'ir.c')
| -rw-r--r-- | ir.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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; +} |
