fix: regression on range following #787

This commit is contained in:
Marc Vertes
2020-07-30 10:52:05 +02:00
committed by GitHub
parent 9c51f6bb69
commit 25c681c1e6
2 changed files with 4 additions and 2 deletions

View File

@@ -602,7 +602,9 @@ func (interp *Interpreter) cfg(root *node, pkgID string) ([]*node, error) {
}
n.gen = nop
n.findex = -1
sc.sym[dest.ident].kind = constSym
if sym, _, ok := sc.lookup(dest.ident); ok {
sym.kind = constSym
}
if childPos(n) == len(n.anc.child)-1 {
sc.iota = 0
} else {

View File

@@ -162,7 +162,7 @@ func genValueRangeArray(n *node) func(*frame) reflect.Value {
return func(f *frame) reflect.Value {
return value(f).Elem()
}
case n.typ.val.cat == interfaceT:
case n.typ.val != nil && n.typ.val.cat == interfaceT:
return func(f *frame) reflect.Value {
val := value(f)
v := []valueInterface{}