From 37b9c69e3a4467e48f049cf45142655c0fc3e911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Harrtell?= Date: Sun, 25 Sep 2022 21:20:20 +0200 Subject: [PATCH 1/3] [TS] Make strict compliant and improve typings --- package.json | 1 + src/idl_gen_ts.cpp | 27 ++-- tests/ts/my-game/example/ability.ts | 4 +- tests/ts/my-game/example/monster.js | 12 +- tests/ts/my-game/example/monster.ts | 96 +++++++-------- tests/ts/my-game/example/referrable.ts | 4 +- tests/ts/my-game/example/stat.ts | 4 +- .../example/struct-of-structs-of-structs.ts | 4 +- tests/ts/my-game/example/struct-of-structs.ts | 4 +- .../example/test-simple-table-with-enum.ts | 4 +- tests/ts/my-game/example/test.ts | 4 +- tests/ts/my-game/example/type-aliases.ts | 12 +- tests/ts/my-game/example/vec3.ts | 4 +- tests/ts/my-game/example2/monster.ts | 4 +- tests/ts/my-game/in-parent-namespace.ts | 4 +- tests/ts/reflection/enum-val.ts | 8 +- tests/ts/reflection/enum.ts | 16 +-- tests/ts/reflection/field.ts | 12 +- tests/ts/reflection/key-value.ts | 4 +- tests/ts/reflection/object.ts | 16 +-- tests/ts/reflection/rpccall.ts | 12 +- tests/ts/reflection/schema-file.ts | 8 +- tests/ts/reflection/schema.ts | 20 +-- tests/ts/reflection/service.ts | 16 +-- tests/ts/reflection/type.ts | 4 +- tests/ts/reflection_generated.ts | 116 +++++++++--------- tests/ts/typescript/object.ts | 4 +- tests/ts/typescript_keywords_generated.ts | 4 +- tests/ts/union_vector/attacker.ts | 4 +- tests/ts/union_vector/book-reader.ts | 4 +- tests/ts/union_vector/falling-tub.ts | 4 +- tests/ts/union_vector/hand-fan.ts | 4 +- tests/ts/union_vector/movie.js | 16 +-- tests/ts/union_vector/movie.ts | 24 ++-- tests/ts/union_vector/rapunzel.ts | 4 +- tests/union_vector/union_vector_generated.h | 27 ++++ ts/builder.ts | 6 +- ts/byte-buffer.ts | 22 ++-- ts/flatbuffers.ts | 1 + ts/index.ts | 2 +- ts/types.ts | 5 +- 41 files changed, 293 insertions(+), 258 deletions(-) create mode 100644 ts/flatbuffers.ts diff --git a/package.json b/package.json index 7e96db7047c..ce8f35268b2 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ }, "scripts": { "test": "npm run compile && cd tests/ts && python3 ./TypeScriptTest.py", + "lint": "eslint ts", "compile": "tsc && tsc -p tsconfig.mjs.json && rollup -c", "prepublishOnly": "npm install --only=dev && npm run compile" }, diff --git a/src/idl_gen_ts.cpp b/src/idl_gen_ts.cpp index 32ab863edc9..1e557074fc2 100644 --- a/src/idl_gen_ts.cpp +++ b/src/idl_gen_ts.cpp @@ -903,7 +903,7 @@ class TsGenerator : public BaseGenerator { const auto conversion_function = GenUnionConvFuncName(enum_def); ret = "(() => {\n"; - ret += " let temp = " + conversion_function + "(this." + + ret += " const temp = " + conversion_function + "(this." + namer_.Method(field_name, "Type") + "(), " + field_binded_method + ");\n"; ret += " if(temp === null) { return null; }\n"; @@ -916,17 +916,17 @@ class TsGenerator : public BaseGenerator { const auto conversion_function = GenUnionListConvFuncName(enum_def); ret = "(() => {\n"; - ret += " let ret = [];\n"; + ret += " const ret = [];\n"; ret += " for(let targetEnumIndex = 0; targetEnumIndex < this." + namer_.Method(field_name, "TypeLength") + "()" + "; " "++targetEnumIndex) {\n"; - ret += " let targetEnum = this." + + ret += " const targetEnum = this." + namer_.Method(field_name, "Type") + "(targetEnumIndex);\n"; ret += " if(targetEnum === null || " + enum_type + "[targetEnum!] === 'NONE') { " "continue; }\n\n"; - ret += " let temp = " + conversion_function + "(targetEnum, " + + ret += " const temp = " + conversion_function + "(targetEnum, " + field_binded_method + ", targetEnumIndex);\n"; ret += " if(temp === null) { continue; }\n"; ret += union_has_string ? " if(typeof temp === 'string') { " @@ -1102,11 +1102,12 @@ class TsGenerator : public BaseGenerator { switch (vectortype.base_type) { case BASE_TYPE_STRUCT: { const auto &sd = *field.value.type.struct_def; - field_type += GetTypeName(sd, /*object_api=*/true); - ; + const auto field_type_name = GetTypeName(sd, /*object_api=*/true); + field_type += field_type_name; field_type += ")[]"; - field_val = GenBBAccess() + ".createObjList(" + + field_val = GenBBAccess() + ".createObjList<" + vectortypename + ", " + + field_type_name + ">(" + field_binded_method + ", this." + namer_.Method(field, "Length") + "())"; @@ -1128,7 +1129,7 @@ class TsGenerator : public BaseGenerator { case BASE_TYPE_STRING: { field_type += "string)[]"; - field_val = GenBBAccess() + ".createScalarList(" + + field_val = GenBBAccess() + ".createScalarList(" + field_binded_method + ", this." + namer_.Field(field, "Length") + "())"; field_offset_decl = @@ -1162,7 +1163,7 @@ class TsGenerator : public BaseGenerator { field_type += vectortypename; } field_type += ")[]"; - field_val = GenBBAccess() + ".createScalarList(" + + field_val = GenBBAccess() + ".createScalarList<" + vectortypename + ">(" + field_binded_method + ", this." + namer_.Method(field, "Length") + "())"; @@ -1260,7 +1261,7 @@ class TsGenerator : public BaseGenerator { obj_api_class = "\n"; obj_api_class += "export class "; obj_api_class += GetTypeName(struct_def, /*object_api=*/true); - obj_api_class += " {\n"; + obj_api_class += " implements flatbuffers.IGeneratedObject {\n"; obj_api_class += constructor_func; obj_api_class += pack_func_prototype + pack_func_offset_decl + pack_func_create_call + "\n}"; @@ -1298,12 +1299,16 @@ class TsGenerator : public BaseGenerator { } const std::string object_name = GetTypeName(struct_def); + const std::string object_api_name = GetTypeName(struct_def, true); // Emit constructor GenDocComment(struct_def.doc_comment, code_ptr); code += "export class "; code += object_name; - code += " {\n"; + if (parser.opts.generate_object_based_api) + code += " implements flatbuffers.IUnpackableObject<" + object_api_name + "> {\n"; + else + code += " {\n"; code += " bb: flatbuffers.ByteBuffer|null = null;\n"; code += " bb_pos = 0;\n"; diff --git a/tests/ts/my-game/example/ability.ts b/tests/ts/my-game/example/ability.ts index 36b0eb8105d..b0bea8fe847 100644 --- a/tests/ts/my-game/example/ability.ts +++ b/tests/ts/my-game/example/ability.ts @@ -4,7 +4,7 @@ import * as flatbuffers from 'flatbuffers'; -export class Ability { +export class Ability implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Ability { @@ -61,7 +61,7 @@ unpackTo(_o: AbilityT): void { } } -export class AbilityT { +export class AbilityT implements flatbuffers.IGeneratedObject { constructor( public id: number = 0, public distance: number = 0 diff --git a/tests/ts/my-game/example/monster.js b/tests/ts/my-game/example/monster.js index e4ef970ab68..397d0d9b981 100644 --- a/tests/ts/my-game/example/monster.js +++ b/tests/ts/my-game/example/monster.js @@ -889,19 +889,19 @@ export class Monster { } unpack() { return new MonsterT((this.pos() !== null ? this.pos().unpack() : null), this.mana(), this.hp(), this.name(), this.bb.createScalarList(this.inventory.bind(this), this.inventoryLength()), this.color(), this.testType(), (() => { - let temp = unionToAny(this.testType(), this.test.bind(this)); + const temp = unionToAny(this.testType(), this.test.bind(this)); if (temp === null) { return null; } return temp.unpack(); })(), this.bb.createObjList(this.test4.bind(this), this.test4Length()), this.bb.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()), this.bb.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()), (this.enemy() !== null ? this.enemy().unpack() : null), this.bb.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()), (this.testempty() !== null ? this.testempty().unpack() : null), this.testbool(), this.testhashs32Fnv1(), this.testhashu32Fnv1(), this.testhashs64Fnv1(), this.testhashu64Fnv1(), this.testhashs32Fnv1a(), this.testhashu32Fnv1a(), this.testhashs64Fnv1a(), this.testhashu64Fnv1a(), this.bb.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()), this.testf(), this.testf2(), this.testf3(), this.bb.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()), this.bb.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()), this.bb.createScalarList(this.flex.bind(this), this.flexLength()), this.bb.createObjList(this.test5.bind(this), this.test5Length()), this.bb.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()), this.bb.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()), (this.parentNamespaceTest() !== null ? this.parentNamespaceTest().unpack() : null), this.bb.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()), this.singleWeakReference(), this.bb.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()), this.bb.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()), this.coOwningReference(), this.bb.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()), this.nonOwningReference(), this.bb.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()), this.anyUniqueType(), (() => { - let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this)); + const temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this)); if (temp === null) { return null; } return temp.unpack(); })(), this.anyAmbiguousType(), (() => { - let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this)); + const temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this)); if (temp === null) { return null; } @@ -917,7 +917,7 @@ export class Monster { _o.color = this.color(); _o.testType = this.testType(); _o.test = (() => { - let temp = unionToAny(this.testType(), this.test.bind(this)); + const temp = unionToAny(this.testType(), this.test.bind(this)); if (temp === null) { return null; } @@ -959,7 +959,7 @@ export class Monster { _o.vectorOfNonOwningReferences = this.bb.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()); _o.anyUniqueType = this.anyUniqueType(); _o.anyUnique = (() => { - let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this)); + const temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this)); if (temp === null) { return null; } @@ -967,7 +967,7 @@ export class Monster { })(); _o.anyAmbiguousType = this.anyAmbiguousType(); _o.anyAmbiguous = (() => { - let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this)); + const temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this)); if (temp === null) { return null; } diff --git a/tests/ts/my-game/example/monster.ts b/tests/ts/my-game/example/monster.ts index 63e5768e585..4e84c62f8d8 100644 --- a/tests/ts/my-game/example/monster.ts +++ b/tests/ts/my-game/example/monster.ts @@ -20,7 +20,7 @@ import { InParentNamespace, InParentNamespaceT } from '../../my-game/in-parent-n /** * an example documentation comment: "monster object" */ -export class Monster { +export class Monster implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Monster { @@ -1153,19 +1153,19 @@ unpack(): MonsterT { this.mana(), this.hp(), this.name(), - this.bb!.createScalarList(this.inventory.bind(this), this.inventoryLength()), + this.bb!.createScalarList(this.inventory.bind(this), this.inventoryLength()), this.color(), this.testType(), (() => { - let temp = unionToAny(this.testType(), this.test.bind(this)); + const temp = unionToAny(this.testType(), this.test.bind(this)); if(temp === null) { return null; } return temp.unpack() })(), - this.bb!.createObjList(this.test4.bind(this), this.test4Length()), - this.bb!.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()), - this.bb!.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()), + this.bb!.createObjList(this.test4.bind(this), this.test4Length()), + this.bb!.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()), + this.bb!.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()), (this.enemy() !== null ? this.enemy()!.unpack() : null), - this.bb!.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()), + this.bb!.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()), (this.testempty() !== null ? this.testempty()!.unpack() : null), this.testbool(), this.testhashs32Fnv1(), @@ -1176,41 +1176,41 @@ unpack(): MonsterT { this.testhashu32Fnv1a(), this.testhashs64Fnv1a(), this.testhashu64Fnv1a(), - this.bb!.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()), + this.bb!.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()), this.testf(), this.testf2(), this.testf3(), - this.bb!.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()), - this.bb!.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()), - this.bb!.createScalarList(this.flex.bind(this), this.flexLength()), - this.bb!.createObjList(this.test5.bind(this), this.test5Length()), - this.bb!.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()), - this.bb!.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()), + this.bb!.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()), + this.bb!.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()), + this.bb!.createScalarList(this.flex.bind(this), this.flexLength()), + this.bb!.createObjList(this.test5.bind(this), this.test5Length()), + this.bb!.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()), + this.bb!.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()), (this.parentNamespaceTest() !== null ? this.parentNamespaceTest()!.unpack() : null), - this.bb!.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()), + this.bb!.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()), this.singleWeakReference(), - this.bb!.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()), - this.bb!.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()), + this.bb!.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()), + this.bb!.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()), this.coOwningReference(), - this.bb!.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()), + this.bb!.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()), this.nonOwningReference(), - this.bb!.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()), + this.bb!.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()), this.anyUniqueType(), (() => { - let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this)); + const temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this)); if(temp === null) { return null; } return temp.unpack() })(), this.anyAmbiguousType(), (() => { - let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this)); + const temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this)); if(temp === null) { return null; } return temp.unpack() })(), - this.bb!.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()), + this.bb!.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()), this.signedEnum(), - this.bb!.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()), - this.bb!.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()), + this.bb!.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()), + this.bb!.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()), (this.nativeInline() !== null ? this.nativeInline()!.unpack() : null), this.longEnumNonEnumDefault(), this.longEnumNormalDefault() @@ -1223,19 +1223,19 @@ unpackTo(_o: MonsterT): void { _o.mana = this.mana(); _o.hp = this.hp(); _o.name = this.name(); - _o.inventory = this.bb!.createScalarList(this.inventory.bind(this), this.inventoryLength()); + _o.inventory = this.bb!.createScalarList(this.inventory.bind(this), this.inventoryLength()); _o.color = this.color(); _o.testType = this.testType(); _o.test = (() => { - let temp = unionToAny(this.testType(), this.test.bind(this)); + const temp = unionToAny(this.testType(), this.test.bind(this)); if(temp === null) { return null; } return temp.unpack() })(); - _o.test4 = this.bb!.createObjList(this.test4.bind(this), this.test4Length()); - _o.testarrayofstring = this.bb!.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()); - _o.testarrayoftables = this.bb!.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()); + _o.test4 = this.bb!.createObjList(this.test4.bind(this), this.test4Length()); + _o.testarrayofstring = this.bb!.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()); + _o.testarrayoftables = this.bb!.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()); _o.enemy = (this.enemy() !== null ? this.enemy()!.unpack() : null); - _o.testnestedflatbuffer = this.bb!.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()); + _o.testnestedflatbuffer = this.bb!.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()); _o.testempty = (this.testempty() !== null ? this.testempty()!.unpack() : null); _o.testbool = this.testbool(); _o.testhashs32Fnv1 = this.testhashs32Fnv1(); @@ -1246,48 +1246,48 @@ unpackTo(_o: MonsterT): void { _o.testhashu32Fnv1a = this.testhashu32Fnv1a(); _o.testhashs64Fnv1a = this.testhashs64Fnv1a(); _o.testhashu64Fnv1a = this.testhashu64Fnv1a(); - _o.testarrayofbools = this.bb!.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()); + _o.testarrayofbools = this.bb!.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()); _o.testf = this.testf(); _o.testf2 = this.testf2(); _o.testf3 = this.testf3(); - _o.testarrayofstring2 = this.bb!.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()); - _o.testarrayofsortedstruct = this.bb!.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()); - _o.flex = this.bb!.createScalarList(this.flex.bind(this), this.flexLength()); - _o.test5 = this.bb!.createObjList(this.test5.bind(this), this.test5Length()); - _o.vectorOfLongs = this.bb!.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()); - _o.vectorOfDoubles = this.bb!.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()); + _o.testarrayofstring2 = this.bb!.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()); + _o.testarrayofsortedstruct = this.bb!.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()); + _o.flex = this.bb!.createScalarList(this.flex.bind(this), this.flexLength()); + _o.test5 = this.bb!.createObjList(this.test5.bind(this), this.test5Length()); + _o.vectorOfLongs = this.bb!.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()); + _o.vectorOfDoubles = this.bb!.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()); _o.parentNamespaceTest = (this.parentNamespaceTest() !== null ? this.parentNamespaceTest()!.unpack() : null); - _o.vectorOfReferrables = this.bb!.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()); + _o.vectorOfReferrables = this.bb!.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()); _o.singleWeakReference = this.singleWeakReference(); - _o.vectorOfWeakReferences = this.bb!.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()); - _o.vectorOfStrongReferrables = this.bb!.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()); + _o.vectorOfWeakReferences = this.bb!.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()); + _o.vectorOfStrongReferrables = this.bb!.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()); _o.coOwningReference = this.coOwningReference(); - _o.vectorOfCoOwningReferences = this.bb!.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()); + _o.vectorOfCoOwningReferences = this.bb!.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()); _o.nonOwningReference = this.nonOwningReference(); - _o.vectorOfNonOwningReferences = this.bb!.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()); + _o.vectorOfNonOwningReferences = this.bb!.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()); _o.anyUniqueType = this.anyUniqueType(); _o.anyUnique = (() => { - let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this)); + const temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this)); if(temp === null) { return null; } return temp.unpack() })(); _o.anyAmbiguousType = this.anyAmbiguousType(); _o.anyAmbiguous = (() => { - let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this)); + const temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this)); if(temp === null) { return null; } return temp.unpack() })(); - _o.vectorOfEnums = this.bb!.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()); + _o.vectorOfEnums = this.bb!.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()); _o.signedEnum = this.signedEnum(); - _o.testrequirednestedflatbuffer = this.bb!.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()); - _o.scalarKeySortedTables = this.bb!.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()); + _o.testrequirednestedflatbuffer = this.bb!.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()); + _o.scalarKeySortedTables = this.bb!.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()); _o.nativeInline = (this.nativeInline() !== null ? this.nativeInline()!.unpack() : null); _o.longEnumNonEnumDefault = this.longEnumNonEnumDefault(); _o.longEnumNormalDefault = this.longEnumNormalDefault(); } } -export class MonsterT { +export class MonsterT implements flatbuffers.IGeneratedObject { constructor( public pos: Vec3T|null = null, public mana: number = 150, diff --git a/tests/ts/my-game/example/referrable.ts b/tests/ts/my-game/example/referrable.ts index ec02980037f..52603629aa9 100644 --- a/tests/ts/my-game/example/referrable.ts +++ b/tests/ts/my-game/example/referrable.ts @@ -4,7 +4,7 @@ import * as flatbuffers from 'flatbuffers'; -export class Referrable { +export class Referrable implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Referrable { @@ -81,7 +81,7 @@ unpackTo(_o: ReferrableT): void { } } -export class ReferrableT { +export class ReferrableT implements flatbuffers.IGeneratedObject { constructor( public id: bigint = BigInt('0') ){} diff --git a/tests/ts/my-game/example/stat.ts b/tests/ts/my-game/example/stat.ts index e45259950aa..c1597b2a912 100644 --- a/tests/ts/my-game/example/stat.ts +++ b/tests/ts/my-game/example/stat.ts @@ -4,7 +4,7 @@ import * as flatbuffers from 'flatbuffers'; -export class Stat { +export class Stat implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Stat { @@ -118,7 +118,7 @@ unpackTo(_o: StatT): void { } } -export class StatT { +export class StatT implements flatbuffers.IGeneratedObject { constructor( public id: string|Uint8Array|null = null, public val: bigint = BigInt('0'), diff --git a/tests/ts/my-game/example/struct-of-structs-of-structs.ts b/tests/ts/my-game/example/struct-of-structs-of-structs.ts index 52efc120540..fa17939b875 100644 --- a/tests/ts/my-game/example/struct-of-structs-of-structs.ts +++ b/tests/ts/my-game/example/struct-of-structs-of-structs.ts @@ -5,7 +5,7 @@ import * as flatbuffers from 'flatbuffers'; import { StructOfStructs, StructOfStructsT } from '../../my-game/example/struct-of-structs.js'; -export class StructOfStructsOfStructs { +export class StructOfStructsOfStructs implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructsOfStructs { @@ -55,7 +55,7 @@ unpackTo(_o: StructOfStructsOfStructsT): void { } } -export class StructOfStructsOfStructsT { +export class StructOfStructsOfStructsT implements flatbuffers.IGeneratedObject { constructor( public a: StructOfStructsT|null = null ){} diff --git a/tests/ts/my-game/example/struct-of-structs.ts b/tests/ts/my-game/example/struct-of-structs.ts index 749a73cb1d9..10d3607f157 100644 --- a/tests/ts/my-game/example/struct-of-structs.ts +++ b/tests/ts/my-game/example/struct-of-structs.ts @@ -6,7 +6,7 @@ import { Ability, AbilityT } from '../../my-game/example/ability.js'; import { Test, TestT } from '../../my-game/example/test.js'; -export class StructOfStructs { +export class StructOfStructs implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructs { @@ -67,7 +67,7 @@ unpackTo(_o: StructOfStructsT): void { } } -export class StructOfStructsT { +export class StructOfStructsT implements flatbuffers.IGeneratedObject { constructor( public a: AbilityT|null = null, public b: TestT|null = null, diff --git a/tests/ts/my-game/example/test-simple-table-with-enum.ts b/tests/ts/my-game/example/test-simple-table-with-enum.ts index cfca00b4a13..903ab99cbfa 100644 --- a/tests/ts/my-game/example/test-simple-table-with-enum.ts +++ b/tests/ts/my-game/example/test-simple-table-with-enum.ts @@ -5,7 +5,7 @@ import * as flatbuffers from 'flatbuffers'; import { Color } from '../../my-game/example/color.js'; -export class TestSimpleTableWithEnum { +export class TestSimpleTableWithEnum implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):TestSimpleTableWithEnum { @@ -82,7 +82,7 @@ unpackTo(_o: TestSimpleTableWithEnumT): void { } } -export class TestSimpleTableWithEnumT { +export class TestSimpleTableWithEnumT implements flatbuffers.IGeneratedObject { constructor( public color: Color = Color.Green ){} diff --git a/tests/ts/my-game/example/test.ts b/tests/ts/my-game/example/test.ts index b3d84eece95..7484f2c1589 100644 --- a/tests/ts/my-game/example/test.ts +++ b/tests/ts/my-game/example/test.ts @@ -4,7 +4,7 @@ import * as flatbuffers from 'flatbuffers'; -export class Test { +export class Test implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Test { @@ -62,7 +62,7 @@ unpackTo(_o: TestT): void { } } -export class TestT { +export class TestT implements flatbuffers.IGeneratedObject { constructor( public a: number = 0, public b: number = 0 diff --git a/tests/ts/my-game/example/type-aliases.ts b/tests/ts/my-game/example/type-aliases.ts index 805c8cf3fcc..93262d702f3 100644 --- a/tests/ts/my-game/example/type-aliases.ts +++ b/tests/ts/my-game/example/type-aliases.ts @@ -4,7 +4,7 @@ import * as flatbuffers from 'flatbuffers'; -export class TypeAliases { +export class TypeAliases implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):TypeAliases { @@ -344,8 +344,8 @@ unpack(): TypeAliasesT { this.u64(), this.f32(), this.f64(), - this.bb!.createScalarList(this.v8.bind(this), this.v8Length()), - this.bb!.createScalarList(this.vf64.bind(this), this.vf64Length()) + this.bb!.createScalarList(this.v8.bind(this), this.v8Length()), + this.bb!.createScalarList(this.vf64.bind(this), this.vf64Length()) ); } @@ -361,12 +361,12 @@ unpackTo(_o: TypeAliasesT): void { _o.u64 = this.u64(); _o.f32 = this.f32(); _o.f64 = this.f64(); - _o.v8 = this.bb!.createScalarList(this.v8.bind(this), this.v8Length()); - _o.vf64 = this.bb!.createScalarList(this.vf64.bind(this), this.vf64Length()); + _o.v8 = this.bb!.createScalarList(this.v8.bind(this), this.v8Length()); + _o.vf64 = this.bb!.createScalarList(this.vf64.bind(this), this.vf64Length()); } } -export class TypeAliasesT { +export class TypeAliasesT implements flatbuffers.IGeneratedObject { constructor( public i8: number = 0, public u8: number = 0, diff --git a/tests/ts/my-game/example/vec3.ts b/tests/ts/my-game/example/vec3.ts index bc4c473320a..84516e09ccd 100644 --- a/tests/ts/my-game/example/vec3.ts +++ b/tests/ts/my-game/example/vec3.ts @@ -6,7 +6,7 @@ import { Color } from '../../my-game/example/color.js'; import { Test, TestT } from '../../my-game/example/test.js'; -export class Vec3 { +export class Vec3 implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Vec3 { @@ -112,7 +112,7 @@ unpackTo(_o: Vec3T): void { } } -export class Vec3T { +export class Vec3T implements flatbuffers.IGeneratedObject { constructor( public x: number = 0.0, public y: number = 0.0, diff --git a/tests/ts/my-game/example2/monster.ts b/tests/ts/my-game/example2/monster.ts index 7240476bef6..071448699b5 100644 --- a/tests/ts/my-game/example2/monster.ts +++ b/tests/ts/my-game/example2/monster.ts @@ -4,7 +4,7 @@ import * as flatbuffers from 'flatbuffers'; -export class Monster { +export class Monster implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Monster { @@ -56,7 +56,7 @@ unpack(): MonsterT { unpackTo(_o: MonsterT): void {} } -export class MonsterT { +export class MonsterT implements flatbuffers.IGeneratedObject { constructor(){} diff --git a/tests/ts/my-game/in-parent-namespace.ts b/tests/ts/my-game/in-parent-namespace.ts index 0de94df5e6c..0e2f4128760 100644 --- a/tests/ts/my-game/in-parent-namespace.ts +++ b/tests/ts/my-game/in-parent-namespace.ts @@ -4,7 +4,7 @@ import * as flatbuffers from 'flatbuffers'; -export class InParentNamespace { +export class InParentNamespace implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):InParentNamespace { @@ -56,7 +56,7 @@ unpack(): InParentNamespaceT { unpackTo(_o: InParentNamespaceT): void {} } -export class InParentNamespaceT { +export class InParentNamespaceT implements flatbuffers.IGeneratedObject { constructor(){} diff --git a/tests/ts/reflection/enum-val.ts b/tests/ts/reflection/enum-val.ts index 85278327b86..2364dab2fa8 100644 --- a/tests/ts/reflection/enum-val.ts +++ b/tests/ts/reflection/enum-val.ts @@ -5,7 +5,7 @@ import * as flatbuffers from 'flatbuffers'; import { Type, TypeT } from '../reflection/type.js'; -export class EnumVal { +export class EnumVal implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):EnumVal { @@ -111,7 +111,7 @@ unpack(): EnumValT { this.name(), this.value(), (this.unionType() !== null ? this.unionType()!.unpack() : null), - this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()) + this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()) ); } @@ -120,11 +120,11 @@ unpackTo(_o: EnumValT): void { _o.name = this.name(); _o.value = this.value(); _o.unionType = (this.unionType() !== null ? this.unionType()!.unpack() : null); - _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); + _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); } } -export class EnumValT { +export class EnumValT implements flatbuffers.IGeneratedObject { constructor( public name: string|Uint8Array|null = null, public value: bigint = BigInt('0'), diff --git a/tests/ts/reflection/enum.ts b/tests/ts/reflection/enum.ts index 7bba354ffaf..34d137757ee 100644 --- a/tests/ts/reflection/enum.ts +++ b/tests/ts/reflection/enum.ts @@ -7,7 +7,7 @@ import { KeyValue, KeyValueT } from '../reflection/key-value.js'; import { Type, TypeT } from '../reflection/type.js'; -export class Enum { +export class Enum implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Enum { @@ -179,11 +179,11 @@ static endEnum(builder:flatbuffers.Builder):flatbuffers.Offset { unpack(): EnumT { return new EnumT( this.name(), - this.bb!.createObjList(this.values.bind(this), this.valuesLength()), + this.bb!.createObjList(this.values.bind(this), this.valuesLength()), this.isUnion(), (this.underlyingType() !== null ? this.underlyingType()!.unpack() : null), - this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), - this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), + this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), + this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile() ); } @@ -191,16 +191,16 @@ unpack(): EnumT { unpackTo(_o: EnumT): void { _o.name = this.name(); - _o.values = this.bb!.createObjList(this.values.bind(this), this.valuesLength()); + _o.values = this.bb!.createObjList(this.values.bind(this), this.valuesLength()); _o.isUnion = this.isUnion(); _o.underlyingType = (this.underlyingType() !== null ? this.underlyingType()!.unpack() : null); - _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); - _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); + _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); + _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); _o.declarationFile = this.declarationFile(); } } -export class EnumT { +export class EnumT implements flatbuffers.IGeneratedObject { constructor( public name: string|Uint8Array|null = null, public values: (EnumValT)[] = [], diff --git a/tests/ts/reflection/field.ts b/tests/ts/reflection/field.ts index 48c1bed16e9..9734fbab5ec 100644 --- a/tests/ts/reflection/field.ts +++ b/tests/ts/reflection/field.ts @@ -6,7 +6,7 @@ import { KeyValue, KeyValueT } from '../reflection/key-value.js'; import { Type, TypeT } from '../reflection/type.js'; -export class Field { +export class Field implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Field { @@ -308,8 +308,8 @@ unpack(): FieldT { this.deprecated(), this.required(), this.key(), - this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), - this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), + this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), + this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), this.optional(), this.padding() ); @@ -326,14 +326,14 @@ unpackTo(_o: FieldT): void { _o.deprecated = this.deprecated(); _o.required = this.required(); _o.key = this.key(); - _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); - _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); + _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); + _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); _o.optional = this.optional(); _o.padding = this.padding(); } } -export class FieldT { +export class FieldT implements flatbuffers.IGeneratedObject { constructor( public name: string|Uint8Array|null = null, public type: TypeT|null = null, diff --git a/tests/ts/reflection/key-value.ts b/tests/ts/reflection/key-value.ts index 736766b972a..93262f42f6b 100644 --- a/tests/ts/reflection/key-value.ts +++ b/tests/ts/reflection/key-value.ts @@ -4,7 +4,7 @@ import * as flatbuffers from 'flatbuffers'; -export class KeyValue { +export class KeyValue implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):KeyValue { @@ -79,7 +79,7 @@ unpackTo(_o: KeyValueT): void { } } -export class KeyValueT { +export class KeyValueT implements flatbuffers.IGeneratedObject { constructor( public key: string|Uint8Array|null = null, public value: string|Uint8Array|null = null diff --git a/tests/ts/reflection/object.ts b/tests/ts/reflection/object.ts index 1e14f039bea..fbe70061580 100644 --- a/tests/ts/reflection/object.ts +++ b/tests/ts/reflection/object.ts @@ -6,7 +6,7 @@ import { Field, FieldT } from '../reflection/field.js'; import { KeyValue, KeyValueT } from '../reflection/key-value.js'; -export class Object_ { +export class Object_ implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Object_ { @@ -220,12 +220,12 @@ static createObject(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, unpack(): Object_T { return new Object_T( this.name(), - this.bb!.createObjList(this.fields.bind(this), this.fieldsLength()), + this.bb!.createObjList(this.fields.bind(this), this.fieldsLength()), this.isStruct(), this.minalign(), this.bytesize(), - this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), - this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), + this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), + this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile() ); } @@ -233,17 +233,17 @@ unpack(): Object_T { unpackTo(_o: Object_T): void { _o.name = this.name(); - _o.fields = this.bb!.createObjList(this.fields.bind(this), this.fieldsLength()); + _o.fields = this.bb!.createObjList(this.fields.bind(this), this.fieldsLength()); _o.isStruct = this.isStruct(); _o.minalign = this.minalign(); _o.bytesize = this.bytesize(); - _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); - _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); + _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); + _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); _o.declarationFile = this.declarationFile(); } } -export class Object_T { +export class Object_T implements flatbuffers.IGeneratedObject { constructor( public name: string|Uint8Array|null = null, public fields: (FieldT)[] = [], diff --git a/tests/ts/reflection/rpccall.ts b/tests/ts/reflection/rpccall.ts index 151d7b1bc81..320de51695c 100644 --- a/tests/ts/reflection/rpccall.ts +++ b/tests/ts/reflection/rpccall.ts @@ -6,7 +6,7 @@ import { KeyValue, KeyValueT } from '../reflection/key-value.js'; import { Object_, Object_T } from '../reflection/object.js'; -export class RPCCall { +export class RPCCall implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):RPCCall { @@ -129,8 +129,8 @@ unpack(): RPCCallT { this.name(), (this.request() !== null ? this.request()!.unpack() : null), (this.response() !== null ? this.response()!.unpack() : null), - this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), - this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()) + this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), + this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()) ); } @@ -139,12 +139,12 @@ unpackTo(_o: RPCCallT): void { _o.name = this.name(); _o.request = (this.request() !== null ? this.request()!.unpack() : null); _o.response = (this.response() !== null ? this.response()!.unpack() : null); - _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); - _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); + _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); + _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); } } -export class RPCCallT { +export class RPCCallT implements flatbuffers.IGeneratedObject { constructor( public name: string|Uint8Array|null = null, public request: Object_T|null = null, diff --git a/tests/ts/reflection/schema-file.ts b/tests/ts/reflection/schema-file.ts index e1f50357ddd..eda23dede0a 100644 --- a/tests/ts/reflection/schema-file.ts +++ b/tests/ts/reflection/schema-file.ts @@ -9,7 +9,7 @@ import * as flatbuffers from 'flatbuffers'; * Symbols declared within a file may be recovered by iterating over all * symbols and examining the `declaration_file` field. */ -export class SchemaFile { +export class SchemaFile implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):SchemaFile { @@ -96,18 +96,18 @@ static createSchemaFile(builder:flatbuffers.Builder, filenameOffset:flatbuffers. unpack(): SchemaFileT { return new SchemaFileT( this.filename(), - this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength()) + this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength()) ); } unpackTo(_o: SchemaFileT): void { _o.filename = this.filename(); - _o.includedFilenames = this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength()); + _o.includedFilenames = this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength()); } } -export class SchemaFileT { +export class SchemaFileT implements flatbuffers.IGeneratedObject { constructor( public filename: string|Uint8Array|null = null, public includedFilenames: (string)[] = [] diff --git a/tests/ts/reflection/schema.ts b/tests/ts/reflection/schema.ts index d1839c7cb14..c99652226d8 100644 --- a/tests/ts/reflection/schema.ts +++ b/tests/ts/reflection/schema.ts @@ -8,7 +8,7 @@ import { SchemaFile, SchemaFileT } from '../reflection/schema-file.js'; import { Service, ServiceT } from '../reflection/service.js'; -export class Schema { +export class Schema implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Schema { @@ -215,31 +215,31 @@ static finishSizePrefixedSchemaBuffer(builder:flatbuffers.Builder, offset:flatbu unpack(): SchemaT { return new SchemaT( - this.bb!.createObjList(this.objects.bind(this), this.objectsLength()), - this.bb!.createObjList(this.enums.bind(this), this.enumsLength()), + this.bb!.createObjList(this.objects.bind(this), this.objectsLength()), + this.bb!.createObjList(this.enums.bind(this), this.enumsLength()), this.fileIdent(), this.fileExt(), (this.rootTable() !== null ? this.rootTable()!.unpack() : null), - this.bb!.createObjList(this.services.bind(this), this.servicesLength()), + this.bb!.createObjList(this.services.bind(this), this.servicesLength()), this.advancedFeatures(), - this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength()) + this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength()) ); } unpackTo(_o: SchemaT): void { - _o.objects = this.bb!.createObjList(this.objects.bind(this), this.objectsLength()); - _o.enums = this.bb!.createObjList(this.enums.bind(this), this.enumsLength()); + _o.objects = this.bb!.createObjList(this.objects.bind(this), this.objectsLength()); + _o.enums = this.bb!.createObjList(this.enums.bind(this), this.enumsLength()); _o.fileIdent = this.fileIdent(); _o.fileExt = this.fileExt(); _o.rootTable = (this.rootTable() !== null ? this.rootTable()!.unpack() : null); - _o.services = this.bb!.createObjList(this.services.bind(this), this.servicesLength()); + _o.services = this.bb!.createObjList(this.services.bind(this), this.servicesLength()); _o.advancedFeatures = this.advancedFeatures(); - _o.fbsFiles = this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength()); + _o.fbsFiles = this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength()); } } -export class SchemaT { +export class SchemaT implements flatbuffers.IGeneratedObject { constructor( public objects: (Object_T)[] = [], public enums: (EnumT)[] = [], diff --git a/tests/ts/reflection/service.ts b/tests/ts/reflection/service.ts index c083cae0b49..c0ad8adbe64 100644 --- a/tests/ts/reflection/service.ts +++ b/tests/ts/reflection/service.ts @@ -6,7 +6,7 @@ import { KeyValue, KeyValueT } from '../reflection/key-value.js'; import { RPCCall, RPCCallT } from '../reflection/rpccall.js'; -export class Service { +export class Service implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Service { @@ -156,9 +156,9 @@ static createService(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, unpack(): ServiceT { return new ServiceT( this.name(), - this.bb!.createObjList(this.calls.bind(this), this.callsLength()), - this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), - this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), + this.bb!.createObjList(this.calls.bind(this), this.callsLength()), + this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), + this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile() ); } @@ -166,14 +166,14 @@ unpack(): ServiceT { unpackTo(_o: ServiceT): void { _o.name = this.name(); - _o.calls = this.bb!.createObjList(this.calls.bind(this), this.callsLength()); - _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); - _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); + _o.calls = this.bb!.createObjList(this.calls.bind(this), this.callsLength()); + _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); + _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); _o.declarationFile = this.declarationFile(); } } -export class ServiceT { +export class ServiceT implements flatbuffers.IGeneratedObject { constructor( public name: string|Uint8Array|null = null, public calls: (RPCCallT)[] = [], diff --git a/tests/ts/reflection/type.ts b/tests/ts/reflection/type.ts index e831e21dd41..37316959d5c 100644 --- a/tests/ts/reflection/type.ts +++ b/tests/ts/reflection/type.ts @@ -5,7 +5,7 @@ import * as flatbuffers from 'flatbuffers'; import { BaseType } from '../reflection/base-type.js'; -export class Type { +export class Type implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Type { @@ -195,7 +195,7 @@ unpackTo(_o: TypeT): void { } } -export class TypeT { +export class TypeT implements flatbuffers.IGeneratedObject { constructor( public baseType: BaseType = BaseType.None, public element: BaseType = BaseType.None, diff --git a/tests/ts/reflection_generated.ts b/tests/ts/reflection_generated.ts index 4bb12220841..ec17d64b016 100644 --- a/tests/ts/reflection_generated.ts +++ b/tests/ts/reflection_generated.ts @@ -35,7 +35,7 @@ export enum AdvancedFeatures { DefaultVectorsAndStrings = '8' } -export class Type { +export class Type implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Type { @@ -225,7 +225,7 @@ unpackTo(_o: TypeT): void { } } -export class TypeT { +export class TypeT implements flatbuffers.IGeneratedObject { constructor( public baseType: BaseType = BaseType.None, public element: BaseType = BaseType.None, @@ -248,7 +248,7 @@ pack(builder:flatbuffers.Builder): flatbuffers.Offset { } } -export class KeyValue { +export class KeyValue implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):KeyValue { @@ -323,7 +323,7 @@ unpackTo(_o: KeyValueT): void { } } -export class KeyValueT { +export class KeyValueT implements flatbuffers.IGeneratedObject { constructor( public key: string|Uint8Array|null = null, public value: string|Uint8Array|null = null @@ -341,7 +341,7 @@ pack(builder:flatbuffers.Builder): flatbuffers.Offset { } } -export class EnumVal { +export class EnumVal implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):EnumVal { @@ -447,7 +447,7 @@ unpack(): EnumValT { this.name(), this.value(), (this.unionType() !== null ? this.unionType()!.unpack() : null), - this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()) + this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()) ); } @@ -456,11 +456,11 @@ unpackTo(_o: EnumValT): void { _o.name = this.name(); _o.value = this.value(); _o.unionType = (this.unionType() !== null ? this.unionType()!.unpack() : null); - _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); + _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); } } -export class EnumValT { +export class EnumValT implements flatbuffers.IGeneratedObject { constructor( public name: string|Uint8Array|null = null, public value: bigint = BigInt('0'), @@ -484,7 +484,7 @@ pack(builder:flatbuffers.Builder): flatbuffers.Offset { } } -export class Enum { +export class Enum implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Enum { @@ -656,11 +656,11 @@ static endEnum(builder:flatbuffers.Builder):flatbuffers.Offset { unpack(): EnumT { return new EnumT( this.name(), - this.bb!.createObjList(this.values.bind(this), this.valuesLength()), + this.bb!.createObjList(this.values.bind(this), this.valuesLength()), this.isUnion(), (this.underlyingType() !== null ? this.underlyingType()!.unpack() : null), - this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), - this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), + this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), + this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile() ); } @@ -668,16 +668,16 @@ unpack(): EnumT { unpackTo(_o: EnumT): void { _o.name = this.name(); - _o.values = this.bb!.createObjList(this.values.bind(this), this.valuesLength()); + _o.values = this.bb!.createObjList(this.values.bind(this), this.valuesLength()); _o.isUnion = this.isUnion(); _o.underlyingType = (this.underlyingType() !== null ? this.underlyingType()!.unpack() : null); - _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); - _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); + _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); + _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); _o.declarationFile = this.declarationFile(); } } -export class EnumT { +export class EnumT implements flatbuffers.IGeneratedObject { constructor( public name: string|Uint8Array|null = null, public values: (EnumValT)[] = [], @@ -710,7 +710,7 @@ pack(builder:flatbuffers.Builder): flatbuffers.Offset { } } -export class Field { +export class Field implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Field { @@ -1012,8 +1012,8 @@ unpack(): FieldT { this.deprecated(), this.required(), this.key(), - this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), - this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), + this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), + this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), this.optional(), this.padding() ); @@ -1030,14 +1030,14 @@ unpackTo(_o: FieldT): void { _o.deprecated = this.deprecated(); _o.required = this.required(); _o.key = this.key(); - _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); - _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); + _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); + _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); _o.optional = this.optional(); _o.padding = this.padding(); } } -export class FieldT { +export class FieldT implements flatbuffers.IGeneratedObject { constructor( public name: string|Uint8Array|null = null, public type: TypeT|null = null, @@ -1080,7 +1080,7 @@ pack(builder:flatbuffers.Builder): flatbuffers.Offset { } } -export class Object_ { +export class Object_ implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Object_ { @@ -1294,12 +1294,12 @@ static createObject(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, unpack(): Object_T { return new Object_T( this.name(), - this.bb!.createObjList(this.fields.bind(this), this.fieldsLength()), + this.bb!.createObjList(this.fields.bind(this), this.fieldsLength()), this.isStruct(), this.minalign(), this.bytesize(), - this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), - this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), + this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), + this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile() ); } @@ -1307,17 +1307,17 @@ unpack(): Object_T { unpackTo(_o: Object_T): void { _o.name = this.name(); - _o.fields = this.bb!.createObjList(this.fields.bind(this), this.fieldsLength()); + _o.fields = this.bb!.createObjList(this.fields.bind(this), this.fieldsLength()); _o.isStruct = this.isStruct(); _o.minalign = this.minalign(); _o.bytesize = this.bytesize(); - _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); - _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); + _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); + _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); _o.declarationFile = this.declarationFile(); } } -export class Object_T { +export class Object_T implements flatbuffers.IGeneratedObject { constructor( public name: string|Uint8Array|null = null, public fields: (FieldT)[] = [], @@ -1350,7 +1350,7 @@ pack(builder:flatbuffers.Builder): flatbuffers.Offset { } } -export class RPCCall { +export class RPCCall implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):RPCCall { @@ -1473,8 +1473,8 @@ unpack(): RPCCallT { this.name(), (this.request() !== null ? this.request()!.unpack() : null), (this.response() !== null ? this.response()!.unpack() : null), - this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), - this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()) + this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), + this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()) ); } @@ -1483,12 +1483,12 @@ unpackTo(_o: RPCCallT): void { _o.name = this.name(); _o.request = (this.request() !== null ? this.request()!.unpack() : null); _o.response = (this.response() !== null ? this.response()!.unpack() : null); - _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); - _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); + _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); + _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); } } -export class RPCCallT { +export class RPCCallT implements flatbuffers.IGeneratedObject { constructor( public name: string|Uint8Array|null = null, public request: Object_T|null = null, @@ -1516,7 +1516,7 @@ pack(builder:flatbuffers.Builder): flatbuffers.Offset { } } -export class Service { +export class Service implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Service { @@ -1666,9 +1666,9 @@ static createService(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, unpack(): ServiceT { return new ServiceT( this.name(), - this.bb!.createObjList(this.calls.bind(this), this.callsLength()), - this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), - this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), + this.bb!.createObjList(this.calls.bind(this), this.callsLength()), + this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), + this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile() ); } @@ -1676,14 +1676,14 @@ unpack(): ServiceT { unpackTo(_o: ServiceT): void { _o.name = this.name(); - _o.calls = this.bb!.createObjList(this.calls.bind(this), this.callsLength()); - _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); - _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); + _o.calls = this.bb!.createObjList(this.calls.bind(this), this.callsLength()); + _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); + _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); _o.declarationFile = this.declarationFile(); } } -export class ServiceT { +export class ServiceT implements flatbuffers.IGeneratedObject { constructor( public name: string|Uint8Array|null = null, public calls: (RPCCallT)[] = [], @@ -1715,7 +1715,7 @@ pack(builder:flatbuffers.Builder): flatbuffers.Offset { * Symbols declared within a file may be recovered by iterating over all * symbols and examining the `declaration_file` field. */ -export class SchemaFile { +export class SchemaFile implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):SchemaFile { @@ -1802,18 +1802,18 @@ static createSchemaFile(builder:flatbuffers.Builder, filenameOffset:flatbuffers. unpack(): SchemaFileT { return new SchemaFileT( this.filename(), - this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength()) + this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength()) ); } unpackTo(_o: SchemaFileT): void { _o.filename = this.filename(); - _o.includedFilenames = this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength()); + _o.includedFilenames = this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength()); } } -export class SchemaFileT { +export class SchemaFileT implements flatbuffers.IGeneratedObject { constructor( public filename: string|Uint8Array|null = null, public includedFilenames: (string)[] = [] @@ -1831,7 +1831,7 @@ pack(builder:flatbuffers.Builder): flatbuffers.Offset { } } -export class Schema { +export class Schema implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Schema { @@ -2038,31 +2038,31 @@ static finishSizePrefixedSchemaBuffer(builder:flatbuffers.Builder, offset:flatbu unpack(): SchemaT { return new SchemaT( - this.bb!.createObjList(this.objects.bind(this), this.objectsLength()), - this.bb!.createObjList(this.enums.bind(this), this.enumsLength()), + this.bb!.createObjList(this.objects.bind(this), this.objectsLength()), + this.bb!.createObjList(this.enums.bind(this), this.enumsLength()), this.fileIdent(), this.fileExt(), (this.rootTable() !== null ? this.rootTable()!.unpack() : null), - this.bb!.createObjList(this.services.bind(this), this.servicesLength()), + this.bb!.createObjList(this.services.bind(this), this.servicesLength()), this.advancedFeatures(), - this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength()) + this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength()) ); } unpackTo(_o: SchemaT): void { - _o.objects = this.bb!.createObjList(this.objects.bind(this), this.objectsLength()); - _o.enums = this.bb!.createObjList(this.enums.bind(this), this.enumsLength()); + _o.objects = this.bb!.createObjList(this.objects.bind(this), this.objectsLength()); + _o.enums = this.bb!.createObjList(this.enums.bind(this), this.enumsLength()); _o.fileIdent = this.fileIdent(); _o.fileExt = this.fileExt(); _o.rootTable = (this.rootTable() !== null ? this.rootTable()!.unpack() : null); - _o.services = this.bb!.createObjList(this.services.bind(this), this.servicesLength()); + _o.services = this.bb!.createObjList(this.services.bind(this), this.servicesLength()); _o.advancedFeatures = this.advancedFeatures(); - _o.fbsFiles = this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength()); + _o.fbsFiles = this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength()); } } -export class SchemaT { +export class SchemaT implements flatbuffers.IGeneratedObject { constructor( public objects: (Object_T)[] = [], public enums: (EnumT)[] = [], diff --git a/tests/ts/typescript/object.ts b/tests/ts/typescript/object.ts index 041b6609388..5baf6ed3b87 100644 --- a/tests/ts/typescript/object.ts +++ b/tests/ts/typescript/object.ts @@ -8,7 +8,7 @@ import { Schema, SchemaT } from '../reflection/schema.js'; import { class_ } from '../typescript/class.js'; -export class Object_ { +export class Object_ implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Object_ { @@ -193,7 +193,7 @@ unpackTo(_o: Object_T): void { } } -export class Object_T { +export class Object_T implements flatbuffers.IGeneratedObject { constructor( public return_: number = 0, public if_: number = 0, diff --git a/tests/ts/typescript_keywords_generated.ts b/tests/ts/typescript_keywords_generated.ts index 4272425309e..bcc61102dd5 100644 --- a/tests/ts/typescript_keywords_generated.ts +++ b/tests/ts/typescript_keywords_generated.ts @@ -11,7 +11,7 @@ export enum class_ { instanceof_ = 1 } -export class Object_ { +export class Object_ implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Object_ { @@ -196,7 +196,7 @@ unpackTo(_o: Object_T): void { } } -export class Object_T { +export class Object_T implements flatbuffers.IGeneratedObject { constructor( public return_: number = 0, public if_: number = 0, diff --git a/tests/ts/union_vector/attacker.ts b/tests/ts/union_vector/attacker.ts index 6b3fc0fc140..0d3ca4be668 100644 --- a/tests/ts/union_vector/attacker.ts +++ b/tests/ts/union_vector/attacker.ts @@ -4,7 +4,7 @@ import * as flatbuffers from 'flatbuffers'; -export class Attacker { +export class Attacker implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Attacker { @@ -73,7 +73,7 @@ unpackTo(_o: AttackerT): void { } } -export class AttackerT { +export class AttackerT implements flatbuffers.IGeneratedObject { constructor( public swordAttackDamage: number = 0 ){} diff --git a/tests/ts/union_vector/book-reader.ts b/tests/ts/union_vector/book-reader.ts index 7a31278125a..29a9b501764 100644 --- a/tests/ts/union_vector/book-reader.ts +++ b/tests/ts/union_vector/book-reader.ts @@ -4,7 +4,7 @@ import * as flatbuffers from 'flatbuffers'; -export class BookReader { +export class BookReader implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):BookReader { @@ -49,7 +49,7 @@ unpackTo(_o: BookReaderT): void { } } -export class BookReaderT { +export class BookReaderT implements flatbuffers.IGeneratedObject { constructor( public booksRead: number = 0 ){} diff --git a/tests/ts/union_vector/falling-tub.ts b/tests/ts/union_vector/falling-tub.ts index b32f99d0ff4..eeb9f721b49 100644 --- a/tests/ts/union_vector/falling-tub.ts +++ b/tests/ts/union_vector/falling-tub.ts @@ -4,7 +4,7 @@ import * as flatbuffers from 'flatbuffers'; -export class FallingTub { +export class FallingTub implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):FallingTub { @@ -49,7 +49,7 @@ unpackTo(_o: FallingTubT): void { } } -export class FallingTubT { +export class FallingTubT implements flatbuffers.IGeneratedObject { constructor( public weight: number = 0 ){} diff --git a/tests/ts/union_vector/hand-fan.ts b/tests/ts/union_vector/hand-fan.ts index f90b4dd3195..dd687baa3fd 100644 --- a/tests/ts/union_vector/hand-fan.ts +++ b/tests/ts/union_vector/hand-fan.ts @@ -4,7 +4,7 @@ import * as flatbuffers from 'flatbuffers'; -export class HandFan { +export class HandFan implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):HandFan { @@ -73,7 +73,7 @@ unpackTo(_o: HandFanT): void { } } -export class HandFanT { +export class HandFanT implements flatbuffers.IGeneratedObject { constructor( public length: number = 0 ){} diff --git a/tests/ts/union_vector/movie.js b/tests/ts/union_vector/movie.js index 0245a43844f..53374ebd669 100644 --- a/tests/ts/union_vector/movie.js +++ b/tests/ts/union_vector/movie.js @@ -107,7 +107,7 @@ export class Movie { } unpack() { return new MovieT(this.mainCharacterType(), (() => { - let temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this)); + const temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this)); if (temp === null) { return null; } @@ -116,13 +116,13 @@ export class Movie { } return temp.unpack(); })(), this.bb.createScalarList(this.charactersType.bind(this), this.charactersTypeLength()), (() => { - let ret = []; + const ret = []; for (let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) { - let targetEnum = this.charactersType(targetEnumIndex); + const targetEnum = this.charactersType(targetEnumIndex); if (targetEnum === null || Character[targetEnum] === 'NONE') { continue; } - let temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex); + const temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex); if (temp === null) { continue; } @@ -138,7 +138,7 @@ export class Movie { unpackTo(_o) { _o.mainCharacterType = this.mainCharacterType(); _o.mainCharacter = (() => { - let temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this)); + const temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this)); if (temp === null) { return null; } @@ -149,13 +149,13 @@ export class Movie { })(); _o.charactersType = this.bb.createScalarList(this.charactersType.bind(this), this.charactersTypeLength()); _o.characters = (() => { - let ret = []; + const ret = []; for (let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) { - let targetEnum = this.charactersType(targetEnumIndex); + const targetEnum = this.charactersType(targetEnumIndex); if (targetEnum === null || Character[targetEnum] === 'NONE') { continue; } - let temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex); + const temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex); if (temp === null) { continue; } diff --git a/tests/ts/union_vector/movie.ts b/tests/ts/union_vector/movie.ts index 6edeb53cbe4..1f6ca378998 100644 --- a/tests/ts/union_vector/movie.ts +++ b/tests/ts/union_vector/movie.ts @@ -8,7 +8,7 @@ import { Character, unionToCharacter, unionListToCharacter } from './character.j import { Rapunzel, RapunzelT } from './rapunzel.js'; -export class Movie { +export class Movie implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Movie { @@ -139,19 +139,19 @@ unpack(): MovieT { return new MovieT( this.mainCharacterType(), (() => { - let temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this)); + const temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this)); if(temp === null) { return null; } if(typeof temp === 'string') { return temp; } return temp.unpack() })(), - this.bb!.createScalarList(this.charactersType.bind(this), this.charactersTypeLength()), + this.bb!.createScalarList(this.charactersType.bind(this), this.charactersTypeLength()), (() => { - let ret = []; + const ret = []; for(let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) { - let targetEnum = this.charactersType(targetEnumIndex); + const targetEnum = this.charactersType(targetEnumIndex); if(targetEnum === null || Character[targetEnum!] === 'NONE') { continue; } - let temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex); + const temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex); if(temp === null) { continue; } if(typeof temp === 'string') { ret.push(temp); continue; } ret.push(temp.unpack()); @@ -165,19 +165,19 @@ unpack(): MovieT { unpackTo(_o: MovieT): void { _o.mainCharacterType = this.mainCharacterType(); _o.mainCharacter = (() => { - let temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this)); + const temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this)); if(temp === null) { return null; } if(typeof temp === 'string') { return temp; } return temp.unpack() })(); - _o.charactersType = this.bb!.createScalarList(this.charactersType.bind(this), this.charactersTypeLength()); + _o.charactersType = this.bb!.createScalarList(this.charactersType.bind(this), this.charactersTypeLength()); _o.characters = (() => { - let ret = []; + const ret = []; for(let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) { - let targetEnum = this.charactersType(targetEnumIndex); + const targetEnum = this.charactersType(targetEnumIndex); if(targetEnum === null || Character[targetEnum!] === 'NONE') { continue; } - let temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex); + const temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex); if(temp === null) { continue; } if(typeof temp === 'string') { ret.push(temp); continue; } ret.push(temp.unpack()); @@ -187,7 +187,7 @@ unpackTo(_o: MovieT): void { } } -export class MovieT { +export class MovieT implements flatbuffers.IGeneratedObject { constructor( public mainCharacterType: Character = Character.NONE, public mainCharacter: AttackerT|BookReaderT|RapunzelT|string|null = null, diff --git a/tests/ts/union_vector/rapunzel.ts b/tests/ts/union_vector/rapunzel.ts index e1dc63ddf54..20ca4971522 100644 --- a/tests/ts/union_vector/rapunzel.ts +++ b/tests/ts/union_vector/rapunzel.ts @@ -4,7 +4,7 @@ import * as flatbuffers from 'flatbuffers'; -export class Rapunzel { +export class Rapunzel implements flatbuffers.IUnpackableObject { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):Rapunzel { @@ -49,7 +49,7 @@ unpackTo(_o: RapunzelT): void { } } -export class RapunzelT { +export class RapunzelT implements flatbuffers.IGeneratedObject { constructor( public hairLength: number = 0 ){} diff --git a/tests/union_vector/union_vector_generated.h b/tests/union_vector/union_vector_generated.h index 1e3f116e70a..6b811c876bb 100644 --- a/tests/union_vector/union_vector_generated.h +++ b/tests/union_vector/union_vector_generated.h @@ -356,6 +356,9 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Rapunzel FLATBUFFERS_FINAL_CLASS { static const flatbuffers::TypeTable *MiniReflectTypeTable() { return RapunzelTypeTable(); } + static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { + return "Rapunzel"; + } Rapunzel() : hair_length_(0) { } @@ -389,6 +392,9 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) BookReader FLATBUFFERS_FINAL_CLASS { static const flatbuffers::TypeTable *MiniReflectTypeTable() { return BookReaderTypeTable(); } + static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { + return "BookReader"; + } BookReader() : books_read_(0) { } @@ -422,6 +428,9 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) FallingTub FLATBUFFERS_FINAL_CLASS { static const flatbuffers::TypeTable *MiniReflectTypeTable() { return FallingTubTypeTable(); } + static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { + return "FallingTub"; + } FallingTub() : weight_(0) { } @@ -449,6 +458,9 @@ inline bool operator!=(const FallingTub &lhs, const FallingTub &rhs) { struct AttackerT : public flatbuffers::NativeTable { typedef Attacker TableType; + static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { + return "AttackerT"; + } int32_t sword_attack_damage = 0; }; @@ -458,6 +470,9 @@ struct Attacker FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { static const flatbuffers::TypeTable *MiniReflectTypeTable() { return AttackerTypeTable(); } + static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { + return "Attacker"; + } enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_SWORD_ATTACK_DAMAGE = 4 }; @@ -507,6 +522,9 @@ flatbuffers::Offset CreateAttacker(flatbuffers::FlatBufferBuilder &_fb struct HandFanT : public flatbuffers::NativeTable { typedef HandFan TableType; + static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { + return "HandFanT"; + } int32_t length = 0; }; @@ -516,6 +534,9 @@ struct HandFan FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { static const flatbuffers::TypeTable *MiniReflectTypeTable() { return HandFanTypeTable(); } + static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { + return "HandFan"; + } enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_LENGTH = 4 }; @@ -565,6 +586,9 @@ flatbuffers::Offset CreateHandFan(flatbuffers::FlatBufferBuilder &_fbb, struct MovieT : public flatbuffers::NativeTable { typedef Movie TableType; + static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { + return "MovieT"; + } CharacterUnion main_character{}; std::vector characters{}; }; @@ -575,6 +599,9 @@ struct Movie FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { static const flatbuffers::TypeTable *MiniReflectTypeTable() { return MovieTypeTable(); } + static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { + return "Movie"; + } enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_MAIN_CHARACTER_TYPE = 4, VT_MAIN_CHARACTER = 6, diff --git a/ts/builder.ts b/ts/builder.ts index 85f57262757..f1a2b419a4e 100644 --- a/ts/builder.ts +++ b/ts/builder.ts @@ -549,7 +549,7 @@ export class Builder { * * @returns offset of obj */ - createObjectOffset(obj: string | any): Offset { + createObjectOffset(obj: string | IGeneratedObject | null): Offset { if(obj === null) { return 0 } @@ -566,7 +566,7 @@ export class Builder { * * @returns list of offsets of each non null object */ - createObjectOffsetList(list: string[] | any[]): Offset[] { + createObjectOffsetList(list: (string | IGeneratedObject)[]): Offset[] { const ret: number[] = []; for(let i = 0; i < list.length; ++i) { @@ -583,7 +583,7 @@ export class Builder { return ret; } - createStructOffsetList(list: string[] | any[], startFunc: (builder: Builder, length: number) => void): Offset { + createStructOffsetList(list: (string | IGeneratedObject)[], startFunc: (builder: Builder, length: number) => void): Offset { startFunc(this, list.length); this.createObjectOffsetList(list.slice().reverse()); return this.endVector(); diff --git a/ts/byte-buffer.ts b/ts/byte-buffer.ts index 09c55ad7442..90a1a4dfa7f 100644 --- a/ts/byte-buffer.ts +++ b/ts/byte-buffer.ts @@ -1,6 +1,6 @@ import { FILE_IDENTIFIER_LENGTH, SIZEOF_INT } from "./constants.js"; import { int32, isLittleEndian, float32, float64 } from "./utils.js"; -import { Offset, Table, IGeneratedObject } from "./types.js"; +import { Offset, Table, IGeneratedObject, IUnpackableObject } from "./types.js"; import { Encoding } from "./encoding.js"; export class ByteBuffer { @@ -257,33 +257,31 @@ export class ByteBuffer { /** * A helper function for generating list for obj api */ - createScalarList(listAccessor: (i: number) => unknown, listLength: number): any[] { - const ret: any[] = []; + createScalarList(listAccessor: (i: number) => T | null, listLength: number): T[] { + const ret: T[] = []; for(let i = 0; i < listLength; ++i) { - if(listAccessor(i) !== null) { - ret.push(listAccessor(i)); + const val = listAccessor(i); + if(val !== null) { + ret.push(val); } } - return ret; } - + /** * A helper function for generating list for obj api * @param listAccessor function that accepts an index and return data at that index * @param listLength listLength * @param res result list */ - createObjList(listAccessor: (i: number) => unknown, listLength: number): any[] { - const ret: any[] = []; + createObjList, T2 extends IGeneratedObject>(listAccessor: (i: number) => T1 | null, listLength: number): T2[] { + const ret: T2[] = []; for(let i = 0; i < listLength; ++i) { const val = listAccessor(i); if(val !== null) { - ret.push((val as IGeneratedObject).unpack()); + ret.push(val.unpack()); } } - return ret; } - } diff --git a/ts/flatbuffers.ts b/ts/flatbuffers.ts new file mode 100644 index 00000000000..7c0010bf063 --- /dev/null +++ b/ts/flatbuffers.ts @@ -0,0 +1 @@ +export * as flatbuffers from './index.js' \ No newline at end of file diff --git a/ts/index.ts b/ts/index.ts index 19f44e6f304..a6085124513 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -3,7 +3,7 @@ export { SIZEOF_INT } from './constants.js' export { FILE_IDENTIFIER_LENGTH } from './constants.js' export { SIZE_PREFIX_LENGTH } from './constants.js' -export { Table, Offset } from './types.js' +export { Table, Offset, IGeneratedObject, IUnpackableObject } from './types.js' export { int32, float32, float64, isLittleEndian } from './utils.js' diff --git a/ts/types.ts b/ts/types.ts index 31fefc10141..851486c2100 100644 --- a/ts/types.ts +++ b/ts/types.ts @@ -10,5 +10,8 @@ export type Table = { export interface IGeneratedObject { pack(builder:Builder): Offset - unpack(): IGeneratedObject +} + +export interface IUnpackableObject { + unpack(): T } \ No newline at end of file From a1ffb0b0cf00243201f7d10d6bfa4d534bfe7206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Harrtell?= Date: Sun, 25 Sep 2022 21:24:33 +0200 Subject: [PATCH 2/3] clang-format --- src/idl_gen_ts.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/idl_gen_ts.cpp b/src/idl_gen_ts.cpp index 1e557074fc2..44e8cb6cbf0 100644 --- a/src/idl_gen_ts.cpp +++ b/src/idl_gen_ts.cpp @@ -759,10 +759,10 @@ class TsGenerator : public BaseGenerator { import.object_name = object_name; import.bare_file_path = bare_file_path; import.rel_file_path = rel_file_path; - import.import_statement = - "import { " + symbols_expression + " } from '" + rel_file_path + ".js';"; - import.export_statement = - "export { " + symbols_expression + " } from '." + bare_file_path + ".js';"; + import.import_statement = "import { " + symbols_expression + " } from '" + + rel_file_path + ".js';"; + import.export_statement = "export { " + symbols_expression + " } from '." + + bare_file_path + ".js';"; import.dependency = &dependency; import.dependent = &dependent; @@ -1102,12 +1102,13 @@ class TsGenerator : public BaseGenerator { switch (vectortype.base_type) { case BASE_TYPE_STRUCT: { const auto &sd = *field.value.type.struct_def; - const auto field_type_name = GetTypeName(sd, /*object_api=*/true); + const auto field_type_name = + GetTypeName(sd, /*object_api=*/true); field_type += field_type_name; field_type += ")[]"; - field_val = GenBBAccess() + ".createObjList<" + vectortypename + ", " + - field_type_name + ">(" + + field_val = GenBBAccess() + ".createObjList<" + vectortypename + + ", " + field_type_name + ">(" + field_binded_method + ", this." + namer_.Method(field, "Length") + "())"; @@ -1163,9 +1164,9 @@ class TsGenerator : public BaseGenerator { field_type += vectortypename; } field_type += ")[]"; - field_val = GenBBAccess() + ".createScalarList<" + vectortypename + ">(" + - field_binded_method + ", this." + - namer_.Method(field, "Length") + "())"; + field_val = GenBBAccess() + ".createScalarList<" + + vectortypename + ">(" + field_binded_method + + ", this." + namer_.Method(field, "Length") + "())"; field_offset_decl = AddImport(imports, struct_def, struct_def).name + "." + @@ -1306,7 +1307,8 @@ class TsGenerator : public BaseGenerator { code += "export class "; code += object_name; if (parser.opts.generate_object_based_api) - code += " implements flatbuffers.IUnpackableObject<" + object_api_name + "> {\n"; + code += " implements flatbuffers.IUnpackableObject<" + object_api_name + + "> {\n"; else code += " {\n"; code += " bb: flatbuffers.ByteBuffer|null = null;\n"; From 03d0e9a5c65965dbd9c5d8cbab8bfce7ffffcbbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Harrtell?= Date: Sun, 25 Sep 2022 21:36:49 +0200 Subject: [PATCH 3/3] Code gen harmonize --- tests/ts/TypeScriptTest.py | 9 ++++--- tests/union_vector/union_vector_generated.h | 27 --------------------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/tests/ts/TypeScriptTest.py b/tests/ts/TypeScriptTest.py index c95ed722619..0b42bc638d5 100755 --- a/tests/ts/TypeScriptTest.py +++ b/tests/ts/TypeScriptTest.py @@ -61,7 +61,7 @@ def flatc(options, schema, prefix=None, include=None, data=None, cwd=tests_path) print("Invoking flatc...") flatc( - options=["--ts", "--gen-name-strings", "--gen-mutable", "--gen-object-api"], + options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api"], schema="../monster_test.fbs", include="../include_test", ) @@ -74,18 +74,18 @@ def flatc(options, schema, prefix=None, include=None, data=None, cwd=tests_path) ) flatc( - options=["--ts", "--gen-name-strings", "--gen-mutable", "--gen-object-api"], + options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api"], schema="../union_vector/union_vector.fbs", prefix="union_vector", ) flatc( - options=["--ts", "--gen-name-strings"], + options=["--ts", "--reflect-names", "--gen-name-strings"], schema="../optional_scalars.fbs", ) flatc( - options=["--ts", "--gen-name-strings", "--gen-mutable", "--gen-object-api"], + options=["--ts", "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api"], schema=[ "typescript_keywords.fbs", "test_dir/typescript_include.fbs", @@ -98,6 +98,7 @@ def flatc(options, schema, prefix=None, include=None, data=None, cwd=tests_path) flatc( options=[ "--ts", + "--reflect-names", "--gen-name-strings", "--gen-mutable", "--gen-object-api", diff --git a/tests/union_vector/union_vector_generated.h b/tests/union_vector/union_vector_generated.h index 6b811c876bb..1e3f116e70a 100644 --- a/tests/union_vector/union_vector_generated.h +++ b/tests/union_vector/union_vector_generated.h @@ -356,9 +356,6 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Rapunzel FLATBUFFERS_FINAL_CLASS { static const flatbuffers::TypeTable *MiniReflectTypeTable() { return RapunzelTypeTable(); } - static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { - return "Rapunzel"; - } Rapunzel() : hair_length_(0) { } @@ -392,9 +389,6 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) BookReader FLATBUFFERS_FINAL_CLASS { static const flatbuffers::TypeTable *MiniReflectTypeTable() { return BookReaderTypeTable(); } - static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { - return "BookReader"; - } BookReader() : books_read_(0) { } @@ -428,9 +422,6 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) FallingTub FLATBUFFERS_FINAL_CLASS { static const flatbuffers::TypeTable *MiniReflectTypeTable() { return FallingTubTypeTable(); } - static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { - return "FallingTub"; - } FallingTub() : weight_(0) { } @@ -458,9 +449,6 @@ inline bool operator!=(const FallingTub &lhs, const FallingTub &rhs) { struct AttackerT : public flatbuffers::NativeTable { typedef Attacker TableType; - static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { - return "AttackerT"; - } int32_t sword_attack_damage = 0; }; @@ -470,9 +458,6 @@ struct Attacker FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { static const flatbuffers::TypeTable *MiniReflectTypeTable() { return AttackerTypeTable(); } - static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { - return "Attacker"; - } enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_SWORD_ATTACK_DAMAGE = 4 }; @@ -522,9 +507,6 @@ flatbuffers::Offset CreateAttacker(flatbuffers::FlatBufferBuilder &_fb struct HandFanT : public flatbuffers::NativeTable { typedef HandFan TableType; - static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { - return "HandFanT"; - } int32_t length = 0; }; @@ -534,9 +516,6 @@ struct HandFan FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { static const flatbuffers::TypeTable *MiniReflectTypeTable() { return HandFanTypeTable(); } - static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { - return "HandFan"; - } enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_LENGTH = 4 }; @@ -586,9 +565,6 @@ flatbuffers::Offset CreateHandFan(flatbuffers::FlatBufferBuilder &_fbb, struct MovieT : public flatbuffers::NativeTable { typedef Movie TableType; - static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { - return "MovieT"; - } CharacterUnion main_character{}; std::vector characters{}; }; @@ -599,9 +575,6 @@ struct Movie FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { static const flatbuffers::TypeTable *MiniReflectTypeTable() { return MovieTypeTable(); } - static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() { - return "Movie"; - } enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_MAIN_CHARACTER_TYPE = 4, VT_MAIN_CHARACTER = 6,