diff options
Diffstat (limited to 'ir.c')
| -rw-r--r-- | ir.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -60,6 +60,7 @@ Str type_desc(Type *t, Arena *arena) { case T_TUPLE: return S("tuple"); case T_BOOL: return S("bool"); case T_INT: return S("i64"); + case T_PTR: return str_fmt(arena, "^%S", type_desc(t->next, arena)); default: return S("N/A"); } } @@ -712,12 +713,12 @@ zero_no_effect: if (node_eql_i64(CAR(n), 0)) return CDR(n); case N_PHI: if (same) return CAR(n); - if (IN(CTRL(n), 0)->val.type.lvl == T_XCTRL) { - return CDR(n); - } if (IN(CTRL(n), 1)->val.type.lvl == T_XCTRL) { return CAR(n); } + if (IN(CTRL(n), 0)->val.type.lvl == T_XCTRL) { + return CDR(n); + } break; default: @@ -854,12 +855,11 @@ NameBinding *scope_bind(Scope *scope, Str name, Node *value, LexSpan pos, Proc * return prev; } -NameBinding *scope_update(Scope *scope, Str name, Node *to, Proc *proc) { - NameBinding *b = scope_find(scope, name); - if (!b) return NULL; +NameBinding *scope_update(NameBinding *b, Node *to, Proc *proc) { + Node *n = b->node; node_add(proc, to, proc->keepalive); - node_remove(proc, b->node, proc->keepalive); b->node = to; + node_remove(proc, n, proc->keepalive); return b; } |
