When I separate out the dictionary transformations to dictPass, I missed
duplicating a conditional that deals with OMETHVALUE nodes that are
actually called. We create the OMETHVALUE when transforming bounds
function reference (before we know whether that reference will be
called), and we need to call transformDot() again to convert the
OMETHVALUE to ODOTMETH if the reference is actually called (the usual
case). Without this change, we leave the OMETHVALUE in, and extra *-fm
are created and used unncessarily.
Also, fixed a few places where we were missing ir.MarkFunc(), which sets
the class of a function node properly.
Change-Id: I6b02613039b16b507b44525faa2cd7031afb6982
Reviewed-on: https://go-review.googlesource.com/c/go/+/352069
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
op := m.(*ir.CallExpr).X.Op()
if op != ir.OFUNCINST {
assert(op == ir.OMETHVALUE || op == ir.OCLOSURE || op == ir.ODYNAMICDOTTYPE || op == ir.ODYNAMICDOTTYPE2)
+ if op == ir.OMETHVALUE {
+ // Redo the transformation of OXDOT, now that we
+ // know the method value is being called.
+ m.(*ir.CallExpr).X.(*ir.SelectorExpr).SetOp(ir.OXDOT)
+ transformDot(m.(*ir.CallExpr).X.(*ir.SelectorExpr), true)
+ }
transformCall(m.(*ir.CallExpr))
}
} else {
nname = ir.NewNameAt(f.Pos, newsym)
nname.SetType(t2)
+ ir.MarkFunc(nname)
newsym.Def = nname
}
newfields[i] = types.NewField(f.Pos, f.Sym, t2)
} else {
nname = ir.NewNameAt(f.Pos, newsym)
nname.SetType(t2)
+ ir.MarkFunc(nname)
newsym.Def = nname
}
newfields[i] = types.NewField(f.Pos, f.Sym, t2)