w.exoticSelector(n.Sel)
if go117ExportTypes {
w.exoticType(n.Type())
- if n.Op() == ir.ODOT || n.Op() == ir.ODOTPTR || n.Op() == ir.ODOTINTER || n.Op() == ir.OMETHEXPR {
+ if n.Op() == ir.ODOT || n.Op() == ir.ODOTPTR || n.Op() == ir.ODOTINTER {
w.exoticParam(n.Selection)
- if n.Op() == ir.OMETHEXPR {
- name := ir.MethodExprName(n)
- w.bool(name != nil)
- if name != nil {
- w.exoticType(name.Type())
- }
- }
}
- // n.Selection is not required for ODOTMETH and OCALLPART. It will
+ // n.Selection is not required for OMETHEXPR, ODOTMETH, and OCALLPART. It will
// be reconstructed during import.
}
pos := r.pos()
expr := r.expr()
sel := r.exoticSelector()
- n := ir.NewSelectorExpr(pos, ir.OXDOT, expr, sel)
- n.SetOp(op)
+ n := ir.NewSelectorExpr(pos, op, expr, sel)
n.SetType(r.exoticType())
switch op {
- case ir.ODOT, ir.ODOTPTR, ir.ODOTINTER, ir.OMETHEXPR:
+ case ir.ODOT, ir.ODOTPTR, ir.ODOTINTER:
n.Selection = r.exoticParam()
- if op == ir.OMETHEXPR {
- if r.bool() { // has name
- ir.MethodExprName(n).SetType(r.exoticType())
- }
- }
- case ir.ODOTMETH, ir.OCALLPART:
+ case ir.ODOTMETH, ir.OCALLPART, ir.OMETHEXPR:
// These require a Lookup to link to the correct declaration.
rcvrType := expr.Type()
typ := n.Type()
n.Selection = Lookdot(n, rcvrType, 1)
- if op == ir.OCALLPART {
+ if op == ir.OCALLPART || op == ir.OMETHEXPR {
// Lookdot clobbers the opcode and type, undo that.
n.SetOp(op)
n.SetType(typ)
--- /dev/null
+// Copyright 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package a
+
+type S struct{}
+
+func (s *S) M() {
+ s.m((*S).N)
+}
+
+func (s *S) N() {}
+
+func (s *S) m(func(*S)) {}
--- /dev/null
+// compiledir
+
+// Copyright 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This test exercises exporting + importing method
+// expressions for use when inlining.
+
+package ignored