# HG changeset patch # User paulb@jeremy # Date 1160178519 -7200 # Node ID 78821b14361322fef9e4e033865546ebd907e069 # Parent 281018e374f289cc57fbbda0a3dde24b8f7553e4 Introduced original nodes in all new simplified nodes. diff -r 281018e374f2 -r 78821b143613 fixnames.py --- a/fixnames.py Sat Oct 07 00:23:47 2006 +0200 +++ b/fixnames.py Sat Oct 07 01:48:39 2006 +0200 @@ -247,7 +247,13 @@ # For structure namespaces, load an attribute. if scope == "structure": - result = self.dispatch(LoadAttr(expr=LoadRef(ref=self.namespace.structure), name=loadname.name, nstype="structure")) + result = self.dispatch( + LoadAttr(loadname.original, + expr=LoadRef(loadname.original, + ref=self.namespace.structure), + name=loadname.name, + nstype="structure") + ) # For global accesses (ie. those outside the local namespace)... @@ -262,19 +268,37 @@ # built-in. if scope == "global": - result = self.dispatch(LoadAttr(expr=LoadRef(ref=self.builtins), name=loadname.name, nstype="module")) + result = self.dispatch( + LoadAttr(loadname.original, + expr=LoadRef(loadname.original, + ref=self.builtins), + name=loadname.name, + nstype="module") + ) # Otherwise, it is within the global namespace and must be a # global. else: - result = self.dispatch(LoadAttr(expr=LoadRef(ref=self.module), name=loadname.name, nstype="module")) + result = self.dispatch( + LoadAttr(loadname.original, + expr=LoadRef(loadname.original, + ref=self.module), + name=loadname.name, + nstype="module") + ) # Where no global namespace exists, we are at the module level and # must be accessing a built-in. else: - result = self.dispatch(LoadAttr(expr=LoadRef(ref=self.builtins), name=loadname.name, nstype="module")) + result = self.dispatch( + LoadAttr(loadname.original, + expr=LoadRef(loadname.original, + ref=self.builtins), + name=loadname.name, + nstype="module") + ) # For local accesses... @@ -289,7 +313,13 @@ # module level). else: - result = self.dispatch(LoadAttr(expr=LoadRef(ref=self.module), name=loadname.name, nstype="module")) + result = self.dispatch( + LoadAttr(loadname.original, + expr=LoadRef(loadname.original, + ref=self.module), + name=loadname.name, + nstype="module") + ) return result @@ -302,13 +332,27 @@ # For structure namespaces, store an attribute. if scope == "structure": - return self.dispatch(StoreAttr(lvalue=LoadRef(ref=self.namespace.structure), name=storename.name, expr=storename.expr, nstype="structure")) + return self.dispatch( + StoreAttr(storename.original, + lvalue=LoadRef(storename.original, + ref=self.namespace.structure), + name=storename.name, + expr=storename.expr, + nstype="structure") + ) # Where the name is outside the local namespace, disallow any built-in # assignment and store the name globally. elif scope == "global": - return self.dispatch(StoreAttr(lvalue=LoadRef(ref=self.module), name=storename.name, expr=storename.expr, nstype="module")) + return self.dispatch( + StoreAttr(storename.original, + lvalue=LoadRef(storename.original, + ref=self.module), + name=storename.name, + expr=storename.expr, + nstype="module") + ) # For local namespace accesses... @@ -324,7 +368,14 @@ # considered global. else: - return self.dispatch(StoreAttr(lvalue=LoadRef(ref=self.module), name=storename.name, expr=storename.expr, nstype="module")) + return self.dispatch( + StoreAttr(storename.original, + lvalue=LoadRef(storename.original, + ref=self.module), + name=storename.name, + expr=storename.expr, + nstype="module") + ) def visitInvokeFunction(self, invoke):