code cleanup
authorStefan Behnel <scoder@users.berlios.de>
Sat, 1 May 2010 16:20:25 +0000 (18:20 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 1 May 2010 16:20:25 +0000 (18:20 +0200)
Cython/Compiler/ParseTreeTransforms.py

index ce213c968d74ade5cbe56160b9f693fce5d6f84f..24a1145bedbf6ee21f04d2dd488e28e4fc2c32cb 100644 (file)
@@ -1272,7 +1272,7 @@ class TransformBuiltinMethods(EnvTransform):
         # locals builtin
         if isinstance(node.function, ExprNodes.NameNode):
             if node.function.name == 'locals':
-                lenv = self.env_stack[-1]
+                lenv = self.current_env()
                 entry = lenv.lookup_here('locals')
                 if entry:
                     # not the builtin 'locals'
@@ -1298,7 +1298,7 @@ class TransformBuiltinMethods(EnvTransform):
                 if len(node.args) != 2:
                     error(node.function.pos, u"cast() takes exactly two arguments")
                 else:
-                    type = node.args[0].analyse_as_type(self.env_stack[-1])
+                    type = node.args[0].analyse_as_type(self.current_env())
                     if type:
                         node = TypecastNode(node.function.pos, type=type, operand=node.args[1])
                     else:
@@ -1307,7 +1307,7 @@ class TransformBuiltinMethods(EnvTransform):
                 if len(node.args) != 1:
                     error(node.function.pos, u"sizeof() takes exactly one argument")
                 else:
-                    type = node.args[0].analyse_as_type(self.env_stack[-1])
+                    type = node.args[0].analyse_as_type(self.current_env())
                     if type:
                         node = SizeofTypeNode(node.function.pos, arg_type=type)
                     else: