looks like everything is working except for try/except (pystone

compiles correctly)
This commit is contained in:
Jeremy Hylton 2000-02-14 21:33:10 +00:00
parent 17988d2a17
commit 126960b744
2 changed files with 28 additions and 12 deletions

View File

@ -153,11 +153,6 @@ class CodeGenerator:
"""TODO """TODO
EmptyNode EmptyNode
Exec
Invert
LeftShift
Power
RightShift
Sliceobj Sliceobj
Tryexcept Tryexcept
Tryfinally Tryfinally
@ -276,6 +271,8 @@ class CodeGenerator:
self.emit('SET_LINENO', node.lineno) self.emit('SET_LINENO', node.lineno)
self.emit('IMPORT_NAME', node.modname) self.emit('IMPORT_NAME', node.modname)
for name in node.names: for name in node.names:
if name == '*':
self.namespace = 0
self.emit('IMPORT_FROM', name) self.emit('IMPORT_FROM', name)
self.emit('POP_TOP') self.emit('POP_TOP')
@ -524,7 +521,6 @@ class CodeGenerator:
return 1 return 1
def visitAssign(self, node): def visitAssign(self, node):
print "ASSIGN", node.expr
self.emit('SET_LINENO', node.lineno) self.emit('SET_LINENO', node.lineno)
self.visit(node.expr) self.visit(node.expr)
dups = len(node.nodes) - 1 dups = len(node.nodes) - 1
@ -583,6 +579,18 @@ class CodeGenerator:
def visitMod(self, node): def visitMod(self, node):
return self.binaryOp(node, 'BINARY_MODULO') 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): def visitUnarySub(self, node):
return self.unaryOp(node, 'UNARY_NEGATIVE') return self.unaryOp(node, 'UNARY_NEGATIVE')

View File

@ -153,11 +153,6 @@ class CodeGenerator:
"""TODO """TODO
EmptyNode EmptyNode
Exec
Invert
LeftShift
Power
RightShift
Sliceobj Sliceobj
Tryexcept Tryexcept
Tryfinally Tryfinally
@ -276,6 +271,8 @@ class CodeGenerator:
self.emit('SET_LINENO', node.lineno) self.emit('SET_LINENO', node.lineno)
self.emit('IMPORT_NAME', node.modname) self.emit('IMPORT_NAME', node.modname)
for name in node.names: for name in node.names:
if name == '*':
self.namespace = 0
self.emit('IMPORT_FROM', name) self.emit('IMPORT_FROM', name)
self.emit('POP_TOP') self.emit('POP_TOP')
@ -524,7 +521,6 @@ class CodeGenerator:
return 1 return 1
def visitAssign(self, node): def visitAssign(self, node):
print "ASSIGN", node.expr
self.emit('SET_LINENO', node.lineno) self.emit('SET_LINENO', node.lineno)
self.visit(node.expr) self.visit(node.expr)
dups = len(node.nodes) - 1 dups = len(node.nodes) - 1
@ -583,6 +579,18 @@ class CodeGenerator:
def visitMod(self, node): def visitMod(self, node):
return self.binaryOp(node, 'BINARY_MODULO') 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): def visitUnarySub(self, node):
return self.unaryOp(node, 'UNARY_NEGATIVE') return self.unaryOp(node, 'UNARY_NEGATIVE')