mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 23:02:27 +00:00
compiler: drop stack after inline
Some control-flow statements drop stack items, for example `return` when it is used inside of `range` loop. For inlined calls this `return` should drop only portion of stack which belongs to inlined call.
This commit is contained in:
parent
347212c0c5
commit
b66b853285
4 changed files with 74 additions and 1 deletions
|
@ -107,6 +107,7 @@ func newStoragePlugin() *storagePlugin {
|
|||
s.interops[interopnames.ToID([]byte(interopnames.SystemStoragePut))] = s.Put
|
||||
s.interops[interopnames.ToID([]byte(interopnames.SystemStorageGetContext))] = s.GetContext
|
||||
s.interops[interopnames.ToID([]byte(interopnames.SystemRuntimeNotify))] = s.Notify
|
||||
s.interops[interopnames.ToID([]byte(interopnames.SystemBinaryItoa))] = s.Itoa
|
||||
return s
|
||||
|
||||
}
|
||||
|
@ -122,6 +123,13 @@ func (s *storagePlugin) syscallHandler(v *vm.VM, id uint32) error {
|
|||
return errors.New("syscall not found")
|
||||
}
|
||||
|
||||
func (s *storagePlugin) Itoa(v *vm.VM) error {
|
||||
n := v.Estack().Pop().BigInt()
|
||||
base := v.Estack().Pop().BigInt()
|
||||
v.Estack().PushVal(n.Text(int(base.Int64())))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *storagePlugin) Notify(v *vm.VM) error {
|
||||
name := v.Estack().Pop().String()
|
||||
item := stackitem.NewArray(v.Estack().Pop().Array())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue