]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/compile/internal/gc/sinit.go
[dev.ssa] Merge remote-tracking branch 'origin/master' into mergebranch
[gostls13.git] / src / cmd / compile / internal / gc / sinit.go
index 099c10a8bc897b412cba945f5b090879df70b4ba..ce958396bf8bd270ee8f933703211d7ad18ae63b 100644 (file)
@@ -302,6 +302,10 @@ func staticcopy(l *Node, r *Node, out **NodeList) bool {
        orig := r
        r = r.Name.Defn.Right
 
+       for r.Op == OCONVNOP {
+               r = r.Left
+       }
+
        switch r.Op {
        case ONAME:
                if staticcopy(l, r, out) {
@@ -380,6 +384,7 @@ func staticcopy(l *Node, r *Node, out **NodeList) bool {
                                        rr.Orig = rr // completely separate copy
                                        rr.Type = ll.Type
                                        rr.Xoffset += e.Xoffset
+                                       setlineno(rr)
                                        *out = list(*out, Nod(OAS, ll, rr))
                                }
                        }
@@ -394,6 +399,10 @@ func staticcopy(l *Node, r *Node, out **NodeList) bool {
 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:
@@ -484,6 +493,7 @@ func staticassign(l *Node, r *Node, out **NodeList) bool {
                        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
@@ -636,6 +646,7 @@ func structlit(ctxt int, pass int, n *Node, var_ *Node, init **NodeList) {
                }
 
                // build list of var.field = expr
+               setlineno(value)
                a = Nod(ODOT, var_, newname(index.Sym))
 
                a = Nod(OAS, a, value)
@@ -703,6 +714,7 @@ func arraylit(ctxt int, pass int, n *Node, var_ *Node, init **NodeList) {
                }
 
                // build list of var[index] = value
+               setlineno(value)
                a = Nod(OINDEX, var_, index)
 
                a = Nod(OAS, a, value)
@@ -866,6 +878,7 @@ func slicelit(ctxt int, n *Node, var_ *Node, init **NodeList) {
                }
 
                // build list of var[c] = expr
+               setlineno(value)
                a = Nod(OAS, a, value)
 
                typecheck(&a, Etop)
@@ -954,6 +967,7 @@ func maplit(ctxt int, n *Node, var_ *Node, init **NodeList) {
 
                        if isliteral(index) && isliteral(value) {
                                // build vstat[b].a = key;
+                               setlineno(index)
                                a = Nodintconst(b)
 
                                a = Nod(OINDEX, vstat, a)
@@ -965,6 +979,7 @@ func maplit(ctxt int, n *Node, var_ *Node, init **NodeList) {
                                *init = list(*init, a)
 
                                // build vstat[b].b = value;
+                               setlineno(value)
                                a = Nodintconst(b)
 
                                a = Nod(OINDEX, vstat, a)
@@ -1032,15 +1047,18 @@ func maplit(ctxt int, n *Node, var_ *Node, init **NodeList) {
                        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)