Update tests to show that #39 is resolved, and add dummy support for

STORE_LOCALS used in Python 3.0-3.3.

Closes #39
Closes #63
This commit is contained in:
Michael Hansen
2020-10-22 09:06:57 -07:00
parent 0540b3991c
commit 8eb18de269
8 changed files with 73 additions and 10 deletions

View File

@@ -1451,6 +1451,9 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
case Pyc::LOAD_LOCALS:
stack.push(new ASTNode(ASTNode::NODE_LOCALS));
break;
case Pyc::STORE_LOCALS:
stack.pop();
break;
case Pyc::LOAD_NAME_A:
stack.push(new ASTName(code->getName(operand)));
break;

Binary file not shown.

View File

@@ -12,29 +12,29 @@ class A:
class A1:
def __init__(self):
print 'A1.__init__'
print('A1.__init__')
def foo(self):
print 'A1.foo'
print('A1.foo')
def __init__(self):
print 'A.__init__'
print('A.__init__')
def foo(self):
print 'A.foo'
print('A.foo')
class B:
def __init__(self):
print 'B.__init__'
print('B.__init__')
def bar(self):
print 'B.bar'
print('B.bar')
class C(A, B):
def foobar(self):
print 'C.foobar'
print('C.foobar')
c = C()

View File

@@ -1,8 +1,8 @@
class MyClass:
def method(self, i):
if i is 5:
print 'five'
print('five')
elif i is not 2:
print 'not two'
print('not two')
else:
print '2'
print('2')

View File

@@ -0,0 +1,15 @@
class MyClass : <EOL>
<INDENT>
def method ( self , i ) : <EOL>
<INDENT>
if i is 5 : <EOL>
<INDENT>
print ( 'five' ) <EOL>
<OUTDENT>
elif i is not 2 : <EOL>
<INDENT>
print ( 'not two' ) <EOL>
<OUTDENT>
else : <EOL>
<INDENT>
print ( '2' ) <EOL>

View File

@@ -0,0 +1,45 @@
'\ntest_class.py -- source test pattern for class definitions\n\nThis source is part of the decompyle test suite.\n\ndecompyle is a Python byte-code decompiler\nSee http://www.goebel-consult.de/decompyle/ for download and\nfor further information\n' <EOL>
class A : <EOL>
<INDENT>
class A1 : <EOL>
<INDENT>
def __init__ ( self ) : <EOL>
<INDENT>
print ( 'A1.__init__' ) <EOL>
<OUTDENT>
def foo ( self ) : <EOL>
<INDENT>
print ( 'A1.foo' ) <EOL>
<OUTDENT>
<OUTDENT>
def __init__ ( self ) : <EOL>
<INDENT>
print ( 'A.__init__' ) <EOL>
<OUTDENT>
def foo ( self ) : <EOL>
<INDENT>
print ( 'A.foo' ) <EOL>
<OUTDENT>
<OUTDENT>
class B : <EOL>
<INDENT>
def __init__ ( self ) : <EOL>
<INDENT>
print ( 'B.__init__' ) <EOL>
<OUTDENT>
def bar ( self ) : <EOL>
<INDENT>
print ( 'B.bar' ) <EOL>
<OUTDENT>
<OUTDENT>
class C ( A , B ) : <EOL>
<INDENT>
def foobar ( self ) : <EOL>
<INDENT>
print ( 'C.foobar' ) <EOL>
<OUTDENT>
<OUTDENT>
c = C ( ) <EOL>
c . foo ( ) <EOL>
c . bar ( ) <EOL>
c . foobar ( ) <EOL>

Binary file not shown.