Commit 7500b299 authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile/internal/types: remove Field.Funarg

Passes toolstash-check.

Change-Id: Idc00f15e369cad62cb8f7a09fd0ef09abd3fcdef
Reviewed-on: https://go-review.googlesource.com/109356
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 73becbf9
...@@ -252,7 +252,6 @@ func transformclosure(xfunc *Node) { ...@@ -252,7 +252,6 @@ func transformclosure(xfunc *Node) {
decls = append(decls, v) decls = append(decls, v)
fld := types.NewField() fld := types.NewField()
fld.Funarg = types.FunargParams
fld.Nname = asTypesNode(v) fld.Nname = asTypesNode(v)
fld.Type = v.Type fld.Type = v.Type
fld.Sym = v.Sym fld.Sym = v.Sym
......
...@@ -631,7 +631,6 @@ func tofunargs(l []*Node, funarg types.Funarg) *types.Type { ...@@ -631,7 +631,6 @@ func tofunargs(l []*Node, funarg types.Funarg) *types.Type {
fields := make([]*types.Field, len(l)) fields := make([]*types.Field, len(l))
for i, n := range l { for i, n := range l {
f := structfield(n) f := structfield(n)
f.Funarg = funarg
f.SetIsddd(n.Isddd()) f.SetIsddd(n.Isddd())
if n.Right != nil { if n.Right != nil {
n.Right.Type = f.Type n.Right.Type = f.Type
...@@ -649,10 +648,6 @@ func tofunargs(l []*Node, funarg types.Funarg) *types.Type { ...@@ -649,10 +648,6 @@ func tofunargs(l []*Node, funarg types.Funarg) *types.Type {
func tofunargsfield(fields []*types.Field, funarg types.Funarg) *types.Type { func tofunargsfield(fields []*types.Field, funarg types.Funarg) *types.Type {
t := types.New(TSTRUCT) t := types.New(TSTRUCT)
t.StructType().Funarg = funarg t.StructType().Funarg = funarg
for _, f := range fields {
f.Funarg = funarg
}
t.SetFields(fields) t.SetFields(fields)
return t return t
} }
......
...@@ -818,7 +818,7 @@ func typefmt(t *types.Type, flag FmtFlag, mode fmtMode, depth int) string { ...@@ -818,7 +818,7 @@ func typefmt(t *types.Type, flag FmtFlag, mode fmtMode, depth int) string {
} }
buf := make([]byte, 0, 64) buf := make([]byte, 0, 64)
if t.IsFuncArgStruct() { if funarg := t.StructType().Funarg; funarg != types.FunargNone {
buf = append(buf, '(') buf = append(buf, '(')
var flag1 FmtFlag var flag1 FmtFlag
switch mode { switch mode {
...@@ -830,7 +830,7 @@ func typefmt(t *types.Type, flag FmtFlag, mode fmtMode, depth int) string { ...@@ -830,7 +830,7 @@ func typefmt(t *types.Type, flag FmtFlag, mode fmtMode, depth int) string {
if i != 0 { if i != 0 {
buf = append(buf, ", "...) buf = append(buf, ", "...)
} }
buf = append(buf, fldconv(f, flag1, mode, depth)...) buf = append(buf, fldconv(f, flag1, mode, depth, funarg)...)
} }
buf = append(buf, ')') buf = append(buf, ')')
} else { } else {
...@@ -840,7 +840,7 @@ func typefmt(t *types.Type, flag FmtFlag, mode fmtMode, depth int) string { ...@@ -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, ' ') buf = append(buf, ' ')
buf = append(buf, fldconv(f, FmtLong, mode, depth)...) buf = append(buf, fldconv(f, FmtLong, mode, depth, funarg)...)
} }
if t.NumFields() != 0 { if t.NumFields() != 0 {
buf = append(buf, ' ') buf = append(buf, ' ')
...@@ -1668,7 +1668,7 @@ func tmodeString(t *types.Type, mode fmtMode, depth int) string { ...@@ -1668,7 +1668,7 @@ func tmodeString(t *types.Type, mode fmtMode, depth int) string {
return tconv(t, 0, mode, depth) 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 { if f == nil {
return "<T>" return "<T>"
} }
...@@ -1688,7 +1688,7 @@ func fldconv(f *types.Field, flag FmtFlag, mode fmtMode, depth int) string { ...@@ -1688,7 +1688,7 @@ func fldconv(f *types.Field, flag FmtFlag, mode fmtMode, depth int) string {
} }
if s != nil && f.Embedded == 0 { if s != nil && f.Embedded == 0 {
if f.Funarg != types.FunargNone { if funarg != types.FunargNone {
name = asNode(f.Nname).modeString(mode) name = asNode(f.Nname).modeString(mode)
} else if flag&FmtLong != 0 { } else if flag&FmtLong != 0 {
name = mode.Sprintf("%0S", s) name = mode.Sprintf("%0S", s)
...@@ -1717,7 +1717,7 @@ func fldconv(f *types.Field, flag FmtFlag, mode fmtMode, depth int) string { ...@@ -1717,7 +1717,7 @@ func fldconv(f *types.Field, flag FmtFlag, mode fmtMode, depth int) string {
str = name + " " + typ 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) str += " " + strconv.Quote(f.Note)
} }
......
...@@ -1895,7 +1895,6 @@ func ascompatet(nl Nodes, nr *types.Type) []*Node { ...@@ -1895,7 +1895,6 @@ func ascompatet(nl Nodes, nr *types.Type) []*Node {
func nodarg(t interface{}, fp int) *Node { func nodarg(t interface{}, fp int) *Node {
var n *Node var n *Node
var funarg types.Funarg
switch t := t.(type) { switch t := t.(type) {
default: default:
Fatalf("bad nodarg %T(%v)", t, t) Fatalf("bad nodarg %T(%v)", t, t)
...@@ -1905,7 +1904,6 @@ func nodarg(t interface{}, fp int) *Node { ...@@ -1905,7 +1904,6 @@ func nodarg(t interface{}, fp int) *Node {
if !t.IsFuncArgStruct() { if !t.IsFuncArgStruct() {
Fatalf("nodarg: bad type %v", t) Fatalf("nodarg: bad type %v", t)
} }
funarg = t.StructType().Funarg
// Build fake variable name for whole arg struct. // Build fake variable name for whole arg struct.
n = newname(lookup(".args")) n = newname(lookup(".args"))
...@@ -1920,7 +1918,6 @@ func nodarg(t interface{}, fp int) *Node { ...@@ -1920,7 +1918,6 @@ func nodarg(t interface{}, fp int) *Node {
n.Xoffset = first.Offset n.Xoffset = first.Offset
case *types.Field: case *types.Field:
funarg = t.Funarg
if fp == 1 { if fp == 1 {
// NOTE(rsc): This should be using t.Nname directly, // NOTE(rsc): This should be using t.Nname directly,
// except in the case where t.Nname.Sym is the blank symbol and // except in the case where t.Nname.Sym is the blank symbol and
...@@ -1971,21 +1968,13 @@ func nodarg(t interface{}, fp int) *Node { ...@@ -1971,21 +1968,13 @@ func nodarg(t interface{}, fp int) *Node {
n.Sym = lookup("__") n.Sym = lookup("__")
} }
switch fp { if fp != 0 {
default: Fatalf("bad fp: %v", fp)
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)
}
} }
// preparing arguments for call
n.Op = OINDREGSP
n.Xoffset += Ctxt.FixedFrameSize()
n.SetTypecheck(1) n.SetTypecheck(1)
n.SetAddrtaken(true) // keep optimizers at bay n.SetAddrtaken(true) // keep optimizers at bay
return n return n
......
...@@ -357,7 +357,6 @@ type Field struct { ...@@ -357,7 +357,6 @@ type Field struct {
flags bitset8 flags bitset8
Embedded uint8 // embedded field Embedded uint8 // embedded field
Funarg Funarg
Pos src.XPos Pos src.XPos
Sym *Sym Sym *Sym
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment