diff options
author | Dan Scales <danscales@google.com> | 2021-09-12 12:21:48 -0700 |
---|---|---|
committer | Dan Scales <danscales@google.com> | 2021-09-15 22:53:42 +0000 |
commit | cfa233d76bcff00f46f5e5acdb17cb819a309d2b (patch) | |
tree | 240718d5b535df978ddd13eb95197c1e67d9549b /src/cmd/compile/internal/noder/expr.go | |
parent | 59a9a035ffa34c26a287d124180f6eca7c912311 (diff) | |
download | go-git-cfa233d76bcff00f46f5e5acdb17cb819a309d2b.tar.gz |
cmd/compile: remove unneeded early transforms, with dictionary change
Now that we are computing the dictionary format on the instantiated
functions, we can remove the early transformation code that was needed
to create the implicit CONVIFACE nodes in the generic function.
Change-Id: I1695484e7d59bccbfb757994f3e40e84288759a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/349614
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/noder/expr.go')
-rw-r--r-- | src/cmd/compile/internal/noder/expr.go | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/cmd/compile/internal/noder/expr.go b/src/cmd/compile/internal/noder/expr.go index 045f028e1a..3e1960f7a4 100644 --- a/src/cmd/compile/internal/noder/expr.go +++ b/src/cmd/compile/internal/noder/expr.go @@ -250,44 +250,6 @@ func (g *irgen) selectorExpr(pos src.XPos, typ types2.Type, expr *syntax.Selecto // only be fully transformed once it has an instantiated type. n := ir.NewSelectorExpr(pos, ir.OXDOT, x, typecheck.Lookup(expr.Sel.Value)) typed(g.typ(typ), n) - - // Fill in n.Selection for a generic method reference or a bound - // interface method, even though we won't use it directly, since it - // is useful for analysis. Specifically do not fill in for fields or - // other interfaces methods (method call on an interface value), so - // n.Selection being non-nil means a method reference for a generic - // type or a method reference due to a bound. - obj2 := g.info.Selections[expr].Obj() - sig := types2.AsSignature(obj2.Type()) - if sig == nil || sig.Recv() == nil { - return n - } - index := g.info.Selections[expr].Index() - last := index[len(index)-1] - // recvType is the receiver of the method being called. Because of the - // way methods are imported, g.obj(obj2) doesn't work across - // packages, so we have to lookup the method via the receiver type. - recvType := deref2(sig.Recv().Type()) - if types2.AsInterface(recvType.Underlying()) != nil { - fieldType := n.X.Type() - for _, ix := range index[:len(index)-1] { - fieldType = deref(fieldType).Field(ix).Type - } - if fieldType.Kind() == types.TTYPEPARAM { - n.Selection = fieldType.Bound().AllMethods().Index(last) - //fmt.Printf(">>>>> %v: Bound call %v\n", base.FmtPos(pos), n.Sel) - } else { - assert(fieldType.Kind() == types.TINTER) - //fmt.Printf(">>>>> %v: Interface call %v\n", base.FmtPos(pos), n.Sel) - } - return n - } - - recvObj := types2.AsNamed(recvType).Obj() - recv := g.pkg(recvObj.Pkg()).Lookup(recvObj.Name()).Def - n.Selection = recv.Type().Methods().Index(last) - //fmt.Printf(">>>>> %v: Method call %v\n", base.FmtPos(pos), n.Sel) - return n } |