Commit 5ee84d80 authored by Robert Bradshaw's avatar Robert Bradshaw

Need to pre-declare c method function in case it's referenced directly as an unbound method.

parent 9d928872
......@@ -2143,7 +2143,8 @@ class CFuncDefNode(FuncDefNode):
# overridable whether or not this is a cpdef function
# inline_in_pxd whether this is an inline function in a pxd file
# template_declaration String or None Used for c++ class methods
# is_const_method whether this is a const method
# is_const_method whether this is a const method
# is_c_class_method whether this is a cclass method
child_attrs = ["base_type", "declarator", "body", "py_func"]
......@@ -2159,6 +2160,7 @@ class CFuncDefNode(FuncDefNode):
return self.entry.name
def analyse_declarations(self, env):
self.is_c_class_method = env.is_c_class_scope
if self.directive_locals is None:
self.directive_locals = {}
self.directive_locals.update(env.directives['locals'])
......@@ -2375,8 +2377,13 @@ class CFuncDefNode(FuncDefNode):
header = self.return_type.declaration_code(entity, dll_linkage=dll_linkage)
#print (storage_class, modifiers, header)
needs_proto = self.is_c_class_method
if self.template_declaration:
if needs_proto:
code.globalstate.parts['module_declarations'].putln(self.template_declaration)
code.putln(self.template_declaration)
if needs_proto:
code.globalstate.parts['module_declarations'].putln("%s%s%s; /* proto*/" % (storage_class, modifiers, header))
code.putln("%s%s%s {" % (storage_class, modifiers, header))
def generate_argument_declarations(self, env, code):
......
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