From: Stefan Behnel Date: Thu, 21 Apr 2011 21:01:25 +0000 (+0200) Subject: cleaned up lambda cname mangeling by moving it into the Scope class X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6f597594657d52be893a93946d81b899b03f86b4;p=cython.git cleaned up lambda cname mangeling by moving it into the Scope class --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index c0753e5c..977447dc 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -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 diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 8fe2e8da..00f9fee3 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -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