diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-08-29 18:14:39 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-08-29 18:14:39 (GMT) |
commit | 94afe32b5eabf962c872850b10886f4545b02614 (patch) | |
tree | 3f485c2a0b36750396f3cb2029b1aae167645147 /Tools | |
parent | 7abf520d6c8c820f42332d51c58a192db658ac29 (diff) | |
download | cpython-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')
-rw-r--r-- | Tools/compiler/compiler/pycodegen.py | 7 |
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()) |