typo
This commit is contained in:
parent
01d12937df
commit
84ec1f9159
|
@ -45,6 +45,9 @@ class Module:
|
||||||
def compile(self, display=0):
|
def compile(self, display=0):
|
||||||
tree = parse(self.source)
|
tree = parse(self.source)
|
||||||
root, filename = os.path.split(self.filename)
|
root, filename = os.path.split(self.filename)
|
||||||
|
if "nested_scopes" in future.find_futures(tree):
|
||||||
|
gen = NestedScopeCodeGenerator(filename)
|
||||||
|
else:
|
||||||
gen = ModuleCodeGenerator(filename)
|
gen = ModuleCodeGenerator(filename)
|
||||||
walk(tree, gen, 1)
|
walk(tree, gen, 1)
|
||||||
if display:
|
if display:
|
||||||
|
@ -646,7 +649,7 @@ class CodeGenerator:
|
||||||
|
|
||||||
def visitAugSlice(self, node, mode):
|
def visitAugSlice(self, node, mode):
|
||||||
if mode == "load":
|
if mode == "load":
|
||||||
self.visitlSice(node, 1)
|
self.visitSlice(node, 1)
|
||||||
elif mode == "store":
|
elif mode == "store":
|
||||||
slice = 0
|
slice = 0
|
||||||
if node.lower:
|
if node.lower:
|
||||||
|
@ -889,10 +892,8 @@ class ModuleCodeGenerator(CodeGenerator):
|
||||||
self.graph = pyassem.PyFlowGraph("<module>", filename)
|
self.graph = pyassem.PyFlowGraph("<module>", filename)
|
||||||
self.__super_init(filename)
|
self.__super_init(filename)
|
||||||
self.symbols = None
|
self.symbols = None
|
||||||
self.future = None
|
|
||||||
|
|
||||||
def visitModule(self, node):
|
def visitModule(self, node):
|
||||||
self.future = future.find_futures(node)
|
|
||||||
self.symbols = self.parseSymbols(node)
|
self.symbols = self.parseSymbols(node)
|
||||||
self.__super_visitModule(node)
|
self.__super_visitModule(node)
|
||||||
|
|
||||||
|
@ -900,6 +901,9 @@ class ModuleCodeGenerator(CodeGenerator):
|
||||||
# XXX not implemented
|
# XXX not implemented
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
class NestedScopeCodeGenerator(ModuleCodeGenerator):
|
||||||
|
pass
|
||||||
|
|
||||||
class FunctionCodeGenerator(CodeGenerator):
|
class FunctionCodeGenerator(CodeGenerator):
|
||||||
super_init = CodeGenerator.__init__
|
super_init = CodeGenerator.__init__
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,9 @@ class Module:
|
||||||
def compile(self, display=0):
|
def compile(self, display=0):
|
||||||
tree = parse(self.source)
|
tree = parse(self.source)
|
||||||
root, filename = os.path.split(self.filename)
|
root, filename = os.path.split(self.filename)
|
||||||
|
if "nested_scopes" in future.find_futures(tree):
|
||||||
|
gen = NestedScopeCodeGenerator(filename)
|
||||||
|
else:
|
||||||
gen = ModuleCodeGenerator(filename)
|
gen = ModuleCodeGenerator(filename)
|
||||||
walk(tree, gen, 1)
|
walk(tree, gen, 1)
|
||||||
if display:
|
if display:
|
||||||
|
@ -646,7 +649,7 @@ class CodeGenerator:
|
||||||
|
|
||||||
def visitAugSlice(self, node, mode):
|
def visitAugSlice(self, node, mode):
|
||||||
if mode == "load":
|
if mode == "load":
|
||||||
self.visitlSice(node, 1)
|
self.visitSlice(node, 1)
|
||||||
elif mode == "store":
|
elif mode == "store":
|
||||||
slice = 0
|
slice = 0
|
||||||
if node.lower:
|
if node.lower:
|
||||||
|
@ -889,10 +892,8 @@ class ModuleCodeGenerator(CodeGenerator):
|
||||||
self.graph = pyassem.PyFlowGraph("<module>", filename)
|
self.graph = pyassem.PyFlowGraph("<module>", filename)
|
||||||
self.__super_init(filename)
|
self.__super_init(filename)
|
||||||
self.symbols = None
|
self.symbols = None
|
||||||
self.future = None
|
|
||||||
|
|
||||||
def visitModule(self, node):
|
def visitModule(self, node):
|
||||||
self.future = future.find_futures(node)
|
|
||||||
self.symbols = self.parseSymbols(node)
|
self.symbols = self.parseSymbols(node)
|
||||||
self.__super_visitModule(node)
|
self.__super_visitModule(node)
|
||||||
|
|
||||||
|
@ -900,6 +901,9 @@ class ModuleCodeGenerator(CodeGenerator):
|
||||||
# XXX not implemented
|
# XXX not implemented
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
class NestedScopeCodeGenerator(ModuleCodeGenerator):
|
||||||
|
pass
|
||||||
|
|
||||||
class FunctionCodeGenerator(CodeGenerator):
|
class FunctionCodeGenerator(CodeGenerator):
|
||||||
super_init = CodeGenerator.__init__
|
super_init = CodeGenerator.__init__
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue