]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/types: remove Field.Funarg
authorMatthew Dempsky <mdempsky@google.com>
Wed, 25 Apr 2018 00:26:32 +0000 (17:26 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 25 Apr 2018 19:26:13 +0000 (19:26 +0000)
Passes toolstash-check.

Change-Id: Idc00f15e369cad62cb8f7a09fd0ef09abd3fcdef
Reviewed-on: https://go-review.googlesource.com/109356
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/closure.go
src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/fmt.go
src/cmd/compile/internal/gc/walk.go
src/cmd/compile/internal/types/type.go

index f92223511c3fc00740b73b121abf64b7bdbfdb2d..ce575a64180e3ed71c05b271349f2294686919a1 100644 (file)
@@ -252,7 +252,6 @@ func transformclosure(xfunc *Node) {
                        decls = append(decls, v)
 
                        fld := types.NewField()
-                       fld.Funarg = types.FunargParams
                        fld.Nname = asTypesNode(v)
                        fld.Type = v.Type
                        fld.Sym = v.Sym
index 3a744a20c28e2fcec2f432c6480d315453b6cee6..ece257116fccec4cbb9197590bfcf190c7609df9 100644 (file)
@@ -631,7 +631,6 @@ func tofunargs(l []*Node, funarg types.Funarg) *types.Type {
        fields := make([]*types.Field, len(l))
        for i, n := range l {
                f := structfield(n)
-               f.Funarg = funarg
                f.SetIsddd(n.Isddd())
                if n.Right != nil {
                        n.Right.Type = f.Type
@@ -649,10 +648,6 @@ func tofunargs(l []*Node, funarg types.Funarg) *types.Type {
 func tofunargsfield(fields []*types.Field, funarg types.Funarg) *types.Type {
        t := types.New(TSTRUCT)
        t.StructType().Funarg = funarg
-
-       for _, f := range fields {
-               f.Funarg = funarg
-       }
        t.SetFields(fields)
        return t
 }
index b30111aab59992e45e7db8f442b9a035175f1e1b..7df2242226d414ba9961a5f3da1260adf2ab6f85 100644 (file)
@@ -818,7 +818,7 @@ func typefmt(t *types.Type, flag FmtFlag, mode fmtMode, depth int) string {
                }
 
                buf := make([]byte, 0, 64)
-               if t.IsFuncArgStruct() {
+               if funarg := t.StructType().Funarg; funarg != types.FunargNone {
                        buf = append(buf, '(')
                        var flag1 FmtFlag
                        switch mode {
@@ -830,7 +830,7 @@ func typefmt(t *types.Type, flag FmtFlag, mode fmtMode, depth int) string {
                                if i != 0 {
                                        buf = append(buf, ", "...)
                                }
-                               buf = append(buf, fldconv(f, flag1, mode, depth)...)
+                               buf = append(buf, fldconv(f, flag1, mode, depth, funarg)...)
                        }
                        buf = append(buf, ')')
                } else {
@@ -840,7 +840,7 @@ func typefmt(t *types.Type, flag FmtFlag, mode fmtMode, depth int) string {
                                        buf = append(buf, ';')
                                }
                                buf = append(buf, ' ')
-                               buf = append(buf, fldconv(f, FmtLong, mode, depth)...)
+                               buf = append(buf, fldconv(f, FmtLong, mode, depth, funarg)...)
                        }
                        if t.NumFields() != 0 {
                                buf = append(buf, ' ')
@@ -1668,7 +1668,7 @@ func tmodeString(t *types.Type, mode fmtMode, depth int) string {
        return tconv(t, 0, mode, depth)
 }
 
-func fldconv(f *types.Field, flag FmtFlag, mode fmtMode, depth int) string {
+func fldconv(f *types.Field, flag FmtFlag, mode fmtMode, depth int, funarg types.Funarg) string {
        if f == nil {
                return "<T>"
        }
@@ -1688,7 +1688,7 @@ func fldconv(f *types.Field, flag FmtFlag, mode fmtMode, depth int) string {
                }
 
                if s != nil && f.Embedded == 0 {
-                       if f.Funarg != types.FunargNone {
+                       if funarg != types.FunargNone {
                                name = asNode(f.Nname).modeString(mode)
                        } else if flag&FmtLong != 0 {
                                name = mode.Sprintf("%0S", s)
@@ -1717,7 +1717,7 @@ func fldconv(f *types.Field, flag FmtFlag, mode fmtMode, depth int) string {
                str = name + " " + typ
        }
 
-       if flag&FmtShort == 0 && f.Funarg == types.FunargNone && f.Note != "" {
+       if flag&FmtShort == 0 && funarg == types.FunargNone && f.Note != "" {
                str += " " + strconv.Quote(f.Note)
        }
 
index 6373dcc67214603ef77afbe5520a1998aaab166d..c2e5f69d1f4486e84d17243ee9d26e95ff877e77 100644 (file)
@@ -1895,7 +1895,6 @@ func ascompatet(nl Nodes, nr *types.Type) []*Node {
 func nodarg(t interface{}, fp int) *Node {
        var n *Node
 
-       var funarg types.Funarg
        switch t := t.(type) {
        default:
                Fatalf("bad nodarg %T(%v)", t, t)
@@ -1905,7 +1904,6 @@ func nodarg(t interface{}, fp int) *Node {
                if !t.IsFuncArgStruct() {
                        Fatalf("nodarg: bad type %v", t)
                }
-               funarg = t.StructType().Funarg
 
                // Build fake variable name for whole arg struct.
                n = newname(lookup(".args"))
@@ -1920,7 +1918,6 @@ func nodarg(t interface{}, fp int) *Node {
                n.Xoffset = first.Offset
 
        case *types.Field:
-               funarg = t.Funarg
                if fp == 1 {
                        // NOTE(rsc): This should be using t.Nname directly,
                        // except in the case where t.Nname.Sym is the blank symbol and
@@ -1971,21 +1968,13 @@ func nodarg(t interface{}, fp int) *Node {
                n.Sym = lookup("__")
        }
 
-       switch fp {
-       default:
-               Fatalf("bad fp")
-
-       case 0: // preparing arguments for call
-               n.Op = OINDREGSP
-               n.Xoffset += Ctxt.FixedFrameSize()
-
-       case 1: // reading arguments inside call
-               n.SetClass(PPARAM)
-               if funarg == types.FunargResults {
-                       n.SetClass(PPARAMOUT)
-               }
+       if fp != 0 {
+               Fatalf("bad fp: %v", fp)
        }
 
+       // preparing arguments for call
+       n.Op = OINDREGSP
+       n.Xoffset += Ctxt.FixedFrameSize()
        n.SetTypecheck(1)
        n.SetAddrtaken(true) // keep optimizers at bay
        return n
index edc6683d4ab644dd7b490a216c0f17efaf2c3bce..d367cd19440e6031513bdc784cb09e8a49b3535b 100644 (file)
@@ -357,7 +357,6 @@ type Field struct {
        flags bitset8
 
        Embedded uint8 // embedded field
-       Funarg   Funarg
 
        Pos  src.XPos
        Sym  *Sym