1.1 --- a/generator.py Sat Jan 26 21:38:12 2019 +0100
1.2 +++ b/generator.py Fri Feb 01 00:52:20 2019 +0100
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Generate C code from object layouts and other deduced information.
1.6
1.7 -Copyright (C) 2015, 2016, 2017, 2018 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2015, 2016, 2017, 2018, 2019 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU General Public License as published by the Free Software
1.12 @@ -257,7 +257,7 @@
1.13 self.populate_trailing(Reference(kind, path), attrs, trailing)
1.14
1.15 if kind == "<class>":
1.16 - self.write_instance_structure(f_decls, path, structure_size)
1.17 + self.write_instance_structure(f_decls, path)
1.18
1.19 self.write_structure(f_decls, f_defs, path, table_name,
1.20 structure, trailing, ref)
1.21 @@ -300,7 +300,6 @@
1.22
1.23 cls = self.function_type
1.24 table_name = encode_tablename("<instance>", cls)
1.25 - structure_size = encode_size("<instance>", path)
1.26
1.27 # Set a special callable attribute on the instance.
1.28
1.29 @@ -313,7 +312,7 @@
1.30 # Functions with defaults need to declare instance structures.
1.31
1.32 if self.importer.function_defaults.get(path):
1.33 - self.write_instance_structure(f_decls, path, structure_size)
1.34 + self.write_instance_structure(f_decls, path)
1.35 extra_function_instances.append(path)
1.36
1.37 # Write function declarations.
1.38 @@ -838,13 +837,14 @@
1.39 """ % (table_name, min_parameters, max_parameters, structure_size,
1.40 ",\n ".join(members))
1.41
1.42 - def write_instance_structure(self, f_decls, path, structure_size):
1.43 + def write_instance_structure(self, f_decls, path):
1.44
1.45 """
1.46 - Write a declaration to 'f_decls' for the object having the given 'path'
1.47 - and the given 'structure_size'.
1.48 + Write a declaration to 'f_decls' for the object having the given 'path'.
1.49 """
1.50
1.51 + structure_size = encode_size("<instance>", path)
1.52 +
1.53 # Write an instance-specific type definition for instances of classes.
1.54 # See: templates/types.h
1.55