summaryrefslogtreecommitdiffstats
path: root/Tools/compiler
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-08-29 18:14:39 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-08-29 18:14:39 (GMT)
commit94afe32b5eabf962c872850b10886f4545b02614 (patch)
tree3f485c2a0b36750396f3cb2029b1aae167645147 /Tools/compiler
parent7abf520d6c8c820f42332d51c58a192db658ac29 (diff)
downloadcpython-94afe32b5eabf962c872850b10886f4545b02614.zip
cpython-94afe32b5eabf962c872850b10886f4545b02614.tar.gz
cpython-94afe32b5eabf962c872850b10886f4545b02614.tar.bz2
Support // and //=
Generate SET_LINENO for del statements. Define klass=1 for PyFlowGraph constructor for a class statement. A class has no varnames.
Diffstat (limited to 'Tools/compiler')
-rw-r--r--Tools/compiler/compiler/pycodegen.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Tools/compiler/compiler/pycodegen.py b/Tools/compiler/compiler/pycodegen.py
index 882e6b1..b0bddb7 100644
--- a/Tools/compiler/compiler/pycodegen.py
+++ b/Tools/compiler/compiler/pycodegen.py
@@ -671,6 +671,7 @@ class CodeGenerator:
if node.flags == 'OP_ASSIGN':
self.storeName(node.name)
elif node.flags == 'OP_DELETE':
+ self.set_lineno(node)
self.delName(node.name)
else:
print "oops", node.flags
@@ -716,6 +717,7 @@ class CodeGenerator:
'-=' : 'INPLACE_SUBTRACT',
'*=' : 'INPLACE_MULTIPLY',
'/=' : 'INPLACE_DIVIDE',
+ '//=': 'INPLACE_FLOOR_DIVIDE',
'%=' : 'INPLACE_MODULO',
'**=': 'INPLACE_POWER',
'>>=': 'INPLACE_RSHIFT',
@@ -889,6 +891,9 @@ class CodeGenerator:
def visitDiv(self, node):
return self.binaryOp(node, 'BINARY_DIVIDE')
+ def visitFloorDiv(self, node):
+ return self.binaryOp(node, 'BINARY_FLOOR_DIVIDE')
+
def visitMod(self, node):
return self.binaryOp(node, 'BINARY_MODULO')
@@ -1168,7 +1173,7 @@ class AbstractClassCode:
def __init__(self, klass, filename, scopes):
self.class_name = klass.name
self.graph = pyassem.PyFlowGraph(klass.name, filename,
- optimized=0)
+ optimized=0, klass=1)
self.super_init(filename)
lnf = walk(klass.code, self.NameFinder(), verbose=0)
self.locals.push(lnf.getLocals())