vm: support Map in ARRAYSIZE

Also make logic the same as in reference implementation
and add tests.
This commit is contained in:
Evgenii Stratonikov 2019-09-24 16:50:37 +03:00
parent c66f493017
commit 13d7770c68
2 changed files with 30 additions and 2 deletions

View file

@ -807,10 +807,10 @@ func (v *VM) execute(ctx *Context, op Instruction) {
switch t := elem.value.Value().(type) {
case []StackItem:
v.estack.PushVal(len(t))
case []uint8:
case map[interface{}]StackItem:
v.estack.PushVal(len(t))
default:
panic("ARRAYSIZE: item not of type []StackItem")
v.estack.PushVal(len(elem.Bytes()))
}
case SIZE: