CityOfZion / neo-boa

Python compiler for the Neo2 Virtual Machine, see neo3-boa for NEO3
MIT License
69 stars 55 forks source link

The method to_s(), which generates the output of the executable in readable format, is outdated #109

Closed dauTT closed 5 years ago

dauTT commented 5 years ago

Current behavior

The method to_s in the module.py seems to be outdated. Indeed the docstring example, LambdaTest.py, is not available anymore. If we also try to run the following python snippet code we get the following result:

from boa.compiler import Compiler
from boa_test.tests.boa_test import BoaTest

c = Compiler.load('./neo-boa/boa_test/example/AddTest.py')
module = c.default 
module.write()
print(module.to_s())

result:

image

Expected behavior

I would have expected see more rows. Something similar to the original python bytecode:

from dis import dis 
path='/home/dau/workspace/python/github.com/neo/neo-boa/boa_test/example/AddTest.py'
source = open(path, 'rb')
compiled_source = compile(source.read(), path, 'exec')
print(dis(compiled_source.co_code))

image

How to reproduce

see above

Your environment