mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 10:48:51 +00:00
THRIFT-3654 incorrect serialization of optionals
Client: Haxe Patch: Jens Geyer
This commit is contained in:
parent
b72bb94a82
commit
a2e74465d4
@ -978,6 +978,11 @@ void t_haxe_generator::generate_haxe_struct_writer(ofstream& out, t_struct* tstr
|
||||
indent(out) << "oprot.writeStructBegin(STRUCT_DESC);" << endl;
|
||||
|
||||
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
|
||||
bool could_be_unset = (*f_iter)->get_req() == t_field::T_OPTIONAL;
|
||||
if (could_be_unset) {
|
||||
indent(out) << "if (" << generate_isset_check(*f_iter) << ") {" << endl;
|
||||
indent_up();
|
||||
}
|
||||
bool null_allowed = type_can_be_null((*f_iter)->get_type());
|
||||
if (null_allowed) {
|
||||
out << indent() << "if (this." << (*f_iter)->get_name() << " != null) {" << endl;
|
||||
@ -997,6 +1002,10 @@ void t_haxe_generator::generate_haxe_struct_writer(ofstream& out, t_struct* tstr
|
||||
indent_down();
|
||||
indent(out) << "}" << endl;
|
||||
}
|
||||
if (could_be_unset) {
|
||||
indent_down();
|
||||
indent(out) << "}" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
indent(out) << "oprot.writeFieldStop();" << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user