summaryrefslogtreecommitdiffstats
path: root/Lib/compiler/pycodegen.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-12-21 20:04:22 (GMT)
committerBarry Warsaw <barry@python.org>2001-12-21 20:04:22 (GMT)
commit52acb49298fd0aee8a2a2a352f0b2ab039649bde (patch)
tree8494a3378452f85b4b71a0e02bc6c63cc21f8bec /Lib/compiler/pycodegen.py
parent87fa3aa12cbb24c89cfb13c16d04f46a2dd9a9e1 (diff)
downloadcpython-52acb49298fd0aee8a2a2a352f0b2ab039649bde.zip
cpython-52acb49298fd0aee8a2a2a352f0b2ab039649bde.tar.gz
cpython-52acb49298fd0aee8a2a2a352f0b2ab039649bde.tar.bz2
Merge of the release22 branch changes back into the trunk.
Diffstat (limited to 'Lib/compiler/pycodegen.py')
-rw-r--r--Lib/compiler/pycodegen.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py
index f526ae1..4194d27 100644
--- a/Lib/compiler/pycodegen.py
+++ b/Lib/compiler/pycodegen.py
@@ -34,6 +34,7 @@ EXCEPT = 2
TRY_FINALLY = 3
END_FINALLY = 4
+# XXX this doesn't seem to be used
class BlockStack(misc.Stack):
__super_init = misc.Stack.__init__
@@ -351,6 +352,13 @@ class CodeGenerator:
self.emit('LOAD_CONST', None)
self.emit('RETURN_VALUE')
+ def visitExpression(self, node):
+ self.set_lineno(node)
+ self.scopes = self.parseSymbols(node)
+ self.scope = self.scopes[node]
+ self.visit(node.node)
+ self.emit('RETURN_VALUE')
+
def visitFunction(self, node):
self._visitFuncOrLambda(node, isLambda=0)
if node.doc:
@@ -1158,9 +1166,7 @@ class ExpressionCodeGenerator(NestedScopeMixin, CodeGenerator):
def __init__(self, tree):
self.graph = pyassem.PyFlowGraph("<expression>", tree.filename)
self.__super_init()
- self.set_lineno(tree)
walk(tree, self)
- self.emit('RETURN_VALUE')
def get_module(self):
return self
@@ -1181,6 +1187,7 @@ class InteractiveCodeGenerator(NestedScopeMixin, CodeGenerator):
def get_module(self):
return self
+
def visitDiscard(self, node):
# XXX Discard means it's an expression. Perhaps this is a bad
# name.
@@ -1299,7 +1306,6 @@ class ClassCodeGenerator(NestedScopeMixin, AbstractClassCode, CodeGenerator):
self.__super_init(klass, scopes, module)
self.graph.setFreeVars(self.scope.get_free_vars())
self.graph.setCellVars(self.scope.get_cell_vars())
-## self.graph.setFlag(CO_NESTED)
def generateArgList(arglist):
"""Generate an arg list marking TupleArgs"""