python: object generation prefix and suffix (#7565)
Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
parent
051afd8825
commit
15f32c6907
|
@ -1160,8 +1160,8 @@ class PythonGenerator : public BaseGenerator {
|
|||
code += field_type + "()";
|
||||
}
|
||||
code += ") is not None:";
|
||||
code += GenIndents(3) + "self." + field_field + " = " + field_type +
|
||||
"T.InitFromObj(" + struct_var + "." + field_method + "(";
|
||||
code += GenIndents(3) + "self." + field_field + " = " + namer_.ObjectType(field_type) +
|
||||
+ ".InitFromObj(" + struct_var + "." + field_method + "(";
|
||||
// A struct's accessor requires a struct buf instance.
|
||||
if (struct_def.fixed && field.value.type.base_type == BASE_TYPE_STRUCT) {
|
||||
code += field_type + "()";
|
||||
|
@ -1211,8 +1211,8 @@ class PythonGenerator : public BaseGenerator {
|
|||
"(i) is None:";
|
||||
code += GenIndents(5) + "self." + field_field + ".append(None)";
|
||||
code += GenIndents(4) + "else:";
|
||||
code += GenIndents(5) + one_instance + " = " + field_type +
|
||||
"T.InitFromObj(" + struct_var + "." + field_method + "(i))";
|
||||
code += GenIndents(5) + one_instance + " = " + namer_.ObjectType(field_type) +
|
||||
".InitFromObj(" + struct_var + "." + field_method + "(i))";
|
||||
code +=
|
||||
GenIndents(5) + "self." + field_field + ".append(" + one_instance + ")";
|
||||
}
|
||||
|
@ -1242,8 +1242,8 @@ class PythonGenerator : public BaseGenerator {
|
|||
"(i) is None:";
|
||||
code += GenIndents(5) + "self." + field_field + ".append(None)";
|
||||
code += GenIndents(4) + "else:";
|
||||
code += GenIndents(5) + one_instance + " = " + field_type +
|
||||
"T.InitFromObj(" + struct_var + "." + field_method + "(i))";
|
||||
code += GenIndents(5) + one_instance + " = " + namer_.ObjectType(field_type) +
|
||||
".InitFromObj(" + struct_var + "." + field_method + "(i))";
|
||||
code +=
|
||||
GenIndents(5) + "self." + field_field + ".append(" + one_instance + ")";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue