Partial support for --ts-flat-files and --gen-all (#7446)
* Partial support for --ts-flat-files and --gen-all * Add generated code changes * remove some debugging code left over * missed grpc files
This commit is contained in:
parent
a3508f36d5
commit
a66de58af9
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class HelloReply {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):HelloReply {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):HelloReply {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class HelloRequest {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):HelloRequest {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):HelloRequest {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -643,10 +643,6 @@ int FlatCompiler::Compile(int argc, const char **argv) {
|
|||
"well.");
|
||||
}
|
||||
|
||||
if (opts.ts_flat_file && opts.generate_all) {
|
||||
Error("Combining --ts-flat-file and --gen-all is not supported.");
|
||||
}
|
||||
|
||||
flatbuffers::Parser conform_parser;
|
||||
if (!conform_to_schema.empty()) {
|
||||
std::string contents;
|
||||
|
|
|
@ -38,7 +38,7 @@ struct ImportDefinition {
|
|||
};
|
||||
|
||||
enum AnnotationType { kParam = 0, kType = 1, kReturns = 2 };
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace ts {
|
||||
// Iterate through all definitions we haven't generate code for (enums, structs,
|
||||
|
@ -111,10 +111,6 @@ class TsGenerator : public BaseGenerator {
|
|||
for (auto kw = keywords; *kw; kw++) keywords_.insert(*kw);
|
||||
}
|
||||
bool generate() {
|
||||
if (parser_.opts.ts_flat_file && parser_.opts.generate_all) {
|
||||
// Not implemented; warning message should have been emitted by flatc.
|
||||
return false;
|
||||
}
|
||||
generateEnums();
|
||||
generateStructs();
|
||||
generateEntry();
|
||||
|
@ -227,39 +223,45 @@ class TsGenerator : public BaseGenerator {
|
|||
|
||||
// Generate code for a single entry point module.
|
||||
void generateEntry() {
|
||||
std::string code;
|
||||
std::string code =
|
||||
"// " + std::string(FlatBuffersGeneratedWarning()) + "\n\n";
|
||||
if (parser_.opts.ts_flat_file) {
|
||||
if (import_flatbuffers_lib_) {
|
||||
code += "import * as flatbuffers from 'flatbuffers';\n";
|
||||
code += "\n";
|
||||
}
|
||||
for (const auto &it : flat_file_import_declarations_) {
|
||||
// Note that we do end up generating an import for ourselves, which
|
||||
// should generally be harmless.
|
||||
// TODO: Make it so we don't generate a self-import; this will also
|
||||
// require modifying AddImport to ensure that we don't use
|
||||
// namespace-prefixed names anywhere...
|
||||
std::string file = it.first;
|
||||
if (file.empty()) { continue; }
|
||||
std::string noext = flatbuffers::StripExtension(file);
|
||||
std::string basename = flatbuffers::StripPath(noext);
|
||||
std::string include_file = GeneratedFileName(
|
||||
parser_.opts.include_prefix,
|
||||
parser_.opts.keep_prefix ? noext : basename, parser_.opts);
|
||||
// TODO: what is the right behavior when different include flags are
|
||||
// specified here? Should we always be adding the "./" for a relative
|
||||
// path or turn it off if --include-prefix is specified, or something
|
||||
// else?
|
||||
std::string include_name =
|
||||
"./" + flatbuffers::StripExtension(include_file);
|
||||
code += "import {";
|
||||
for (const auto &pair : it.second) {
|
||||
code += EscapeKeyword(pair.first) + " as " +
|
||||
EscapeKeyword(pair.second) + ", ";
|
||||
// Only include import statements when not generating all.
|
||||
if (!parser_.opts.generate_all) {
|
||||
for (const auto &it : flat_file_import_declarations_) {
|
||||
// Note that we do end up generating an import for ourselves, which
|
||||
// should generally be harmless.
|
||||
// TODO: Make it so we don't generate a self-import; this will also
|
||||
// require modifying AddImport to ensure that we don't use
|
||||
// namespace-prefixed names anywhere...
|
||||
std::string file = it.first;
|
||||
if (file.empty()) { continue; }
|
||||
std::string noext = flatbuffers::StripExtension(file);
|
||||
std::string basename = flatbuffers::StripPath(noext);
|
||||
std::string include_file = GeneratedFileName(
|
||||
parser_.opts.include_prefix,
|
||||
parser_.opts.keep_prefix ? noext : basename, parser_.opts);
|
||||
// TODO: what is the right behavior when different include flags are
|
||||
// specified here? Should we always be adding the "./" for a relative
|
||||
// path or turn it off if --include-prefix is specified, or something
|
||||
// else?
|
||||
std::string include_name =
|
||||
"./" + flatbuffers::StripExtension(include_file);
|
||||
code += "import {";
|
||||
for (const auto &pair : it.second) {
|
||||
code += EscapeKeyword(pair.first) + " as " +
|
||||
EscapeKeyword(pair.second) + ", ";
|
||||
}
|
||||
code.resize(code.size() - 2);
|
||||
code += "} from '" + include_name + "';\n";
|
||||
}
|
||||
code.resize(code.size() - 2);
|
||||
code += "} from '" + include_name + "';\n";
|
||||
code += "\n";
|
||||
}
|
||||
code += "\n\n";
|
||||
|
||||
code += flat_file_;
|
||||
const std::string filename =
|
||||
GeneratedFileName(path_, file_name_, parser_.opts);
|
||||
|
@ -305,7 +307,9 @@ class TsGenerator : public BaseGenerator {
|
|||
if (reverse) return; // FIXME.
|
||||
std::string &code = *code_ptr;
|
||||
GenDocComment(enum_def.doc_comment, code_ptr);
|
||||
code += "export enum " + EscapeKeyword(enum_def.name) + "{\n";
|
||||
code += "export enum ";
|
||||
// TODO(7445): figure out if the export needs a namespace for ts-flat-files
|
||||
code += EscapeKeyword(enum_def.name) + " {\n";
|
||||
for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end(); ++it) {
|
||||
auto &ev = **it;
|
||||
if (!ev.doc_comment.empty()) {
|
||||
|
@ -659,19 +663,14 @@ class TsGenerator : public BaseGenerator {
|
|||
// above, but since we force all non-self-imports to use namespace-based
|
||||
// names in flat file generation, it's fine).
|
||||
if (dependent.file == dependency.file) {
|
||||
// Should already be caught elsewhere, but if we ever try to get flat
|
||||
// file generation and --gen-all working concurrently, then we'll need
|
||||
// to update this import logic.
|
||||
FLATBUFFERS_ASSERT(!parser_.opts.generate_all);
|
||||
long_import_name = import_name;
|
||||
} else {
|
||||
long_import_name = ns + import_name;
|
||||
std::string file = dependency.declaration_file == nullptr
|
||||
? dependency.file
|
||||
: dependency.declaration_file->substr(2);
|
||||
file = RelativeToRootPath(StripFileName(AbsolutePath(dependent.file)),
|
||||
dependency.file)
|
||||
.substr(2);
|
||||
std::string file =
|
||||
RelativeToRootPath(StripFileName(AbsolutePath(dependent.file)),
|
||||
dependency.file)
|
||||
// Strip the leading //
|
||||
.substr(2);
|
||||
flat_file_import_declarations_[file][import_name] = long_import_name;
|
||||
if (parser_.opts.generate_object_based_api) {
|
||||
flat_file_import_declarations_[file][import_name + "T"] =
|
||||
|
@ -753,19 +752,14 @@ class TsGenerator : public BaseGenerator {
|
|||
// above, but since we force all non-self-imports to use namespace-based
|
||||
// names in flat file generation, it's fine).
|
||||
if (dependent.file == dependency.file) {
|
||||
// Should already be caught elsewhere, but if we ever try to get flat
|
||||
// file generation and --gen-all working concurrently, then we'll need
|
||||
// to update this import logic.
|
||||
FLATBUFFERS_ASSERT(!parser_.opts.generate_all);
|
||||
long_import_name = import_name;
|
||||
} else {
|
||||
long_import_name = ns + import_name;
|
||||
std::string file = dependency.declaration_file == nullptr
|
||||
? dependency.file
|
||||
: dependency.declaration_file->substr(2);
|
||||
file = RelativeToRootPath(StripFileName(AbsolutePath(dependent.file)),
|
||||
dependency.file)
|
||||
.substr(2);
|
||||
std::string file =
|
||||
RelativeToRootPath(StripFileName(AbsolutePath(dependent.file)),
|
||||
dependency.file)
|
||||
// Strip the leading //
|
||||
.substr(2);
|
||||
flat_file_import_declarations_[file][import_name] = long_import_name;
|
||||
}
|
||||
}
|
||||
|
@ -1347,7 +1341,9 @@ class TsGenerator : public BaseGenerator {
|
|||
// Emit constructor
|
||||
object_name = EscapeKeyword(struct_def.name);
|
||||
GenDocComment(struct_def.doc_comment, code_ptr);
|
||||
code += "export class " + object_name;
|
||||
code += "export class ";
|
||||
// TODO(7445): figure out if the export needs a namespace for ts-flat-files
|
||||
code += object_name;
|
||||
code += " {\n";
|
||||
code += " bb: flatbuffers.ByteBuffer|null = null;\n";
|
||||
code += " bb_pos = 0;\n";
|
||||
|
@ -1355,7 +1351,7 @@ class TsGenerator : public BaseGenerator {
|
|||
// Generate the __init method that sets the field in a pre-existing
|
||||
// accessor object. This is to allow object reuse.
|
||||
code +=
|
||||
"__init(i:number, bb:flatbuffers.ByteBuffer):" + object_name + " {\n";
|
||||
" __init(i:number, bb:flatbuffers.ByteBuffer):" + object_name + " {\n";
|
||||
code += " this.bb_pos = i;\n";
|
||||
code += " this.bb = bb;\n";
|
||||
code += " return this;\n";
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
table Baz {
|
||||
a:int;
|
||||
enum Baz : short {
|
||||
None = 0,
|
||||
Red,
|
||||
Green,
|
||||
Blue,
|
||||
}
|
|
@ -77,8 +77,22 @@ def assert_file_contains(file, needles):
|
|||
return file
|
||||
|
||||
|
||||
def assert_file_and_contents(file, needle, path=script_path, unlink=True):
|
||||
def assert_file_doesnt_contains(file, needles):
|
||||
with open(file) as file:
|
||||
contents = file.read()
|
||||
for needle in [needles] if isinstance(needles, str) else needles:
|
||||
assert needle not in contents, (
|
||||
"Found unexpected '" + needle + "' in file: " + str(file)
|
||||
)
|
||||
return file
|
||||
|
||||
|
||||
def assert_file_and_contents(
|
||||
file, needle, doesnt_contain=None, path=script_path, unlink=True
|
||||
):
|
||||
assert_file_contains(assert_file_exists(file, path), needle)
|
||||
if doesnt_contain:
|
||||
assert_file_doesnt_contains(assert_file_exists(file, path), doesnt_contain)
|
||||
if unlink:
|
||||
Path(path, file).unlink()
|
||||
|
||||
|
@ -102,7 +116,7 @@ def run_all(*modules):
|
|||
module_passing = module_passing + 1
|
||||
except Exception as e:
|
||||
print(" [FAILED]: " + str(e))
|
||||
failingmodule_failing = failingmodule_failing + 1
|
||||
module_failing = module_failing + 1
|
||||
print(
|
||||
"{0}: {1} of {2} passsed".format(
|
||||
module.__name__, module_passing, module_passing + module_failing
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
from flatc_test import *
|
||||
|
||||
|
||||
class TsTests():
|
||||
|
||||
def Base(self):
|
||||
|
@ -24,7 +25,10 @@ class TsTests():
|
|||
# include, bar.
|
||||
assert_file_and_contents(
|
||||
"foo_generated.ts",
|
||||
["export { Bar } from './bar';", "export { Foo } from './foo';"],
|
||||
[
|
||||
"export { Bar } from './bar';",
|
||||
"export { Foo } from './foo';",
|
||||
],
|
||||
)
|
||||
|
||||
# Foo should be generated in place and exports the Foo table.
|
||||
|
@ -33,6 +37,26 @@ class TsTests():
|
|||
# Included files, like bar, should not be generated.
|
||||
assert_file_doesnt_exists("bar.ts")
|
||||
|
||||
def BaseMultipleFiles(self):
|
||||
# Generate both foo and bar with no extra arguments
|
||||
flatc(["--ts", "foo.fbs", "bar/bar.fbs"])
|
||||
|
||||
# Should generate the module that exports both foo and its direct
|
||||
# include, bar.
|
||||
assert_file_and_contents(
|
||||
"foo_generated.ts",
|
||||
[
|
||||
"export { Bar } from './bar';",
|
||||
"export { Foo } from './foo';",
|
||||
],
|
||||
)
|
||||
|
||||
# Foo should be generated in place and exports the Foo table.
|
||||
assert_file_and_contents("foo.ts", "export class Foo {")
|
||||
|
||||
# Bar should also be generatd in place and exports the Bar table.
|
||||
assert_file_and_contents("bar.ts", "export class Bar {")
|
||||
|
||||
def BaseWithNamespace(self):
|
||||
# Generate foo with namespacing, with no extra arguments
|
||||
flatc(["--ts", "foo_with_ns.fbs"])
|
||||
|
@ -41,29 +65,132 @@ class TsTests():
|
|||
# directory and its direct include, bar.
|
||||
assert_file_and_contents(
|
||||
"foo_with_ns_generated.ts",
|
||||
["export { Bar } from './bar';", "export { Foo } from './something/foo';"],
|
||||
[
|
||||
"export { Bar } from './bar';",
|
||||
"export { Foo } from './something/foo';",
|
||||
],
|
||||
)
|
||||
|
||||
# Foo should be placed in the namespaced directory. It should export
|
||||
# Foo, and the import of Bar should be relative to its location.
|
||||
assert_file_and_contents(
|
||||
"something/foo.ts",
|
||||
["export class Foo {", "import { Bar } from '../bar';"],
|
||||
[
|
||||
"export class Foo {",
|
||||
"import { Bar } from '../bar';",
|
||||
],
|
||||
)
|
||||
|
||||
# Included files, like bar, should not be generated.
|
||||
assert_file_doesnt_exists("bar.ts")
|
||||
|
||||
def GenAll(self):
|
||||
# Generate foo with generate all options
|
||||
flatc(["--ts", "--gen-all", "foo.fbs"])
|
||||
|
||||
# Should generate a single file that exports all the generated types.
|
||||
assert_file_and_contents(
|
||||
"foo_generated.ts",
|
||||
[
|
||||
"export { Bar } from './bar'",
|
||||
"export { Baz } from './baz'",
|
||||
"export { Foo } from './foo'",
|
||||
],
|
||||
)
|
||||
|
||||
# Foo should be generated with an import to Bar and an export of itself.
|
||||
assert_file_and_contents(
|
||||
"foo.ts",
|
||||
[
|
||||
"import { Bar } from './bar';",
|
||||
"export class Foo {",
|
||||
],
|
||||
)
|
||||
|
||||
# Bar should be generated with an import to Baz and an export of itself.
|
||||
assert_file_and_contents(
|
||||
"bar.ts",
|
||||
[
|
||||
"import { Baz } from './baz';",
|
||||
"export class Bar {",
|
||||
],
|
||||
)
|
||||
|
||||
# Baz should be generated with an export of itself.
|
||||
assert_file_and_contents(
|
||||
"baz.ts",
|
||||
[
|
||||
"export enum Baz {",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
def FlatFiles(self):
|
||||
# Generate just foo the flat files option
|
||||
# Generate just foo with the flat files option
|
||||
flatc(["--ts", "--ts-flat-files", "foo.fbs"])
|
||||
|
||||
# Should generate a single file that imports bar as a single file, and]
|
||||
# Should generate a single file that imports bar as a single file, and
|
||||
# exports the Foo table.
|
||||
assert_file_and_contents(
|
||||
"foo_generated.ts",
|
||||
["import {Bar as Bar} from './bar_generated';", "export class Foo {"],
|
||||
[
|
||||
"import {Bar as Bar} from './bar_generated';",
|
||||
"export class Foo {",
|
||||
],
|
||||
)
|
||||
|
||||
# The root type Foo should not be generated in its own file.
|
||||
assert_file_doesnt_exists("foo.ts")
|
||||
|
||||
def FlatFilesMultipleFiles(self):
|
||||
# Generate both foo and bar with the flat files option
|
||||
flatc(["--ts", "--ts-flat-files", "foo.fbs", "bar/bar.fbs"])
|
||||
|
||||
# Should generate a single foo file that imports bar as a single file,
|
||||
# and exports the Foo table.
|
||||
assert_file_and_contents(
|
||||
"foo_generated.ts",
|
||||
[
|
||||
"import {Bar as Bar} from './bar_generated';",
|
||||
"export class Foo {",
|
||||
],
|
||||
)
|
||||
|
||||
# Should generate a single bar file that imports bar as a single file,
|
||||
# and exports the Bar table.
|
||||
assert_file_and_contents(
|
||||
"bar_generated.ts",
|
||||
[
|
||||
"import {Baz as Baz} from './baz_generated';",
|
||||
"export class Bar {",
|
||||
],
|
||||
)
|
||||
|
||||
# The types Foo and Bar should not be generated in their own files
|
||||
assert_file_doesnt_exists("foo.ts")
|
||||
assert_file_doesnt_exists("bar.ts")
|
||||
|
||||
def FlatFilesGenAll(self):
|
||||
# Generate foo with all of its dependents with the flat files option
|
||||
flatc(["--ts", "--ts-flat-files", "--gen-all", "foo.fbs"])
|
||||
|
||||
# Should generate a single foo file
|
||||
assert_file_and_contents(
|
||||
"foo_generated.ts",
|
||||
# Should export each of the types within the single file
|
||||
[
|
||||
"export class Foo {",
|
||||
"export class Bar {",
|
||||
"export enum Baz {",
|
||||
],
|
||||
# No includes for the dependent types should be present.
|
||||
doesnt_contain=[
|
||||
"import {Bar as Bar}",
|
||||
"import {Baz as Baz}",
|
||||
],
|
||||
)
|
||||
|
||||
# The types Foo, Bar and Baz should not be generated in their own files.
|
||||
assert_file_doesnt_exists("foo.ts")
|
||||
assert_file_doesnt_exists("bar.ts")
|
||||
assert_file_doesnt_exists("baz.ts")
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export { Monster } from './my-game/example/monster';
|
||||
export { Monster as MyGameExample2Monster, MonsterT as MyGameExample2MonsterT } from './my-game/example2/monster';
|
||||
export { Ability, AbilityT } from './my-game/example/ability';
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class Ability {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Ability {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Ability {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import { Monster, MonsterT } from '../../my-game/example/monster';
|
||||
|
||||
|
||||
export enum AnyAmbiguousAliases{
|
||||
export enum AnyAmbiguousAliases {
|
||||
NONE = 0,
|
||||
M1 = 1,
|
||||
M2 = 2,
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Monster, MonsterT } from '../../my-game/example/monster';
|
|||
import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum';
|
||||
|
||||
|
||||
export enum AnyUniqueAliases{
|
||||
export enum AnyUniqueAliases {
|
||||
NONE = 0,
|
||||
M = 1,
|
||||
TS = 2,
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Monster, MonsterT } from '../../my-game/example/monster';
|
|||
import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum';
|
||||
|
||||
|
||||
export enum Any{
|
||||
export enum Any {
|
||||
NONE = 0,
|
||||
Monster = 1,
|
||||
TestSimpleTableWithEnum = 2,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
* Composite components of Monster color.
|
||||
*/
|
||||
export enum Color{
|
||||
export enum Color {
|
||||
Red = 1,
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export enum LongEnum{
|
||||
export enum LongEnum {
|
||||
LongOne = '2',
|
||||
LongTwo = '4',
|
||||
LongBig = '1099511627776'
|
||||
|
|
|
@ -23,7 +23,7 @@ import { InParentNamespace, InParentNamespaceT } from '../../my-game/in-parent-n
|
|||
export class Monster {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Monster {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Monster {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export enum Race{
|
||||
export enum Race {
|
||||
None = -1,
|
||||
Human = 0,
|
||||
Dwarf = 1,
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class Referrable {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Referrable {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Referrable {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class Stat {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Stat {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Stat {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -8,7 +8,7 @@ import { StructOfStructs, StructOfStructsT } from '../../my-game/example/struct-
|
|||
export class StructOfStructsOfStructs {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructsOfStructs {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructsOfStructs {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -9,7 +9,7 @@ import { Test, TestT } from '../../my-game/example/test';
|
|||
export class StructOfStructs {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructs {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructs {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -8,7 +8,7 @@ import { Color } from '../../my-game/example/color';
|
|||
export class TestSimpleTableWithEnum {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):TestSimpleTableWithEnum {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):TestSimpleTableWithEnum {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class Test {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Test {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Test {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class TypeAliases {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):TypeAliases {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):TypeAliases {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -9,7 +9,7 @@ import { Test, TestT } from '../../my-game/example/test';
|
|||
export class Vec3 {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Vec3 {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Vec3 {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class Monster {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Monster {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Monster {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class InParentNamespace {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):InParentNamespace {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):InParentNamespace {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export enum OptionalByte{
|
||||
export enum OptionalByte {
|
||||
None = 0,
|
||||
One = 1,
|
||||
Two = 2
|
||||
|
|
|
@ -8,7 +8,7 @@ import { OptionalByte } from '../optional-scalars/optional-byte';
|
|||
export class ScalarStuff {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ScalarStuff {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ScalarStuff {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export { ScalarStuff } from './optional-scalars/scalar-stuff';
|
||||
export { OptionalByte } from './optional-scalars/optional-byte';
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class Attacker {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Attacker {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Attacker {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class BookReader {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):BookReader {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):BookReader {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -5,7 +5,7 @@ import { BookReader, BookReaderT } from './book-reader';
|
|||
import { Rapunzel, RapunzelT } from './rapunzel';
|
||||
|
||||
|
||||
export enum Character{
|
||||
export enum Character {
|
||||
NONE = 0,
|
||||
MuLan = 1,
|
||||
Rapunzel = 2,
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class FallingTub {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):FallingTub {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):FallingTub {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -4,7 +4,7 @@ import { FallingTub, FallingTubT } from './falling-tub';
|
|||
import { HandFan, HandFanT } from './hand-fan';
|
||||
|
||||
|
||||
export enum Gadget{
|
||||
export enum Gadget {
|
||||
NONE = 0,
|
||||
FallingTub = 1,
|
||||
HandFan = 2
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class HandFan {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):HandFan {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):HandFan {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -11,7 +11,7 @@ import { Rapunzel, RapunzelT } from './rapunzel';
|
|||
export class Movie {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Movie {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Movie {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as flatbuffers from 'flatbuffers';
|
|||
export class Rapunzel {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Rapunzel {
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):Rapunzel {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export { Attacker, AttackerT } from './attacker';
|
||||
export { BookReader, BookReaderT } from './book-reader';
|
||||
export { Character, unionToCharacter, unionListToCharacter } from './character';
|
||||
|
|
Loading…
Reference in New Issue