[pypy-svn] r17431 - pypy/dist/pypy/interpreter/astcompiler
pedronis at codespeak.net
pedronis at codespeak.net
Fri Sep 9 20:57:02 CEST 2005
Author: pedronis
Date: Fri Sep 9 20:57:00 2005
New Revision: 17431
Modified:
pypy/dist/pypy/interpreter/astcompiler/ast.py
pypy/dist/pypy/interpreter/astcompiler/ast.txt
pypy/dist/pypy/interpreter/astcompiler/astgen.py
pypy/dist/pypy/interpreter/astcompiler/future.py
pypy/dist/pypy/interpreter/astcompiler/symbols.py
Log:
avoid last migration of attrs to Node.
Modified: pypy/dist/pypy/interpreter/astcompiler/ast.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/ast.py (original)
+++ pypy/dist/pypy/interpreter/astcompiler/ast.py Fri Sep 9 20:57:00 2005
@@ -26,6 +26,7 @@
def __init__(self, lineno = -1):
self.lineno = lineno
self.filename = ""
+ #self.scope = None
def getChildren(self):
pass # implemented by subclasses
@@ -182,7 +183,24 @@
def accept(self, visitor):
return visitor.visitAssAttr(self)
-class AssList(Node):
+class AssSeq(Node):
+ def __init__(self, lineno=-1):
+ Node.__init__(self, lineno)
+
+ def getChildren(self):
+ "NOT_RPYTHON"
+ return []
+
+ def getChildNodes(self):
+ return []
+
+ def __repr__(self):
+ return "AssSeq()"
+
+ def accept(self, visitor):
+ return visitor.visitAssSeq(self)
+
+class AssList(AssSeq):
def __init__(self, nodes, lineno=-1):
Node.__init__(self, lineno)
self.nodes = nodes
@@ -221,7 +239,7 @@
def accept(self, visitor):
return visitor.visitAssName(self)
-class AssTuple(Node):
+class AssTuple(AssSeq):
def __init__(self, nodes, lineno=-1):
Node.__init__(self, lineno)
self.nodes = nodes
@@ -1816,6 +1834,8 @@
return self.default( node )
def visitAssName(self, node):
return self.default( node )
+ def visitAssSeq(self, node):
+ return self.default( node )
def visitAssTuple(self, node):
return self.default( node )
def visitAssert(self, node):
Modified: pypy/dist/pypy/interpreter/astcompiler/ast.txt
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/ast.txt (original)
+++ pypy/dist/pypy/interpreter/astcompiler/ast.txt Fri Sep 9 20:57:00 2005
@@ -36,8 +36,9 @@
Discard: expr
AugAssign: node, op*, expr
Assign: nodes!, expr
-AssTuple: nodes!
-AssList: nodes!
+AssSeq:
+AssTuple(AssSeq): nodes!
+AssList(AssSeq): nodes!
AssName: name*, flags*
AssAttr: expr, attrname*, flags*
ListComp: expr, quals!
Modified: pypy/dist/pypy/interpreter/astcompiler/astgen.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/astgen.py (original)
+++ pypy/dist/pypy/interpreter/astcompiler/astgen.py Fri Sep 9 20:57:00 2005
@@ -378,7 +378,7 @@
def __init__(self, lineno = -1):
self.lineno = lineno
self.filename = ""
- self.scope = None
+ #self.scope = None
def getChildren(self):
pass # implemented by subclasses
Modified: pypy/dist/pypy/interpreter/astcompiler/future.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/future.py (original)
+++ pypy/dist/pypy/interpreter/astcompiler/future.py Fri Sep 9 20:57:00 2005
@@ -23,6 +23,7 @@
def visitModule(self, node):
stmt = node.node
invalid = False
+ assert isinstance(stmt, ast.Stmt)
for s in stmt.nodes:
if not self.check_stmt(s, invalid):
invalid = True
@@ -62,6 +63,7 @@
def visitModule(self, node):
stmt = node.node
+ assert isinstance(stmt, ast.Stmt)
for s in stmt.nodes:
if isinstance(s, ast.From):
if s.valid_future:
Modified: pypy/dist/pypy/interpreter/astcompiler/symbols.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/symbols.py (original)
+++ pypy/dist/pypy/interpreter/astcompiler/symbols.py Fri Sep 9 20:57:00 2005
@@ -248,7 +248,11 @@
node.node.accept(self)
self.pop_scope()
- visitExpression = visitModule
+ def visitExpression(self, node):
+ scope = self.module = node.scope = ModuleScope()
+ self.push_scope(scope)
+ node.node.accept(self)
+ self.pop_scope()
def visitFunction(self, node):
parent = self.cur_scope()
More information about the Pypy-commit
mailing list