From 519725bb3c075ee2462c929f5997cb068e18466a Mon Sep 17 00:00:00 2001 From: Ondřej Surý Date: Mon, 26 Mar 2012 16:50:58 +0200 Subject: Imported Upstream version 2012.03.22 --- src/cmd/gc/walk.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/cmd/gc/walk.c') diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index 74298e126..7dfd34a7a 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -646,12 +646,6 @@ walkexpr(Node **np, NodeList **init) n->ninit = nil; l = n->list->n; r = n->list->next->n; - if(n->right != N) { - // TODO: Remove once two-element map assigment is gone. - l = safeexpr(l, init); - r = safeexpr(r, init); - safeexpr(n->right, init); // cause side effects from n->right - } t = l->type; n = mkcall1(mapfndel("mapdelete", t), t->down, init, typename(t), l, r); goto ret; @@ -2364,6 +2358,12 @@ append(Node *n, NodeList **init) walkexprlistsafe(n->list, init); + // walkexprlistsafe will leave OINDEX (s[n]) alone if both s + // and n are name or literal, but those may index the slice we're + // modifying here. Fix explicitly. + for(l=n->list; l; l=l->next) + l->n = cheapexpr(l->n, init); + nsrc = n->list->n; argc = count(n->list) - 1; if (argc < 1) { @@ -2520,6 +2520,7 @@ walkcompare(Node **np, NodeList **init) expr = nodbool(n->op == OEQ); typecheck(&expr, Erv); walkexpr(&expr, init); + expr->type = n->type; *np = expr; return; } @@ -2540,6 +2541,7 @@ walkcompare(Node **np, NodeList **init) expr = nodbool(n->op == OEQ); typecheck(&expr, Erv); walkexpr(&expr, init); + expr->type = n->type; *np = expr; return; } -- cgit v1.2.3