orig := r
r = r.Name.Defn.Right
+ for r.Op == OCONVNOP {
+ r = r.Left
+ }
+
switch r.Op {
case ONAME:
if staticcopy(l, r, out) {
rr.Orig = rr // completely separate copy
rr.Type = ll.Type
rr.Xoffset += e.Xoffset
+ setlineno(rr)
*out = list(*out, Nod(OAS, ll, rr))
}
}
func staticassign(l *Node, r *Node, out **NodeList) bool {
var n1 Node
+ for r.Op == OCONVNOP {
+ r = r.Left
+ }
+
switch r.Op {
//dump("not static", r);
default:
if e.Expr.Op == OLITERAL {
gdata(&n1, e.Expr, int(n1.Type.Width))
} else {
+ setlineno(e.Expr)
a = Nod(OXXX, nil, nil)
*a = n1
a.Orig = a // completely separate copy
}
// build list of var.field = expr
+ setlineno(value)
a = Nod(ODOT, var_, newname(index.Sym))
a = Nod(OAS, a, value)
}
// build list of var[index] = value
+ setlineno(value)
a = Nod(OINDEX, var_, index)
a = Nod(OAS, a, value)
}
// build list of var[c] = expr
+ setlineno(value)
a = Nod(OAS, a, value)
typecheck(&a, Etop)
if isliteral(index) && isliteral(value) {
// build vstat[b].a = key;
+ setlineno(index)
a = Nodintconst(b)
a = Nod(OINDEX, vstat, a)
*init = list(*init, a)
// build vstat[b].b = value;
+ setlineno(value)
a = Nodintconst(b)
a = Nod(OINDEX, vstat, a)
val = temp(var_.Type.Type)
}
+ setlineno(r.Left)
a = Nod(OAS, key, r.Left)
typecheck(&a, Etop)
walkstmt(&a)
*init = list(*init, a)
+ setlineno(r.Right)
a = Nod(OAS, val, r.Right)
typecheck(&a, Etop)
walkstmt(&a)
*init = list(*init, a)
+ setlineno(val)
a = Nod(OAS, Nod(OINDEX, var_, key), val)
typecheck(&a, Etop)
walkstmt(&a)