Commit fe2191ac authored by Mark Florisson's avatar Mark Florisson

Fix a little bug

parent 8ff5f8b8
......@@ -3008,7 +3008,8 @@ class SimpleCallNode(CallNode):
if overloaded_entry:
if self.function.type.is_fused:
alternatives = []
self.function.type.map_with_specific_entries(alternatives.append)
PyrexTypes.map_with_specific_entries(self.function.entry,
alternatives.append)
else:
alternatives = overloaded_entry.all_alternatives()
......
......@@ -156,8 +156,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
f.close()
def generate_public_declaration(self, entry, h_code, i_code):
entry.type.map_with_specific_entries(self._generate_public_declaration,
h_code, i_code)
PyrexTypes.map_with_specific_entries(entry,
self._generate_public_declaration,
h_code,
i_code)
def _generate_public_declaration(self, entry, h_code, i_code):
h_code.putln("%s %s;" % (
......@@ -990,9 +992,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
dll_linkage = "DL_EXPORT", definition = definition)
def generate_cfunction_predeclarations(self, env, code, definition):
func = self._generate_cfunction_predeclaration
for entry in env.cfunc_entries:
entry.type.map_with_specific_entries(
self._generate_cfunction_predeclaration, code, definition)
PyrexTypes.map_with_specific_entries(entry, func, code, definition)
def _generate_cfunction_predeclaration(self, entry, code, definition):
if entry.inline_func_in_pxd or (not entry.in_cinclude and (definition
......@@ -2050,7 +2052,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
for entry in env.cfunc_entries:
from_fused = entry.type.is_fused
if entry.api or entry.defined_in_pxd:
entry.type.map_with_specific_entries(func, env, code, from_fused)
PyrexTypes.map_with_specific_entries(entry, func, env,
code, from_fused)
def _generate_c_function_export_code(self, entry, env, code, from_fused):
env.use_utility_code(function_export_utility_code)
......@@ -2094,7 +2097,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.error_goto(self.pos)))
for entry in entries:
entry.type.map_with_specific_entries(self._import_cdef_func,
PyrexTypes.map_with_specific_entries(entry,
self._import_cdef_func,
code,
temp,
entry.type.is_fused)
......
......@@ -2056,26 +2056,28 @@ class CFuncType(CType):
fused_cname,
self.entry.func_cname)
def map_with_specific_entries(self, func, *args, **kwargs):
def map_with_specific_entries(entry, func, *args, **kwargs):
"""
Call func for every specific function instance. If this is not a
signature with fused types, call it with the entry for this cdef
function.
"""
entry = self.entry
type = entry.type
if type.is_cfunction and (entry.fused_cfunction or type.is_fused):
if entry.fused_cfunction:
# cdef with fused types defined in this file
for cfunction in entry.fused_cfunction.nodes:
func(cfunction.entry, *args, **kwargs)
elif entry.type.is_fused:
else:
# cdef with fused types defined in another file, create their
# signatures
for func_type in self.get_all_specific_function_types():
for func_type in type.get_all_specific_function_types():
func(func_type.entry, *args, **kwargs)
else:
# a normal cdef
return func(entry, *args, **kwargs)
# a normal cdef or not a c function
func(entry, *args, **kwargs)
def get_all_specific_permutations(fused_types, id="0", f2s=()):
fused_type = fused_types[0]
......
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