Object API packs arrays of structs in reverse order [TS, master] #7021
Closed as not planned
Description
Generated TypeScript code in object-model API mostly does array reversal automatically to handle the backwards insertion order when packing, but for arrays-of-structs it does not.
Calls are generated to builder.createStructOffsetList
with no reversal wrappers, and the function doesn't do any reversal logic internally.
The unit test code which should catch this failure is flawed, and does not verify correct ordering after pack/unpack round-trip (summing array elements is commutative):
https://github.com/google/flatbuffers/blob/master/tests/JavaScriptTest.js#L168
let test_0 = monster.test4[0];
let test_1 = monster.test4[1];
assert.strictEqual(monster.test4.length, 2);
assert.strictEqual(test_0.a + test_0.b + test_1.a + test_1.b, 100);
Activity