Commit 6f597594 authored by Stefan Behnel's avatar Stefan Behnel

cleaned up lambda cname mangeling by moving it into the Scope class

parent 4f6db40e
...@@ -2232,14 +2232,7 @@ class DefNode(FuncDefNode): ...@@ -2232,14 +2232,7 @@ class DefNode(FuncDefNode):
entry.doc = None entry.doc = None
def declare_lambda_function(self, env): def declare_lambda_function(self, env):
name = self.name entry = env.declare_lambda_function(self.lambda_name, self.pos)
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.doc = None entry.doc = None
self.entry = entry self.entry = entry
......
...@@ -556,10 +556,16 @@ class Scope(object): ...@@ -556,10 +556,16 @@ class Scope(object):
entry.is_anonymous = True entry.is_anonymous = True
return entry 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. # 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 = 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.func_cname = func_cname
entry.signature = pyfunction_signature entry.signature = pyfunction_signature
entry.is_anonymous = True entry.is_anonymous = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment