fix: correct access to parameter type for variadic binary methods
This commit is contained in:
@@ -1039,14 +1039,6 @@ func call(n *node) {
|
||||
}
|
||||
}
|
||||
|
||||
// pindex returns definition parameter index for function call.
|
||||
func pindex(i, variadic int) int {
|
||||
if variadic < 0 || i <= variadic {
|
||||
return i
|
||||
}
|
||||
return variadic
|
||||
}
|
||||
|
||||
func getFrame(f *frame, l int) *frame {
|
||||
switch l {
|
||||
case 0:
|
||||
@@ -1077,7 +1069,7 @@ func callBin(n *node) {
|
||||
// A method signature obtained from reflect.Type includes receiver as 1st arg, except for interface types.
|
||||
rcvrOffset := 0
|
||||
if recv := n.child[0].recv; recv != nil && !isInterface(recv.node.typ) {
|
||||
if funcType.NumIn() > len(child) {
|
||||
if variadic > 0 || funcType.NumIn() > len(child) {
|
||||
rcvrOffset = 1
|
||||
}
|
||||
}
|
||||
@@ -1089,7 +1081,13 @@ func callBin(n *node) {
|
||||
}
|
||||
|
||||
for i, c := range child {
|
||||
defType := funcType.In(rcvrOffset + pindex(i, variadic))
|
||||
var defType reflect.Type
|
||||
if variadic >= 0 && i >= variadic {
|
||||
defType = funcType.In(variadic)
|
||||
} else {
|
||||
defType = funcType.In(rcvrOffset + i)
|
||||
}
|
||||
|
||||
switch {
|
||||
case isBinCall(c):
|
||||
// Handle nested function calls: pass returned values as arguments
|
||||
|
||||
Reference in New Issue
Block a user