]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: get rid of ugly {Recvs,Params,Results}P methods
authorMatthew Dempsky <mdempsky@google.com>
Tue, 30 Aug 2016 18:15:38 +0000 (11:15 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 30 Aug 2016 20:32:33 +0000 (20:32 +0000)
These were a hack abstraction for before FuncType existed.

The result value from calling FuncType() could be saved, but this
maintains the current idiom of consistently using t.FuncType().foo
everywhere in case we choose to evolve the API further.

Change-Id: I81f19aaeab6fb7caa2d4da8bf0bbbc358ab970d0
Reviewed-on: https://go-review.googlesource.com/28150
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/type.go
src/cmd/compile/internal/gc/universe.go

index 7c2d2a43cf9504bd0e892af47a073ebe4d7c15a3..c487c237eb342a396e0b5faa3ede095c381f9209 100644 (file)
@@ -1034,9 +1034,9 @@ func functype0(t *Type, this *Node, in, out []*Node) {
        if this != nil {
                rcvr = []*Node{this}
        }
-       *t.RecvsP() = tofunargs(rcvr, FunargRcvr)
-       *t.ResultsP() = tofunargs(out, FunargResults)
-       *t.ParamsP() = tofunargs(in, FunargParams)
+       t.FuncType().Receiver = tofunargs(rcvr, FunargRcvr)
+       t.FuncType().Results = tofunargs(out, FunargResults)
+       t.FuncType().Params = tofunargs(in, FunargParams)
 
        checkdupfields("argument", t.Recvs(), t.Results(), t.Params())
 
index 12cb3b59930fd9e2b84607b761cad701769ea9e6..ac038f465d062a58bac58d2bb771c1288068e9d8 100644 (file)
@@ -569,9 +569,9 @@ func substAny(t *Type, types *[]*Type) *Type {
                                results = results.Copy()
                        }
                        t = t.Copy()
-                       *t.RecvsP() = recvs
-                       *t.ResultsP() = results
-                       *t.ParamsP() = params
+                       t.FuncType().Receiver = recvs
+                       t.FuncType().Results = results
+                       t.FuncType().Params = params
                }
 
        case TSTRUCT:
@@ -676,24 +676,9 @@ func (t *Type) wantEtype(et EType) {
        }
 }
 
-func (t *Type) RecvsP() **Type {
-       t.wantEtype(TFUNC)
-       return &t.Extra.(*FuncType).Receiver
-}
-
-func (t *Type) ParamsP() **Type {
-       t.wantEtype(TFUNC)
-       return &t.Extra.(*FuncType).Params
-}
-
-func (t *Type) ResultsP() **Type {
-       t.wantEtype(TFUNC)
-       return &t.Extra.(*FuncType).Results
-}
-
-func (t *Type) Recvs() *Type   { return *t.RecvsP() }
-func (t *Type) Params() *Type  { return *t.ParamsP() }
-func (t *Type) Results() *Type { return *t.ResultsP() }
+func (t *Type) Recvs() *Type   { return t.FuncType().Receiver }
+func (t *Type) Params() *Type  { return t.FuncType().Params }
+func (t *Type) Results() *Type { return t.FuncType().Results }
 
 // Recv returns the receiver of function type t, if any.
 func (t *Type) Recv() *Field {
index 270d4c377088f58945e495110d9ecf8970675a0a..1e5650ffc23599c6a8b7a3cbf15a3300e04d03ea 100644 (file)
@@ -375,9 +375,9 @@ func makeErrorInterface() *Type {
        out.SetFields([]*Field{field})
 
        f := typ(TFUNC)
-       *f.RecvsP() = rcvr
-       *f.ResultsP() = out
-       *f.ParamsP() = in
+       f.FuncType().Receiver = rcvr
+       f.FuncType().Results = out
+       f.FuncType().Params = in
 
        t := typ(TINTER)
        field = newField()