# HG changeset patch # User Paul Boddie # Date 1548979084 -3600 # Node ID 43f7a46d1e0d70200a5d5768c7fa6d7ad0054df8 # Parent 754d8420971945e9f8226c30d4210daaf98c5682# Parent 2eae728285eecb801b4f82013a8fe4daa16067be Merged changes from trailing-data. diff -r 754d84209719 -r 43f7a46d1e0d generator.py --- a/generator.py Thu Jan 31 22:48:01 2019 +0100 +++ b/generator.py Fri Feb 01 00:58:04 2019 +0100 @@ -3,7 +3,7 @@ """ Generate C code from object layouts and other deduced information. -Copyright (C) 2015, 2016, 2017, 2018 Paul Boddie +Copyright (C) 2015, 2016, 2017, 2018, 2019 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -257,7 +257,7 @@ self.populate_trailing(Reference(kind, path), attrs, trailing) if kind == "": - self.write_instance_structure(f_decls, path, structure_size) + self.write_instance_structure(f_decls, path) self.write_structure(f_decls, f_defs, path, table_name, structure, trailing, ref) @@ -300,7 +300,6 @@ cls = self.function_type table_name = encode_tablename("", cls) - structure_size = encode_size("", path) # Set a special callable attribute on the instance. @@ -313,7 +312,7 @@ # Functions with defaults need to declare instance structures. if self.importer.function_defaults.get(path): - self.write_instance_structure(f_decls, path, structure_size) + self.write_instance_structure(f_decls, path) extra_function_instances.append(path) # Write function declarations. @@ -838,13 +837,14 @@ """ % (table_name, min_parameters, max_parameters, structure_size, ",\n ".join(members)) - def write_instance_structure(self, f_decls, path, structure_size): + def write_instance_structure(self, f_decls, path): """ - Write a declaration to 'f_decls' for the object having the given 'path' - and the given 'structure_size'. + Write a declaration to 'f_decls' for the object having the given 'path'. """ + structure_size = encode_size("", path) + # Write an instance-specific type definition for instances of classes. # See: templates/types.h