interp: fix use of builtins in type definitions
Make len() and cap() work on pointers. Preserve scope in case of nested calls of cfg. Fixes #1285.
This commit is contained in:
@@ -456,7 +456,7 @@ func nodeType2(interp *Interpreter, sc *scope, n *node, seen []*node) (t *itype,
|
||||
length = int(vInt(sym.rval))
|
||||
default:
|
||||
// Size is defined by a numeric constant expression.
|
||||
if _, err = interp.cfg(c0, sc.pkgID, sc.pkgName); err != nil {
|
||||
if _, err = interp.cfg(c0, sc, sc.pkgID, sc.pkgName); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v, ok := c0.rval.Interface().(constant.Value)
|
||||
|
||||
Reference in New Issue
Block a user