mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-04 20:48:59 +00:00
fixed packing structs (#6530)
* fixed packing structs in nested buffers * fixed packing structs
This commit is contained in:
@@ -856,10 +856,16 @@ class TsGenerator : public BaseGenerator {
|
||||
const std::string field_accessor = "this." + field_name + "()";
|
||||
field_val = GenNullCheckConditional(field_accessor,
|
||||
field_accessor + "!.unpack()");
|
||||
field_offset_decl = GenNullCheckConditional(
|
||||
auto packing = GenNullCheckConditional(
|
||||
"this." + field_name, "this." + field_name + "!.pack(builder)",
|
||||
"0");
|
||||
|
||||
if (sd.fixed) {
|
||||
field_offset_val = std::move(packing);
|
||||
} else {
|
||||
field_offset_decl = std::move(packing);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user