Fix handling of parameter frame positions

This commit is contained in:
Marc Vertes
2018-10-27 11:52:33 +02:00
parent 8670c41b9e
commit 4b48a14748
2 changed files with 3 additions and 4 deletions

View File

@@ -639,9 +639,9 @@ func (interp *Interpreter) Cfg(root *Node) []*Node {
n.flen = scope.size + 1
if len(n.child[0].child) > 0 {
// Method: restore receiver frame location (used at run)
list := []int{n.child[0].child[0].child[0].findex}
n.framepos = append(list, n.child[2].framepos...)
n.framepos = append(n.framepos, n.child[0].child[0].child[0].findex)
}
n.framepos = append(n.framepos, n.child[2].framepos...)
scope = scope.pop()
funcName := n.child[1].ident
if canExport(funcName) {

View File

@@ -432,10 +432,9 @@ func (n *Node) wrapNode(in []reflect.Value) []reflect.Value {
}
// Unwrap input arguments from their reflect value and store them in the frame
paramIndex := def.child[2].child[0].val.([]int)
i := 0
for _, arg := range in {
frame.data[paramIndex[i]] = arg
frame.data[def.framepos[i]] = arg
i++
}