fix: correct wireChild() in case of interleaving of var and func declarations (#65)

This commit is contained in:
Marc Vertes
2019-01-29 20:51:25 +01:00
committed by Ludovic Fernandez
parent 49c8c905d2
commit 83bc9c5f05
4 changed files with 71 additions and 2 deletions

View File

@@ -74,6 +74,7 @@ func (interp *Interpreter) run(n *Node, cf *Frame) {
} else {
f = &Frame{anc: cf, data: make([]reflect.Value, n.flen)}
}
for i, t := range n.types {
// FIXME: nil types are forbidden and should be detected at compile time (CFG)
if t != nil && i < len(f.data) && !f.data[i].IsValid() {
@@ -606,7 +607,7 @@ func callBin(n *Node) {
}
//log.Println(n.index, "callbin", value(f).Type(), in)
r := value(f).Call(in)
//log.Println(n.index, "callBin, res:", v, fsize, n.findex)
//log.Println(n.index, "callBin, res:", r, fsize, n.findex, len(r), len(f.data))
for i := 0; i < fsize; i++ {
f.data[n.findex+i] = r[i]
}