cleaned up lambda cname mangeling by moving it into the Scope class
authorStefan Behnel <scoder@users.berlios.de>
Thu, 21 Apr 2011 21:01:25 +0000 (23:01 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 21 Apr 2011 21:01:25 +0000 (23:01 +0200)
Cython/Compiler/Nodes.py
Cython/Compiler/Symtab.py

index c0753e5ccdd387c2d27b0b209702de79b621b204..977447dc3f9c2e6fcb2105a93d5cda9c720a494e 100644 (file)
@@ -2232,14 +2232,7 @@ class DefNode(FuncDefNode):
             entry.doc = None
 
     def declare_lambda_function(self, env):
-        name = self.name
-        prefix = env.scope_prefix
-        func_cname = \
-            Naming.lambda_func_prefix + u'funcdef' + prefix + self.lambda_name
-        entry = env.declare_lambda_function(func_cname, self.pos)
-        entry.pymethdef_cname = \
-            Naming.lambda_func_prefix + u'methdef' + prefix + self.lambda_name
-        entry.qualified_name = env.qualify_name(self.lambda_name)
+        entry = env.declare_lambda_function(self.lambda_name, self.pos)
         entry.doc = None
         self.entry = entry
 
index 8fe2e8da5877ff6e7f86bc81cb3bc706cc57110e..00f9fee33b70d9bd22be13b812b02136a3b613c7 100644 (file)
@@ -556,10 +556,16 @@ class Scope(object):
         entry.is_anonymous = True
         return entry
 
-    def declare_lambda_function(self, func_cname, pos):
+    def declare_lambda_function(self, lambda_name, pos):
         # Add an entry for an anonymous Python function.
+        func_cname = self.mangle(Naming.lambda_func_prefix + u'funcdef_', lambda_name)
+        pymethdef_cname = self.mangle(Naming.lambda_func_prefix + u'methdef_', lambda_name)
+        qualified_name = self.qualify_name(lambda_name)
+
         entry = self.declare(None, func_cname, py_object_type, pos, 'private')
-        entry.name = EncodedString(func_cname)
+        entry.name = lambda_name
+        entry.qualified_name = qualified_name
+        entry.pymethdef_cname = pymethdef_cname
         entry.func_cname = func_cname
         entry.signature = pyfunction_signature
         entry.is_anonymous = True