summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2000-02-14 21:33:10 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2000-02-14 21:33:10 (GMT)
commit126960b7443905cccc54a9aa5ca8e1205762a0e7 (patch)
tree53aca4e157fab629275b740286b2c96baa5f5f47
parent17988d2a175dbf9acade5588a36913c96b591a17 (diff)
downloadcpython-126960b7443905cccc54a9aa5ca8e1205762a0e7.zip
cpython-126960b7443905cccc54a9aa5ca8e1205762a0e7.tar.gz
cpython-126960b7443905cccc54a9aa5ca8e1205762a0e7.tar.bz2
looks like everything is working except for try/except (pystone
compiles correctly)
-rw-r--r--Lib/compiler/pycodegen.py20
-rw-r--r--Tools/compiler/compiler/pycodegen.py20
2 files changed, 28 insertions, 12 deletions
diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py
index ac93348..1c80499 100644
--- a/Lib/compiler/pycodegen.py
+++ b/Lib/compiler/pycodegen.py
@@ -153,11 +153,6 @@ class CodeGenerator:
"""TODO
EmptyNode
- Exec
- Invert
- LeftShift
- Power
- RightShift
Sliceobj
Tryexcept
Tryfinally
@@ -276,6 +271,8 @@ class CodeGenerator:
self.emit('SET_LINENO', node.lineno)
self.emit('IMPORT_NAME', node.modname)
for name in node.names:
+ if name == '*':
+ self.namespace = 0
self.emit('IMPORT_FROM', name)
self.emit('POP_TOP')
@@ -524,7 +521,6 @@ class CodeGenerator:
return 1
def visitAssign(self, node):
- print "ASSIGN", node.expr
self.emit('SET_LINENO', node.lineno)
self.visit(node.expr)
dups = len(node.nodes) - 1
@@ -583,6 +579,18 @@ class CodeGenerator:
def visitMod(self, node):
return self.binaryOp(node, 'BINARY_MODULO')
+ def visitPower(self, node):
+ return self.binaryOp(node, 'BINARY_POWER')
+
+ def visitLeftShift(self, node):
+ return self.binaryOp(node, 'BINARY_LSHIFT')
+
+ def visitRightShift(self, node):
+ return self.binaryOp(node, 'BINARY_RSHIFT')
+
+ def visitInvert(self, node):
+ return self.unaryOp(node, 'UNARY_INVERT')
+
def visitUnarySub(self, node):
return self.unaryOp(node, 'UNARY_NEGATIVE')
diff --git a/Tools/compiler/compiler/pycodegen.py b/Tools/compiler/compiler/pycodegen.py
index ac93348..1c80499 100644
--- a/Tools/compiler/compiler/pycodegen.py
+++ b/Tools/compiler/compiler/pycodegen.py
@@ -153,11 +153,6 @@ class CodeGenerator:
"""TODO
EmptyNode
- Exec
- Invert
- LeftShift
- Power
- RightShift
Sliceobj
Tryexcept
Tryfinally
@@ -276,6 +271,8 @@ class CodeGenerator:
self.emit('SET_LINENO', node.lineno)
self.emit('IMPORT_NAME', node.modname)
for name in node.names:
+ if name == '*':
+ self.namespace = 0
self.emit('IMPORT_FROM', name)
self.emit('POP_TOP')
@@ -524,7 +521,6 @@ class CodeGenerator:
return 1
def visitAssign(self, node):
- print "ASSIGN", node.expr
self.emit('SET_LINENO', node.lineno)
self.visit(node.expr)
dups = len(node.nodes) - 1
@@ -583,6 +579,18 @@ class CodeGenerator:
def visitMod(self, node):
return self.binaryOp(node, 'BINARY_MODULO')
+ def visitPower(self, node):
+ return self.binaryOp(node, 'BINARY_POWER')
+
+ def visitLeftShift(self, node):
+ return self.binaryOp(node, 'BINARY_LSHIFT')
+
+ def visitRightShift(self, node):
+ return self.binaryOp(node, 'BINARY_RSHIFT')
+
+ def visitInvert(self, node):
+ return self.unaryOp(node, 'UNARY_INVERT')
+
def visitUnarySub(self, node):
return self.unaryOp(node, 'UNARY_NEGATIVE')