[typescript] Size-prefixed root accessors not taking into account size prefix (#5717)

* [typescript/javascript] Size-prefixed root accessor needs to account for the size prefix.

* [typescript] Add parentheses after "new" expression.

* Update generated test files
This commit is contained in:
Max Burke
2020-01-20 21:20:52 -08:00
committed by Wouter van Oortmerssen
parent 6da1cf79d9
commit 9cadf05d89
9 changed files with 79 additions and 46 deletions

View File

@@ -67,6 +67,7 @@ Attacker.getRootAsAttacker = function(bb, obj) {
* @returns {Attacker}
*/
Attacker.getSizePrefixedRootAsAttacker = function(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Attacker).__init(bb.readInt32(bb.position()) + bb.position(), bb);
};
@@ -287,6 +288,7 @@ Movie.getRootAsMovie = function(bb, obj) {
* @returns {Movie}
*/
Movie.getSizePrefixedRootAsMovie = function(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Movie).__init(bb.readInt32(bb.position()) + bb.position(), bb);
};