def _generate_struct_class_init(self, data_type):
args = ['<STR_LIT>']<EOL>for field in data_type.all_fields:<EOL><INDENT>field_name_reserved_check = fmt_var(field.name, True)<EOL>args.append('<STR_LIT>' % field_name_reserved_check)<EOL><DEDENT>self.generate_multiline_list(args, before='<STR_LIT>', after='<STR_LIT::>')<EOL>with self.indent():<EOL><INDENT>lineno = self.lineno<EOL>if data_type.parent_type:<EOL><INDENT>class_name = class_name_for_data_type(data_type)<EOL>all_parent_fields = [fmt_func(f.name, check_reserved=True)<EOL>for f in data_type.parent_type.all_fields]<EOL>self.generate_multiline_list(<EOL>all_parent_fields,<EOL>before='<STR_LIT>'.format(class_name))<EOL><DEDENT>for field in data_type.fields:<EOL><INDENT>field_var_name = fmt_var(field.name)<EOL>self.emit('<STR_LIT>'.format(field_var_name))<EOL>self.emit('<STR_LIT>'.format(field_var_name))<EOL><DEDENT>for field in data_type.fields:<EOL><INDENT>field_var_name = fmt_var(field.name, True)<EOL>self.emit('<STR_LIT>'.format(field_var_name))<EOL>with self.indent():<EOL><INDENT>self.emit('<STR_LIT>'.format(field_var_name))<EOL><DEDENT><DEDENT>if lineno == self.lineno:<EOL><INDENT>self.emit('<STR_LIT>')<EOL><DEDENT>self.emit()<EOL><DEDENT>
Generates constructor. The constructor takes all possible fields as
optional arguments. Any argument that is set on construction sets the
corresponding field for the instance.