Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into feature-withdraw
Browse files Browse the repository at this point in the history
  • Loading branch information
localhuman committed Jan 2, 2018
2 parents d65a249 + ae75c38 commit b92d81c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions neo/VM/ExecutionEngine.py
Expand Up @@ -747,6 +747,29 @@ def ExecuteOp(self, opcode, context):

estack.PushT(Struct(items))

elif opcode == APPEND:
newItem = estack.Pop()

if type(newItem) is Struct:
newItem = newItem.Clone()

arrItem = estack.Pop()

if not arrItem.IsArray:
self._VMState |= VMState.FAULT
return

arr = arrItem.GetArray()
arr.append(newItem)

elif opcode == REVERSE:

arrItem = estack.Pop()
if not arrItem.IsArray:
self._VMState |= VMState.FAULT
return
arrItem.GetArray().reverse()

elif opcode == THROW:
self._VMState |= VMState.FAULT
return
Expand Down
3 changes: 2 additions & 1 deletion neo/VM/OpCode.py
Expand Up @@ -199,7 +199,8 @@
SETITEM = b'\xC4'
NEWARRAY = b'\xC5' # 用作引用類型
NEWSTRUCT = b'\xC6' # 用作值類型

APPEND = b'\xC8'
REVERSE = b'\xC9'

import sys
import importlib
Expand Down

0 comments on commit b92d81c

Please sign in to comment.