summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKamil Rojewski <kamil.rojewski@gmail.com>2021-03-25 18:25:00 +0100
committerGitHub <noreply@github.com>2021-03-25 10:25:00 -0700
commit124654ffc4ef8ee8a67aca8af3d9a6e58bd38f59 (patch)
tree37fc3686f25348207555749b9f275005549c67d7 /src
parent3b7d1e86b46e2e79715e0aab915e1ceaca958a8e (diff)
downloadflatbuffers-124654ffc4ef8ee8a67aca8af3d9a6e58bd38f59.tar.gz
flatbuffers-124654ffc4ef8ee8a67aca8af3d9a6e58bd38f59.tar.bz2
flatbuffers-124654ffc4ef8ee8a67aca8af3d9a6e58bd38f59.zip
fixed packing structs (#6530)
* fixed packing structs in nested buffers * fixed packing structs
Diffstat (limited to 'src')
-rw-r--r--src/idl_gen_ts.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/idl_gen_ts.cpp b/src/idl_gen_ts.cpp
index a6d4ef6c..b9e32f56 100644
--- a/src/idl_gen_ts.cpp
+++ b/src/idl_gen_ts.cpp
@@ -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;
}