summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-04-11 16:43:13 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-04-11 16:43:13 (GMT)
commit84ec1f91595410a86abf50f275cb0dc4ff432a95 (patch)
tree8592fbbb99f918046d4a2b1cf6a8d84b1ea6ec34
parent01d12937dfe827810b716625ce297ace44a3a6d2 (diff)
downloadcpython-84ec1f91595410a86abf50f275cb0dc4ff432a95.zip
cpython-84ec1f91595410a86abf50f275cb0dc4ff432a95.tar.gz
cpython-84ec1f91595410a86abf50f275cb0dc4ff432a95.tar.bz2
typo
-rw-r--r--Lib/compiler/pycodegen.py12
-rw-r--r--Tools/compiler/compiler/pycodegen.py12
2 files changed, 16 insertions, 8 deletions
diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py
index 904d066..3ba31e4 100644
--- a/Lib/compiler/pycodegen.py
+++ b/Lib/compiler/pycodegen.py
@@ -45,7 +45,10 @@ class Module:
def compile(self, display=0):
tree = parse(self.source)
root, filename = os.path.split(self.filename)
- gen = ModuleCodeGenerator(filename)
+ if "nested_scopes" in future.find_futures(tree):
+ gen = NestedScopeCodeGenerator(filename)
+ else:
+ gen = ModuleCodeGenerator(filename)
walk(tree, gen, 1)
if display:
import pprint
@@ -646,7 +649,7 @@ class CodeGenerator:
def visitAugSlice(self, node, mode):
if mode == "load":
- self.visitlSice(node, 1)
+ self.visitSlice(node, 1)
elif mode == "store":
slice = 0
if node.lower:
@@ -889,10 +892,8 @@ class ModuleCodeGenerator(CodeGenerator):
self.graph = pyassem.PyFlowGraph("<module>", filename)
self.__super_init(filename)
self.symbols = None
- self.future = None
def visitModule(self, node):
- self.future = future.find_futures(node)
self.symbols = self.parseSymbols(node)
self.__super_visitModule(node)
@@ -900,6 +901,9 @@ class ModuleCodeGenerator(CodeGenerator):
# XXX not implemented
return None
+class NestedScopeCodeGenerator(ModuleCodeGenerator):
+ pass
+
class FunctionCodeGenerator(CodeGenerator):
super_init = CodeGenerator.__init__
diff --git a/Tools/compiler/compiler/pycodegen.py b/Tools/compiler/compiler/pycodegen.py
index 904d066..3ba31e4 100644
--- a/Tools/compiler/compiler/pycodegen.py
+++ b/Tools/compiler/compiler/pycodegen.py
@@ -45,7 +45,10 @@ class Module:
def compile(self, display=0):
tree = parse(self.source)
root, filename = os.path.split(self.filename)
- gen = ModuleCodeGenerator(filename)
+ if "nested_scopes" in future.find_futures(tree):
+ gen = NestedScopeCodeGenerator(filename)
+ else:
+ gen = ModuleCodeGenerator(filename)
walk(tree, gen, 1)
if display:
import pprint
@@ -646,7 +649,7 @@ class CodeGenerator:
def visitAugSlice(self, node, mode):
if mode == "load":
- self.visitlSice(node, 1)
+ self.visitSlice(node, 1)
elif mode == "store":
slice = 0
if node.lower:
@@ -889,10 +892,8 @@ class ModuleCodeGenerator(CodeGenerator):
self.graph = pyassem.PyFlowGraph("<module>", filename)
self.__super_init(filename)
self.symbols = None
- self.future = None
def visitModule(self, node):
- self.future = future.find_futures(node)
self.symbols = self.parseSymbols(node)
self.__super_visitModule(node)
@@ -900,6 +901,9 @@ class ModuleCodeGenerator(CodeGenerator):
# XXX not implemented
return None
+class NestedScopeCodeGenerator(ModuleCodeGenerator):
+ pass
+
class FunctionCodeGenerator(CodeGenerator):
super_init = CodeGenerator.__init__