# HG changeset patch # User Paul Boddie # Date 1478883186 -3600 # Node ID 8a92552d212d72bd3ceaa52dd9df4553815b2788 # Parent 78e02906e7f28ea1ec8b27e351d8412626524773 Fixed parameter table references for functions. diff -r 78e02906e7f2 -r 8a92552d212d generator.py --- a/generator.py Fri Nov 11 00:05:34 2016 +0100 +++ b/generator.py Fri Nov 11 17:53:06 2016 +0100 @@ -667,9 +667,8 @@ callable bound method structure). """ - cls = self.function_type structure = [] - self.populate_structure(Reference("", cls), function_instance_attrs, "", structure, unbound) + self.populate_structure(Reference("", path), function_instance_attrs, "", structure, unbound) # Append default members. @@ -687,9 +686,24 @@ the special __fn__ attribute. """ - origin = ref.get_origin() + # Populate function instance structures for functions. + + if ref.has_kind(""): + origin = self.function_type + structure_ref = Reference("", self.function_type) + + # Otherwise, just populate the appropriate structures. - for attrname in self.optimiser.structures[ref]: + else: + origin = ref.get_origin() + structure_ref = ref + + # Refer to instantiator function tables for classes, specific function + # tables for individual functions. + + ptable = encode_tablename("", ref.get_origin()) + + for attrname in self.optimiser.structures[structure_ref]: # Handle gaps in the structure. @@ -733,7 +747,7 @@ # Special argument specification member. elif attrname == "__args__": - structure.append("{.min=%s, .ptable=&%s}" % (attr, encode_tablename("", origin))) + structure.append("{.min=%s, .ptable=&%s}" % (attr, ptable)) continue # Special internal data member.