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

Commit

Permalink
added support for load string constants
Browse files Browse the repository at this point in the history
  • Loading branch information
localhuman committed Sep 20, 2017
1 parent 74f8804 commit 4c159b7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 20 deletions.
14 changes: 11 additions & 3 deletions boa/code/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,15 @@ def to_vm(self, tokenizer):

#loading constants ( ie 1, 2 etc)
elif op == pyop.LOAD_CONST:
token = tokenizer.convert_push_integer(self.args, self)
if type(self.args) is int:
token = tokenizer.convert_push_integer(self.args, self)
elif type(self.args) is str:

str_bytes = self.args.encode('utf-8')
self.args = str_bytes
print("convert argument %s " % self.args)

token = tokenizer.convert_push_data(self.args, self)

#storing / loading local variables
elif op == pyop.STORE_FAST:
Expand Down Expand Up @@ -417,10 +425,10 @@ def convert_store_local(self, py_token):

position = self.method.local_stores[local_name]

#print("POSITION FOR LOCAL NAME %s %s " % (local_name, position))
print("POSITION FOR LOCAL NAME %s %s " % (local_name, position))

# set i the index of the local variable to be stored
self.convert_push_integer(position,)
self.convert_push_integer(position)

# set item
self.convert_push_integer(2)
Expand Down
15 changes: 15 additions & 0 deletions boa/tests/src/StringTest1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from neo.SmartContract.Framework.FunctionCode import FunctionCode


class SCTest(FunctionCode):

@staticmethod
def Main(a):


if a == 'hello':

return 2


return 1
15 changes: 0 additions & 15 deletions compiler.py

This file was deleted.

4 changes: 2 additions & 2 deletions neo/IO/BinaryReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ def ReadSerializableArray(self, class_name, max=sys.maxsize ):
klass = getattr(importlib.import_module(module), klassname)
length = self.ReadVarInt(max=max)
items = []
print("WILL TRY TO READ SERIALIZABLE ARRAY.... %s %s " % (length, class_name))
# print("WILL TRY TO READ SERIALIZABLE ARRAY.... %s %s " % (length, class_name))
try:
for i in range(0, length):
item = klass()
item.Deserialize(self)
print("deserialized item %s %s " % ( i, item))
# print("deserialized item %s %s " % ( i, item))
items.append(item)
except Exception as e:
print("Coludnt deserialize %s " % e)
Expand Down

0 comments on commit 4c159b7

Please sign in to comment.