diff --git a/pkg/vm/interop.go b/pkg/vm/interop.go index e59d4ac78..5ca9d7884 100644 --- a/pkg/vm/interop.go +++ b/pkg/vm/interop.go @@ -10,13 +10,13 @@ type InteropFunc func(vm *VM) error // runtimeLog will handle the syscall "Neo.Runtime.Log" for printing and logging stuff. func runtimeLog(vm *VM) error { item := vm.Estack().Pop() - fmt.Printf("NEO-GO-VM (log) > %s\n", item.value.Value()) + fmt.Printf("NEO-GO-VM (log) > %s\n", item.Value()) return nil } // runtimeNotify will handle the syscall "Neo.Runtime.Notify" for printing and logging stuff. func runtimeNotify(vm *VM) error { item := vm.Estack().Pop() - fmt.Printf("NEO-GO-VM (notify) > %s\n", item.value.Value()) + fmt.Printf("NEO-GO-VM (notify) > %s\n", item.Value()) return nil } diff --git a/pkg/vm/stack.go b/pkg/vm/stack.go index 86f652166..c9ce195be 100644 --- a/pkg/vm/stack.go +++ b/pkg/vm/stack.go @@ -58,6 +58,11 @@ func (e *Element) Prev() *Element { return nil } +// Value returns value of the StackItem contained in the element. +func (e *Element) Value() interface{} { + return e.value.Value() +} + // BigInt attempts to get the underlying value of the element as a big integer. // Will panic if the assertion failed which will be caught by the VM. func (e *Element) BigInt() *big.Int { diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index 7d534d667..371688b82 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -181,7 +181,7 @@ func (v *VM) Context() *Context { if v.istack.Len() == 0 { return nil } - return v.istack.Peek(0).value.Value().(*Context) + return v.istack.Peek(0).Value().(*Context) } // PopResult is used to pop the first item of the evaluation stack. This allows @@ -827,7 +827,7 @@ func (v *VM) execute(ctx *Context, op Instruction) { elem := v.estack.Pop() // Cause there is no native (byte) item type here, hence we need to check // the type of the item for array size operations. - switch t := elem.value.Value().(type) { + switch t := elem.Value().(type) { case []StackItem: v.estack.PushVal(len(t)) case map[interface{}]StackItem: