diff options
author | Wouter van Oortmerssen <wvo@google.com> | 2016-06-17 18:16:11 -0700 |
---|---|---|
committer | Wouter van Oortmerssen <wvo@google.com> | 2016-06-20 11:47:04 -0700 |
commit | 3639032d1e2224663202f79ca33c5039eed95f29 (patch) | |
tree | 1a22e00b573a8fd9003bd9f8f4a7a42ac43f60ba /tests/monster_test_generated.js | |
parent | 6e177bf03f027880abfca69ebfda8e4d8b1d2da7 (diff) | |
download | flatbuffers-3639032d1e2224663202f79ca33c5039eed95f29.tar.gz flatbuffers-3639032d1e2224663202f79ca33c5039eed95f29.tar.bz2 flatbuffers-3639032d1e2224663202f79ca33c5039eed95f29.zip |
Allow unions of table types with the same name but from different namespaces.
Also fixed most codegenerators using the wrong namespace when multiple
namespace were used in a file, with some files not being generated.
Change-Id: Ib42969221239d7244e431cbd667ef69200fc415f
Tested: on Linux.
Bug: 29338474
Diffstat (limited to 'tests/monster_test_generated.js')
-rw-r--r-- | tests/monster_test_generated.js | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/tests/monster_test_generated.js b/tests/monster_test_generated.js index f967b9d8..f67e8480 100644 --- a/tests/monster_test_generated.js +++ b/tests/monster_test_generated.js @@ -13,6 +13,11 @@ MyGame.Example = MyGame.Example || {}; /** * @const */ +MyGame.Example2 = MyGame.Example2 || {}; + +/** + * @const +*/ MyGame.OtherNameSpace = MyGame.OtherNameSpace || {}; /** @@ -30,7 +35,59 @@ MyGame.Example.Color = { MyGame.Example.Any = { NONE: 0, Monster: 1, - TestSimpleTableWithEnum: 2 + TestSimpleTableWithEnum: 2, + MyGame_Example2_Monster: 3 +}; + +/** + * @constructor + */ +MyGame.Example2.Monster = function() { + /** + * @type {flatbuffers.ByteBuffer} + */ + this.bb = null; + + /** + * @type {number} + */ + this.bb_pos = 0; +}; + +/** + * @param {number} i + * @param {flatbuffers.ByteBuffer} bb + * @returns {MyGame.Example2.Monster} + */ +MyGame.Example2.Monster.prototype.__init = function(i, bb) { + this.bb_pos = i; + this.bb = bb; + return this; +}; + +/** + * @param {flatbuffers.ByteBuffer} bb + * @param {MyGame.Example2.Monster=} obj + * @returns {MyGame.Example2.Monster} + */ +MyGame.Example2.Monster.getRootAsMonster = function(bb, obj) { + return (obj || new MyGame.Example2.Monster).__init(bb.readInt32(bb.position()) + bb.position(), bb); +}; + +/** + * @param {flatbuffers.Builder} builder + */ +MyGame.Example2.Monster.startMonster = function(builder) { + builder.startObject(0); +}; + +/** + * @param {flatbuffers.Builder} builder + * @returns {flatbuffers.Offset} + */ +MyGame.Example2.Monster.endMonster = function(builder) { + var offset = builder.endObject(); + return offset; }; /** |