interp: fix closure in a struct field
Functions in a struct fields are always wrapped (as potentially used by the runtime), so generate a function wrapper also for closure when assigned to a struct field. When such a function is called from the interpreter, ensure that interface arguments are also wrapped so method and receiver resolution can be performed. Fixes partially #1043.
This commit is contained in:
@@ -1631,6 +1631,13 @@ func defRecvType(n *node) *itype {
|
||||
return nil
|
||||
}
|
||||
|
||||
func wrappedType(n *node) *itype {
|
||||
if n.typ.cat != valueT {
|
||||
return nil
|
||||
}
|
||||
return n.typ.val
|
||||
}
|
||||
|
||||
func isShiftNode(n *node) bool {
|
||||
switch n.action {
|
||||
case aShl, aShr, aShlAssign, aShrAssign:
|
||||
|
||||
Reference in New Issue
Block a user