mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
[TS/JS] BigInt implementation (#6998)
* BigInt implementation * Unit test reading long from existing bytebuffer * Code review
This commit is contained in:
@@ -291,8 +291,7 @@ class TsGenerator : public BaseGenerator {
|
||||
|
||||
std::string GenBBAccess() const { return "this.bb!"; }
|
||||
|
||||
std::string GenDefaultValue(const FieldDef &field, const std::string &context,
|
||||
import_set &imports) {
|
||||
std::string GenDefaultValue(const FieldDef &field, import_set &imports) {
|
||||
if (field.IsScalarOptional()) { return "null"; }
|
||||
|
||||
const auto &value = field.value;
|
||||
@@ -319,10 +318,7 @@ class TsGenerator : public BaseGenerator {
|
||||
|
||||
case BASE_TYPE_LONG:
|
||||
case BASE_TYPE_ULONG: {
|
||||
int64_t constant = StringToInt(value.constant.c_str());
|
||||
std::string createLong = context + ".createLong";
|
||||
return createLong + "(" + NumToString(static_cast<int32_t>(constant)) +
|
||||
", " + NumToString(static_cast<int32_t>(constant >> 32)) + ")";
|
||||
return "BigInt('" + value.constant + "')";
|
||||
}
|
||||
|
||||
default: return value.constant;
|
||||
@@ -348,7 +344,7 @@ class TsGenerator : public BaseGenerator {
|
||||
case BASE_TYPE_BOOL: return allowNull ? "boolean|null" : "boolean";
|
||||
case BASE_TYPE_LONG:
|
||||
case BASE_TYPE_ULONG:
|
||||
return allowNull ? "flatbuffers.Long|null" : "flatbuffers.Long";
|
||||
return allowNull ? "bigint|null" : "bigint";
|
||||
default:
|
||||
if (IsScalar(type.base_type)) {
|
||||
if (type.enum_def) {
|
||||
@@ -912,7 +908,7 @@ class TsGenerator : public BaseGenerator {
|
||||
// the variable name from field_offset_decl
|
||||
std::string field_offset_val;
|
||||
const auto field_default_val =
|
||||
GenDefaultValue(field, "flatbuffers", imports);
|
||||
GenDefaultValue(field, imports);
|
||||
|
||||
// Emit a scalar field
|
||||
const auto is_string = IsString(field.value.type);
|
||||
@@ -1232,7 +1228,7 @@ class TsGenerator : public BaseGenerator {
|
||||
if (is_string) { index += ", optionalEncoding"; }
|
||||
code += offset_prefix +
|
||||
GenGetter(field.value.type, "(" + index + ")") + " : " +
|
||||
GenDefaultValue(field, GenBBAccess(), imports);
|
||||
GenDefaultValue(field, imports);
|
||||
code += ";\n";
|
||||
}
|
||||
}
|
||||
@@ -1328,7 +1324,7 @@ class TsGenerator : public BaseGenerator {
|
||||
code += "false";
|
||||
} else if (field.value.type.element == BASE_TYPE_LONG ||
|
||||
field.value.type.element == BASE_TYPE_ULONG) {
|
||||
code += GenBBAccess() + ".createLong(0, 0)";
|
||||
code += "BigInt(0)";
|
||||
} else if (IsScalar(field.value.type.element)) {
|
||||
if (field.value.type.enum_def) {
|
||||
code += field.value.constant;
|
||||
@@ -1482,13 +1478,13 @@ class TsGenerator : public BaseGenerator {
|
||||
code += "0";
|
||||
} else if (HasNullDefault(field)) {
|
||||
if (IsLong(field.value.type.base_type)) {
|
||||
code += "builder.createLong(0, 0)";
|
||||
code += "BigInt(0)";
|
||||
} else {
|
||||
code += "0";
|
||||
}
|
||||
} else {
|
||||
if (field.value.type.base_type == BASE_TYPE_BOOL) { code += "+"; }
|
||||
code += GenDefaultValue(field, "builder", imports);
|
||||
code += GenDefaultValue(field, imports);
|
||||
}
|
||||
code += ");\n}\n\n";
|
||||
|
||||
|
||||
@@ -918,7 +918,7 @@ CheckedError Parser::ParseField(StructDef &struct_def) {
|
||||
}
|
||||
if (!SupportsOptionalScalars()) {
|
||||
return Error(
|
||||
"Optional scalars are not yet supported in at least one the of "
|
||||
"Optional scalars are not yet supported in at least one of "
|
||||
"the specified programming languages.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,11 @@ function createMonster(fbb) {
|
||||
fbb.createString('test2')
|
||||
]);
|
||||
|
||||
var testVectorOfLongs = Monster.createVectorOfLongsVector(fbb, [
|
||||
1n,
|
||||
101010100n
|
||||
]);
|
||||
|
||||
Monster.startMonster(fbb);
|
||||
Monster.addPos(fbb, Vec3.createVec3(fbb, 1, 2, 3, 3, Color.Green, 5, 6));
|
||||
Monster.addHp(fbb, 80);
|
||||
@@ -82,6 +87,7 @@ function createMonster(fbb) {
|
||||
Monster.addTest(fbb, mon2);
|
||||
Monster.addTest4(fbb, test4);
|
||||
Monster.addTestarrayofstring(fbb, testArrayOfString);
|
||||
Monster.addVectorOfLongs(fbb, testVectorOfLongs);
|
||||
Monster.addTestbool(fbb, true);
|
||||
var mon = Monster.endMonster(fbb);
|
||||
|
||||
@@ -94,7 +100,7 @@ function serializeAndTest(fbb) {
|
||||
// parser may serialize in a slightly different order than the above
|
||||
// JavaScript code. They are functionally equivalent though.
|
||||
|
||||
fs.writeFileSync('monsterdata_javascript_wire.mon', new Buffer(fbb.asUint8Array()));
|
||||
fs.writeFileSync('monsterdata_javascript_wire.mon', Buffer.from(fbb.asUint8Array()));
|
||||
|
||||
// Tests mutation first. This will verify that we did not trample any other
|
||||
// part of the byte buffer.
|
||||
@@ -207,6 +213,12 @@ function testBuffer(bb) {
|
||||
}
|
||||
assert.strictEqual(invsum2, 10);
|
||||
|
||||
let longSum = 0n;
|
||||
for (let idx = 0; idx < monster.vectorOfLongsLength(); ++idx) {
|
||||
longSum += monster.vectorOfLongs(idx);
|
||||
}
|
||||
assert.strictEqual(longSum, 101010101n);
|
||||
|
||||
var test_0 = monster.test4(0);
|
||||
var test_1 = monster.test4(1);
|
||||
assert.strictEqual(monster.test4Length(), 2);
|
||||
@@ -239,8 +251,8 @@ function test64bit() {
|
||||
var mon2 = Monster.endMonster(fbb);
|
||||
|
||||
Stat.startStat(fbb);
|
||||
// 2541551405100253985 = 0x87654321(low part) + 0x23456789 * 0x100000000(high part);
|
||||
Stat.addVal(fbb, new flatbuffers.Long(0x87654321, 0x23456789)); // the low part is Uint32
|
||||
// 2541551405100253985 = 0x2345678987654321
|
||||
Stat.addVal(fbb, 0x2345678987654321n);
|
||||
var stat = Stat.endStat(fbb);
|
||||
|
||||
Monster.startMonster(fbb);
|
||||
@@ -261,15 +273,14 @@ function test64bit() {
|
||||
var stat = mon.testempty();
|
||||
assert.strictEqual(stat != null, true);
|
||||
assert.strictEqual(stat.val() != null, true);
|
||||
assert.strictEqual(stat.val().toFloat64(), 2541551405100253985);
|
||||
assert.strictEqual(stat.val(), 2541551405100253985n);
|
||||
|
||||
var mon2 = mon.enemy();
|
||||
assert.strictEqual(mon2 != null, true);
|
||||
stat = mon2.testempty();
|
||||
assert.strictEqual(stat != null, true);
|
||||
assert.strictEqual(stat.val() != null, true);
|
||||
assert.strictEqual(stat.val().low, 0); // default value
|
||||
assert.strictEqual(stat.val().high, 0);
|
||||
assert.strictEqual(stat.val(), 0n); // default value
|
||||
}
|
||||
|
||||
function testUnicode() {
|
||||
@@ -280,17 +291,17 @@ function testUnicode() {
|
||||
function testReadingUnicode(bb) {
|
||||
var monster = Monster.getRootAsMonster(bb);
|
||||
assert.strictEqual(monster.name(), json.name);
|
||||
assert.deepEqual(new Buffer(monster.name(flatbuffers.Encoding.UTF8_BYTES)), new Buffer(json.name));
|
||||
assert.deepEqual(Buffer.from(monster.name(flatbuffers.Encoding.UTF8_BYTES)), Buffer.from(json.name));
|
||||
assert.strictEqual(monster.testarrayoftablesLength(), json.testarrayoftables.length);
|
||||
json.testarrayoftables.forEach(function(table, i) {
|
||||
var value = monster.testarrayoftables(i);
|
||||
assert.strictEqual(value.name(), table.name);
|
||||
assert.deepEqual(new Buffer(value.name(flatbuffers.Encoding.UTF8_BYTES)), new Buffer(table.name));
|
||||
assert.deepEqual(Buffer.from(value.name(flatbuffers.Encoding.UTF8_BYTES)), Buffer.from(table.name));
|
||||
});
|
||||
assert.strictEqual(monster.testarrayofstringLength(), json.testarrayofstring.length);
|
||||
json.testarrayofstring.forEach(function(string, i) {
|
||||
assert.strictEqual(monster.testarrayofstring(i), string);
|
||||
assert.deepEqual(new Buffer(monster.testarrayofstring(i, flatbuffers.Encoding.UTF8_BYTES)), new Buffer(string));
|
||||
assert.deepEqual(Buffer.from(monster.testarrayofstring(i, flatbuffers.Encoding.UTF8_BYTES)), Buffer.from(string));
|
||||
});
|
||||
}
|
||||
testReadingUnicode(new flatbuffers.ByteBuffer(new Uint8Array(correct)));
|
||||
@@ -299,7 +310,7 @@ function testUnicode() {
|
||||
var fbb = new flatbuffers.Builder();
|
||||
var name = fbb.createString(json.name);
|
||||
var testarrayoftablesOffsets = json.testarrayoftables.map(function(table) {
|
||||
var name = fbb.createString(new Uint8Array(new Buffer(table.name)));
|
||||
var name = fbb.createString(new Uint8Array(Buffer.from(table.name)));
|
||||
Monster.startMonster(fbb);
|
||||
Monster.addName(fbb, name);
|
||||
return Monster.endMonster(fbb);
|
||||
@@ -359,8 +370,8 @@ function fuzzTest1() {
|
||||
var ushort_val = 0xFEEE;
|
||||
var int_val = 0x83333333 | 0;
|
||||
var uint_val = 0xFDDDDDDD;
|
||||
var long_val = new flatbuffers.Long(0x44444444, 0x84444444);
|
||||
var ulong_val = new flatbuffers.Long(0xCCCCCCCC, 0xFCCCCCCC);
|
||||
var long_val = BigInt.asIntN(64, 0x8444444444444444n);
|
||||
var ulong_val = BigInt.asUintN(64, 0xFCCCCCCCCCCCCCCCn);
|
||||
var float_val = new Float32Array([3.14159])[0];
|
||||
var double_val = 3.14159265359;
|
||||
|
||||
@@ -381,16 +392,16 @@ function fuzzTest1() {
|
||||
for (var f = 0; f < fields_per_object; f++) {
|
||||
var choice = lcg_rand() % test_values_max;
|
||||
switch (choice) {
|
||||
case 0: builder.addFieldInt8(f, bool_val, 0); break;
|
||||
case 1: builder.addFieldInt8(f, char_val, 0); break;
|
||||
case 2: builder.addFieldInt8(f, uchar_val, 0); break;
|
||||
case 3: builder.addFieldInt16(f, short_val, 0); break;
|
||||
case 0: builder.addFieldInt8(f, bool_val, 0); break;
|
||||
case 1: builder.addFieldInt8(f, char_val, 0); break;
|
||||
case 2: builder.addFieldInt8(f, uchar_val, 0); break;
|
||||
case 3: builder.addFieldInt16(f, short_val, 0); break;
|
||||
case 4: builder.addFieldInt16(f, ushort_val, 0); break;
|
||||
case 5: builder.addFieldInt32(f, int_val, 0); break;
|
||||
case 6: builder.addFieldInt32(f, uint_val, 0); break;
|
||||
case 7: builder.addFieldInt64(f, long_val, flatbuffers.Long.ZERO); break;
|
||||
case 8: builder.addFieldInt64(f, ulong_val, flatbuffers.Long.ZERO); break;
|
||||
case 9: builder.addFieldFloat32(f, float_val, 0); break;
|
||||
case 5: builder.addFieldInt32(f, int_val, 0); break;
|
||||
case 6: builder.addFieldInt32(f, uint_val, 0); break;
|
||||
case 7: builder.addFieldInt64(f, long_val, 0n); break;
|
||||
case 8: builder.addFieldInt64(f, ulong_val, 0n); break;
|
||||
case 9: builder.addFieldFloat32(f, float_val, 0); break;
|
||||
case 10: builder.addFieldFloat64(f, double_val, 0); break;
|
||||
}
|
||||
}
|
||||
@@ -423,8 +434,8 @@ function fuzzTest1() {
|
||||
case 4: assert.strictEqual(view.getUint16(field_offset, true), ushort_val); break;
|
||||
case 5: assert.strictEqual(view.getInt32(field_offset, true), int_val); break;
|
||||
case 6: assert.strictEqual(view.getUint32(field_offset, true), uint_val); break;
|
||||
case 7: assert.strictEqual(view.getInt32(field_offset, true), long_val.low); assert.strictEqual(view.getInt32(field_offset + 4, true), long_val.high); break;
|
||||
case 8: assert.strictEqual(view.getInt32(field_offset, true), ulong_val.low); assert.strictEqual(view.getInt32(field_offset + 4, true), ulong_val.high); break;
|
||||
case 7: assert.strictEqual(view.getBigInt64(field_offset, true), long_val); break;
|
||||
case 8: assert.strictEqual(view.getBigUint64(field_offset, true), ulong_val); break;
|
||||
case 9: assert.strictEqual(view.getFloat32(field_offset, true), float_val); break;
|
||||
case 10: assert.strictEqual(view.getFloat64(field_offset, true), double_val); break;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ npm install
|
||||
../flatc.exe --ts --gen-name-strings --gen-mutable --gen-object-api -I include_test monster_test.fbs
|
||||
../flatc.exe --gen-object-api -b -I include_test monster_test.fbs unicode_test.json
|
||||
../flatc.exe --ts --gen-name-strings --gen-mutable --gen-object-api -o union_vector union_vector/union_vector.fbs
|
||||
../flatc.exe --ts --gen-name-strings optional_scalars.fbs
|
||||
tsc
|
||||
node -r esm JavaScriptTest
|
||||
node -r esm JavaScriptUnionVectorTest
|
||||
|
||||
@@ -24,6 +24,7 @@ if [ -x ../flatc ]; then
|
||||
../flatc --ts --gen-name-strings --gen-mutable --gen-object-api -I include_test monster_test.fbs
|
||||
../flatc --gen-object-api -b -I include_test monster_test.fbs unicode_test.json
|
||||
../flatc --ts --gen-name-strings --gen-mutable --gen-object-api -o union_vector union_vector/union_vector.fbs
|
||||
../flatc --ts --gen-name-strings optional_scalars.fbs
|
||||
fi
|
||||
tsc
|
||||
node -r esm JavaScriptTest
|
||||
|
||||
@@ -184,7 +184,7 @@ export class Monster {
|
||||
}
|
||||
testhashs64Fnv1() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 40);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
mutate_testhashs64_fnv1(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 40);
|
||||
@@ -196,7 +196,7 @@ export class Monster {
|
||||
}
|
||||
testhashu64Fnv1() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 42);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
mutate_testhashu64_fnv1(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 42);
|
||||
@@ -232,7 +232,7 @@ export class Monster {
|
||||
}
|
||||
testhashs64Fnv1a() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 48);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
mutate_testhashs64_fnv1a(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 48);
|
||||
@@ -244,7 +244,7 @@ export class Monster {
|
||||
}
|
||||
testhashu64Fnv1a() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 50);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
mutate_testhashu64_fnv1a(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 50);
|
||||
@@ -340,7 +340,7 @@ export class Monster {
|
||||
}
|
||||
vectorOfLongs(index) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 68);
|
||||
return offset ? this.bb.readInt64(this.bb.__vector(this.bb_pos + offset) + index * 8) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readInt64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
|
||||
}
|
||||
vectorOfLongsLength() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 68);
|
||||
@@ -372,7 +372,7 @@ export class Monster {
|
||||
}
|
||||
singleWeakReference() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 76);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
mutate_single_weak_reference(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 76);
|
||||
@@ -384,7 +384,7 @@ export class Monster {
|
||||
}
|
||||
vectorOfWeakReferences(index) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 78);
|
||||
return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
|
||||
}
|
||||
vectorOfWeakReferencesLength() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 78);
|
||||
@@ -400,7 +400,7 @@ export class Monster {
|
||||
}
|
||||
coOwningReference() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 82);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
mutate_co_owning_reference(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 82);
|
||||
@@ -412,7 +412,7 @@ export class Monster {
|
||||
}
|
||||
vectorOfCoOwningReferences(index) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 84);
|
||||
return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
|
||||
}
|
||||
vectorOfCoOwningReferencesLength() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 84);
|
||||
@@ -420,7 +420,7 @@ export class Monster {
|
||||
}
|
||||
nonOwningReference() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 86);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
mutate_non_owning_reference(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 86);
|
||||
@@ -432,7 +432,7 @@ export class Monster {
|
||||
}
|
||||
vectorOfNonOwningReferences(index) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 88);
|
||||
return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
|
||||
}
|
||||
vectorOfNonOwningReferencesLength() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 88);
|
||||
@@ -599,10 +599,10 @@ export class Monster {
|
||||
builder.addFieldInt32(17, testhashu32Fnv1, 0);
|
||||
}
|
||||
static addTesthashs64Fnv1(builder, testhashs64Fnv1) {
|
||||
builder.addFieldInt64(18, testhashs64Fnv1, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(18, testhashs64Fnv1, BigInt('0'));
|
||||
}
|
||||
static addTesthashu64Fnv1(builder, testhashu64Fnv1) {
|
||||
builder.addFieldInt64(19, testhashu64Fnv1, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(19, testhashu64Fnv1, BigInt('0'));
|
||||
}
|
||||
static addTesthashs32Fnv1a(builder, testhashs32Fnv1a) {
|
||||
builder.addFieldInt32(20, testhashs32Fnv1a, 0);
|
||||
@@ -611,10 +611,10 @@ export class Monster {
|
||||
builder.addFieldInt32(21, testhashu32Fnv1a, 0);
|
||||
}
|
||||
static addTesthashs64Fnv1a(builder, testhashs64Fnv1a) {
|
||||
builder.addFieldInt64(22, testhashs64Fnv1a, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(22, testhashs64Fnv1a, BigInt('0'));
|
||||
}
|
||||
static addTesthashu64Fnv1a(builder, testhashu64Fnv1a) {
|
||||
builder.addFieldInt64(23, testhashu64Fnv1a, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(23, testhashu64Fnv1a, BigInt('0'));
|
||||
}
|
||||
static addTestarrayofbools(builder, testarrayofboolsOffset) {
|
||||
builder.addFieldOffset(24, testarrayofboolsOffset, 0);
|
||||
@@ -719,7 +719,7 @@ export class Monster {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
static addSingleWeakReference(builder, singleWeakReference) {
|
||||
builder.addFieldInt64(36, singleWeakReference, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(36, singleWeakReference, BigInt('0'));
|
||||
}
|
||||
static addVectorOfWeakReferences(builder, vectorOfWeakReferencesOffset) {
|
||||
builder.addFieldOffset(37, vectorOfWeakReferencesOffset, 0);
|
||||
@@ -748,7 +748,7 @@ export class Monster {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
static addCoOwningReference(builder, coOwningReference) {
|
||||
builder.addFieldInt64(39, coOwningReference, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(39, coOwningReference, BigInt('0'));
|
||||
}
|
||||
static addVectorOfCoOwningReferences(builder, vectorOfCoOwningReferencesOffset) {
|
||||
builder.addFieldOffset(40, vectorOfCoOwningReferencesOffset, 0);
|
||||
@@ -764,7 +764,7 @@ export class Monster {
|
||||
builder.startVector(8, numElems, 8);
|
||||
}
|
||||
static addNonOwningReference(builder, nonOwningReference) {
|
||||
builder.addFieldInt64(41, nonOwningReference, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(41, nonOwningReference, BigInt('0'));
|
||||
}
|
||||
static addVectorOfNonOwningReferences(builder, vectorOfNonOwningReferencesOffset) {
|
||||
builder.addFieldOffset(42, vectorOfNonOwningReferencesOffset, 0);
|
||||
@@ -943,7 +943,7 @@ export class Monster {
|
||||
}
|
||||
}
|
||||
export class MonsterT {
|
||||
constructor(pos = null, mana = 150, hp = 100, name = null, inventory = [], color = Color.Blue, testType = Any.NONE, test = null, test4 = [], testarrayofstring = [], testarrayoftables = [], enemy = null, testnestedflatbuffer = [], testempty = null, testbool = false, testhashs32Fnv1 = 0, testhashu32Fnv1 = 0, testhashs64Fnv1 = flatbuffers.createLong(0, 0), testhashu64Fnv1 = flatbuffers.createLong(0, 0), testhashs32Fnv1a = 0, testhashu32Fnv1a = 0, testhashs64Fnv1a = flatbuffers.createLong(0, 0), testhashu64Fnv1a = flatbuffers.createLong(0, 0), testarrayofbools = [], testf = 3.14159, testf2 = 3.0, testf3 = 0.0, testarrayofstring2 = [], testarrayofsortedstruct = [], flex = [], test5 = [], vectorOfLongs = [], vectorOfDoubles = [], parentNamespaceTest = null, vectorOfReferrables = [], singleWeakReference = flatbuffers.createLong(0, 0), vectorOfWeakReferences = [], vectorOfStrongReferrables = [], coOwningReference = flatbuffers.createLong(0, 0), vectorOfCoOwningReferences = [], nonOwningReference = flatbuffers.createLong(0, 0), vectorOfNonOwningReferences = [], anyUniqueType = AnyUniqueAliases.NONE, anyUnique = null, anyAmbiguousType = AnyAmbiguousAliases.NONE, anyAmbiguous = null, vectorOfEnums = [], signedEnum = Race.None, testrequirednestedflatbuffer = [], scalarKeySortedTables = []) {
|
||||
constructor(pos = null, mana = 150, hp = 100, name = null, inventory = [], color = Color.Blue, testType = Any.NONE, test = null, test4 = [], testarrayofstring = [], testarrayoftables = [], enemy = null, testnestedflatbuffer = [], testempty = null, testbool = false, testhashs32Fnv1 = 0, testhashu32Fnv1 = 0, testhashs64Fnv1 = BigInt('0'), testhashu64Fnv1 = BigInt('0'), testhashs32Fnv1a = 0, testhashu32Fnv1a = 0, testhashs64Fnv1a = BigInt('0'), testhashu64Fnv1a = BigInt('0'), testarrayofbools = [], testf = 3.14159, testf2 = 3.0, testf3 = 0.0, testarrayofstring2 = [], testarrayofsortedstruct = [], flex = [], test5 = [], vectorOfLongs = [], vectorOfDoubles = [], parentNamespaceTest = null, vectorOfReferrables = [], singleWeakReference = BigInt('0'), vectorOfWeakReferences = [], vectorOfStrongReferrables = [], coOwningReference = BigInt('0'), vectorOfCoOwningReferences = [], nonOwningReference = BigInt('0'), vectorOfNonOwningReferences = [], anyUniqueType = AnyUniqueAliases.NONE, anyUnique = null, anyAmbiguousType = AnyAmbiguousAliases.NONE, anyAmbiguous = null, vectorOfEnums = [], signedEnum = Race.None, testrequirednestedflatbuffer = [], scalarKeySortedTables = []) {
|
||||
this.pos = pos;
|
||||
this.mana = mana;
|
||||
this.hp = hp;
|
||||
|
||||
@@ -236,12 +236,12 @@ mutate_testhashu32_fnv1(value:number):boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
testhashs64Fnv1():flatbuffers.Long {
|
||||
testhashs64Fnv1():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 40);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
mutate_testhashs64_fnv1(value:flatbuffers.Long):boolean {
|
||||
mutate_testhashs64_fnv1(value:bigint):boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 40);
|
||||
|
||||
if (offset === 0) {
|
||||
@@ -252,12 +252,12 @@ mutate_testhashs64_fnv1(value:flatbuffers.Long):boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
testhashu64Fnv1():flatbuffers.Long {
|
||||
testhashu64Fnv1():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 42);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
mutate_testhashu64_fnv1(value:flatbuffers.Long):boolean {
|
||||
mutate_testhashu64_fnv1(value:bigint):boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 42);
|
||||
|
||||
if (offset === 0) {
|
||||
@@ -300,12 +300,12 @@ mutate_testhashu32_fnv1a(value:number):boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
testhashs64Fnv1a():flatbuffers.Long {
|
||||
testhashs64Fnv1a():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 48);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
mutate_testhashs64_fnv1a(value:flatbuffers.Long):boolean {
|
||||
mutate_testhashs64_fnv1a(value:bigint):boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 48);
|
||||
|
||||
if (offset === 0) {
|
||||
@@ -316,12 +316,12 @@ mutate_testhashs64_fnv1a(value:flatbuffers.Long):boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
testhashu64Fnv1a():flatbuffers.Long {
|
||||
testhashu64Fnv1a():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 50);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
mutate_testhashu64_fnv1a(value:flatbuffers.Long):boolean {
|
||||
mutate_testhashu64_fnv1a(value:bigint):boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 50);
|
||||
|
||||
if (offset === 0) {
|
||||
@@ -442,9 +442,9 @@ test5Length():number {
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
vectorOfLongs(index: number):flatbuffers.Long|null {
|
||||
vectorOfLongs(index: number):bigint|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 68);
|
||||
return offset ? this.bb!.readInt64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readInt64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
|
||||
}
|
||||
|
||||
vectorOfLongsLength():number {
|
||||
@@ -482,12 +482,12 @@ vectorOfReferrablesLength():number {
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
singleWeakReference():flatbuffers.Long {
|
||||
singleWeakReference():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 76);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
mutate_single_weak_reference(value:flatbuffers.Long):boolean {
|
||||
mutate_single_weak_reference(value:bigint):boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 76);
|
||||
|
||||
if (offset === 0) {
|
||||
@@ -498,9 +498,9 @@ mutate_single_weak_reference(value:flatbuffers.Long):boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
vectorOfWeakReferences(index: number):flatbuffers.Long|null {
|
||||
vectorOfWeakReferences(index: number):bigint|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 78);
|
||||
return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
|
||||
}
|
||||
|
||||
vectorOfWeakReferencesLength():number {
|
||||
@@ -518,12 +518,12 @@ vectorOfStrongReferrablesLength():number {
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
coOwningReference():flatbuffers.Long {
|
||||
coOwningReference():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 82);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
mutate_co_owning_reference(value:flatbuffers.Long):boolean {
|
||||
mutate_co_owning_reference(value:bigint):boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 82);
|
||||
|
||||
if (offset === 0) {
|
||||
@@ -534,9 +534,9 @@ mutate_co_owning_reference(value:flatbuffers.Long):boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
vectorOfCoOwningReferences(index: number):flatbuffers.Long|null {
|
||||
vectorOfCoOwningReferences(index: number):bigint|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 84);
|
||||
return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
|
||||
}
|
||||
|
||||
vectorOfCoOwningReferencesLength():number {
|
||||
@@ -544,12 +544,12 @@ vectorOfCoOwningReferencesLength():number {
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
nonOwningReference():flatbuffers.Long {
|
||||
nonOwningReference():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 86);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
mutate_non_owning_reference(value:flatbuffers.Long):boolean {
|
||||
mutate_non_owning_reference(value:bigint):boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 86);
|
||||
|
||||
if (offset === 0) {
|
||||
@@ -560,9 +560,9 @@ mutate_non_owning_reference(value:flatbuffers.Long):boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
vectorOfNonOwningReferences(index: number):flatbuffers.Long|null {
|
||||
vectorOfNonOwningReferences(index: number):bigint|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 88);
|
||||
return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
|
||||
}
|
||||
|
||||
vectorOfNonOwningReferencesLength():number {
|
||||
@@ -774,12 +774,12 @@ static addTesthashu32Fnv1(builder:flatbuffers.Builder, testhashu32Fnv1:number) {
|
||||
builder.addFieldInt32(17, testhashu32Fnv1, 0);
|
||||
}
|
||||
|
||||
static addTesthashs64Fnv1(builder:flatbuffers.Builder, testhashs64Fnv1:flatbuffers.Long) {
|
||||
builder.addFieldInt64(18, testhashs64Fnv1, builder.createLong(0, 0));
|
||||
static addTesthashs64Fnv1(builder:flatbuffers.Builder, testhashs64Fnv1:bigint) {
|
||||
builder.addFieldInt64(18, testhashs64Fnv1, BigInt('0'));
|
||||
}
|
||||
|
||||
static addTesthashu64Fnv1(builder:flatbuffers.Builder, testhashu64Fnv1:flatbuffers.Long) {
|
||||
builder.addFieldInt64(19, testhashu64Fnv1, builder.createLong(0, 0));
|
||||
static addTesthashu64Fnv1(builder:flatbuffers.Builder, testhashu64Fnv1:bigint) {
|
||||
builder.addFieldInt64(19, testhashu64Fnv1, BigInt('0'));
|
||||
}
|
||||
|
||||
static addTesthashs32Fnv1a(builder:flatbuffers.Builder, testhashs32Fnv1a:number) {
|
||||
@@ -790,12 +790,12 @@ static addTesthashu32Fnv1a(builder:flatbuffers.Builder, testhashu32Fnv1a:number)
|
||||
builder.addFieldInt32(21, testhashu32Fnv1a, 0);
|
||||
}
|
||||
|
||||
static addTesthashs64Fnv1a(builder:flatbuffers.Builder, testhashs64Fnv1a:flatbuffers.Long) {
|
||||
builder.addFieldInt64(22, testhashs64Fnv1a, builder.createLong(0, 0));
|
||||
static addTesthashs64Fnv1a(builder:flatbuffers.Builder, testhashs64Fnv1a:bigint) {
|
||||
builder.addFieldInt64(22, testhashs64Fnv1a, BigInt('0'));
|
||||
}
|
||||
|
||||
static addTesthashu64Fnv1a(builder:flatbuffers.Builder, testhashu64Fnv1a:flatbuffers.Long) {
|
||||
builder.addFieldInt64(23, testhashu64Fnv1a, builder.createLong(0, 0));
|
||||
static addTesthashu64Fnv1a(builder:flatbuffers.Builder, testhashu64Fnv1a:bigint) {
|
||||
builder.addFieldInt64(23, testhashu64Fnv1a, BigInt('0'));
|
||||
}
|
||||
|
||||
static addTestarrayofbools(builder:flatbuffers.Builder, testarrayofboolsOffset:flatbuffers.Offset) {
|
||||
@@ -878,7 +878,7 @@ static addVectorOfLongs(builder:flatbuffers.Builder, vectorOfLongsOffset:flatbuf
|
||||
builder.addFieldOffset(32, vectorOfLongsOffset, 0);
|
||||
}
|
||||
|
||||
static createVectorOfLongsVector(builder:flatbuffers.Builder, data:flatbuffers.Long[]):flatbuffers.Offset {
|
||||
static createVectorOfLongsVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
|
||||
builder.startVector(8, data.length, 8);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addInt64(data[i]!);
|
||||
@@ -931,15 +931,15 @@ static startVectorOfReferrablesVector(builder:flatbuffers.Builder, numElems:numb
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static addSingleWeakReference(builder:flatbuffers.Builder, singleWeakReference:flatbuffers.Long) {
|
||||
builder.addFieldInt64(36, singleWeakReference, builder.createLong(0, 0));
|
||||
static addSingleWeakReference(builder:flatbuffers.Builder, singleWeakReference:bigint) {
|
||||
builder.addFieldInt64(36, singleWeakReference, BigInt('0'));
|
||||
}
|
||||
|
||||
static addVectorOfWeakReferences(builder:flatbuffers.Builder, vectorOfWeakReferencesOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(37, vectorOfWeakReferencesOffset, 0);
|
||||
}
|
||||
|
||||
static createVectorOfWeakReferencesVector(builder:flatbuffers.Builder, data:flatbuffers.Long[]):flatbuffers.Offset {
|
||||
static createVectorOfWeakReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
|
||||
builder.startVector(8, data.length, 8);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addInt64(data[i]!);
|
||||
@@ -967,15 +967,15 @@ static startVectorOfStrongReferrablesVector(builder:flatbuffers.Builder, numElem
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static addCoOwningReference(builder:flatbuffers.Builder, coOwningReference:flatbuffers.Long) {
|
||||
builder.addFieldInt64(39, coOwningReference, builder.createLong(0, 0));
|
||||
static addCoOwningReference(builder:flatbuffers.Builder, coOwningReference:bigint) {
|
||||
builder.addFieldInt64(39, coOwningReference, BigInt('0'));
|
||||
}
|
||||
|
||||
static addVectorOfCoOwningReferences(builder:flatbuffers.Builder, vectorOfCoOwningReferencesOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(40, vectorOfCoOwningReferencesOffset, 0);
|
||||
}
|
||||
|
||||
static createVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, data:flatbuffers.Long[]):flatbuffers.Offset {
|
||||
static createVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
|
||||
builder.startVector(8, data.length, 8);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addInt64(data[i]!);
|
||||
@@ -987,15 +987,15 @@ static startVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, numEle
|
||||
builder.startVector(8, numElems, 8);
|
||||
}
|
||||
|
||||
static addNonOwningReference(builder:flatbuffers.Builder, nonOwningReference:flatbuffers.Long) {
|
||||
builder.addFieldInt64(41, nonOwningReference, builder.createLong(0, 0));
|
||||
static addNonOwningReference(builder:flatbuffers.Builder, nonOwningReference:bigint) {
|
||||
builder.addFieldInt64(41, nonOwningReference, BigInt('0'));
|
||||
}
|
||||
|
||||
static addVectorOfNonOwningReferences(builder:flatbuffers.Builder, vectorOfNonOwningReferencesOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(42, vectorOfNonOwningReferencesOffset, 0);
|
||||
}
|
||||
|
||||
static createVectorOfNonOwningReferencesVector(builder:flatbuffers.Builder, data:flatbuffers.Long[]):flatbuffers.Offset {
|
||||
static createVectorOfNonOwningReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
|
||||
builder.startVector(8, data.length, 8);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addInt64(data[i]!);
|
||||
@@ -1251,12 +1251,12 @@ constructor(
|
||||
public testbool: boolean = false,
|
||||
public testhashs32Fnv1: number = 0,
|
||||
public testhashu32Fnv1: number = 0,
|
||||
public testhashs64Fnv1: flatbuffers.Long = flatbuffers.createLong(0, 0),
|
||||
public testhashu64Fnv1: flatbuffers.Long = flatbuffers.createLong(0, 0),
|
||||
public testhashs64Fnv1: bigint = BigInt('0'),
|
||||
public testhashu64Fnv1: bigint = BigInt('0'),
|
||||
public testhashs32Fnv1a: number = 0,
|
||||
public testhashu32Fnv1a: number = 0,
|
||||
public testhashs64Fnv1a: flatbuffers.Long = flatbuffers.createLong(0, 0),
|
||||
public testhashu64Fnv1a: flatbuffers.Long = flatbuffers.createLong(0, 0),
|
||||
public testhashs64Fnv1a: bigint = BigInt('0'),
|
||||
public testhashu64Fnv1a: bigint = BigInt('0'),
|
||||
public testarrayofbools: (boolean)[] = [],
|
||||
public testf: number = 3.14159,
|
||||
public testf2: number = 3.0,
|
||||
@@ -1265,17 +1265,17 @@ constructor(
|
||||
public testarrayofsortedstruct: (AbilityT)[] = [],
|
||||
public flex: (number)[] = [],
|
||||
public test5: (TestT)[] = [],
|
||||
public vectorOfLongs: (flatbuffers.Long)[] = [],
|
||||
public vectorOfLongs: (bigint)[] = [],
|
||||
public vectorOfDoubles: (number)[] = [],
|
||||
public parentNamespaceTest: InParentNamespaceT|null = null,
|
||||
public vectorOfReferrables: (ReferrableT)[] = [],
|
||||
public singleWeakReference: flatbuffers.Long = flatbuffers.createLong(0, 0),
|
||||
public vectorOfWeakReferences: (flatbuffers.Long)[] = [],
|
||||
public singleWeakReference: bigint = BigInt('0'),
|
||||
public vectorOfWeakReferences: (bigint)[] = [],
|
||||
public vectorOfStrongReferrables: (ReferrableT)[] = [],
|
||||
public coOwningReference: flatbuffers.Long = flatbuffers.createLong(0, 0),
|
||||
public vectorOfCoOwningReferences: (flatbuffers.Long)[] = [],
|
||||
public nonOwningReference: flatbuffers.Long = flatbuffers.createLong(0, 0),
|
||||
public vectorOfNonOwningReferences: (flatbuffers.Long)[] = [],
|
||||
public coOwningReference: bigint = BigInt('0'),
|
||||
public vectorOfCoOwningReferences: (bigint)[] = [],
|
||||
public nonOwningReference: bigint = BigInt('0'),
|
||||
public vectorOfNonOwningReferences: (bigint)[] = [],
|
||||
public anyUniqueType: AnyUniqueAliases = AnyUniqueAliases.NONE,
|
||||
public anyUnique: MonsterT|MyGameExample2MonsterT|TestSimpleTableWithEnumT|null = null,
|
||||
public anyAmbiguousType: AnyAmbiguousAliases = AnyAmbiguousAliases.NONE,
|
||||
|
||||
@@ -19,7 +19,7 @@ export class Referrable {
|
||||
}
|
||||
id() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
mutate_id(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
@@ -36,7 +36,7 @@ export class Referrable {
|
||||
builder.startObject(1);
|
||||
}
|
||||
static addId(builder, id) {
|
||||
builder.addFieldInt64(0, id, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(0, id, BigInt('0'));
|
||||
}
|
||||
static endReferrable(builder) {
|
||||
const offset = builder.endObject();
|
||||
@@ -61,7 +61,7 @@ export class Referrable {
|
||||
}
|
||||
}
|
||||
export class ReferrableT {
|
||||
constructor(id = flatbuffers.createLong(0, 0)) {
|
||||
constructor(id = BigInt('0')) {
|
||||
this.id = id;
|
||||
}
|
||||
pack(builder) {
|
||||
|
||||
@@ -22,12 +22,12 @@ static getSizePrefixedRootAsReferrable(bb:flatbuffers.ByteBuffer, obj?:Referrabl
|
||||
return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
id():flatbuffers.Long {
|
||||
id():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
mutate_id(value:flatbuffers.Long):boolean {
|
||||
mutate_id(value:bigint):boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
|
||||
if (offset === 0) {
|
||||
@@ -46,8 +46,8 @@ static startReferrable(builder:flatbuffers.Builder) {
|
||||
builder.startObject(1);
|
||||
}
|
||||
|
||||
static addId(builder:flatbuffers.Builder, id:flatbuffers.Long) {
|
||||
builder.addFieldInt64(0, id, builder.createLong(0, 0));
|
||||
static addId(builder:flatbuffers.Builder, id:bigint) {
|
||||
builder.addFieldInt64(0, id, BigInt('0'));
|
||||
}
|
||||
|
||||
static endReferrable(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
@@ -55,7 +55,7 @@ static endReferrable(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createReferrable(builder:flatbuffers.Builder, id:flatbuffers.Long):flatbuffers.Offset {
|
||||
static createReferrable(builder:flatbuffers.Builder, id:bigint):flatbuffers.Offset {
|
||||
Referrable.startReferrable(builder);
|
||||
Referrable.addId(builder, id);
|
||||
return Referrable.endReferrable(builder);
|
||||
@@ -83,7 +83,7 @@ unpackTo(_o: ReferrableT): void {
|
||||
|
||||
export class ReferrableT {
|
||||
constructor(
|
||||
public id: flatbuffers.Long = flatbuffers.createLong(0, 0)
|
||||
public id: bigint = BigInt('0')
|
||||
){}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export class Stat {
|
||||
}
|
||||
val() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
mutate_val(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 6);
|
||||
@@ -55,7 +55,7 @@ export class Stat {
|
||||
builder.addFieldOffset(0, idOffset, 0);
|
||||
}
|
||||
static addVal(builder, val) {
|
||||
builder.addFieldInt64(1, val, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(1, val, BigInt('0'));
|
||||
}
|
||||
static addCount(builder, count) {
|
||||
builder.addFieldInt16(2, count, 0);
|
||||
@@ -87,7 +87,7 @@ export class Stat {
|
||||
}
|
||||
}
|
||||
export class StatT {
|
||||
constructor(id = null, val = flatbuffers.createLong(0, 0), count = 0) {
|
||||
constructor(id = null, val = BigInt('0'), count = 0) {
|
||||
this.id = id;
|
||||
this.val = val;
|
||||
this.count = count;
|
||||
|
||||
@@ -29,12 +29,12 @@ id(optionalEncoding?:any):string|Uint8Array|null {
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
val():flatbuffers.Long {
|
||||
val():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
mutate_val(value:flatbuffers.Long):boolean {
|
||||
mutate_val(value:bigint):boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
|
||||
if (offset === 0) {
|
||||
@@ -73,8 +73,8 @@ static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, idOffset, 0);
|
||||
}
|
||||
|
||||
static addVal(builder:flatbuffers.Builder, val:flatbuffers.Long) {
|
||||
builder.addFieldInt64(1, val, builder.createLong(0, 0));
|
||||
static addVal(builder:flatbuffers.Builder, val:bigint) {
|
||||
builder.addFieldInt64(1, val, BigInt('0'));
|
||||
}
|
||||
|
||||
static addCount(builder:flatbuffers.Builder, count:number) {
|
||||
@@ -86,7 +86,7 @@ static endStat(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createStat(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, val:flatbuffers.Long, count:number):flatbuffers.Offset {
|
||||
static createStat(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, val:bigint, count:number):flatbuffers.Offset {
|
||||
Stat.startStat(builder);
|
||||
Stat.addId(builder, idOffset);
|
||||
Stat.addVal(builder, val);
|
||||
@@ -121,7 +121,7 @@ unpackTo(_o: StatT): void {
|
||||
export class StatT {
|
||||
constructor(
|
||||
public id: string|Uint8Array|null = null,
|
||||
public val: flatbuffers.Long = flatbuffers.createLong(0, 0),
|
||||
public val: bigint = BigInt('0'),
|
||||
public count: number = 0
|
||||
){}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ export class TypeAliases {
|
||||
}
|
||||
i64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 16);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
mutate_i64(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 16);
|
||||
@@ -103,7 +103,7 @@ export class TypeAliases {
|
||||
}
|
||||
u64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 18);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
mutate_u64(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 18);
|
||||
@@ -186,10 +186,10 @@ export class TypeAliases {
|
||||
builder.addFieldInt32(5, u32, 0);
|
||||
}
|
||||
static addI64(builder, i64) {
|
||||
builder.addFieldInt64(6, i64, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(6, i64, BigInt('0'));
|
||||
}
|
||||
static addU64(builder, u64) {
|
||||
builder.addFieldInt64(7, u64, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(7, u64, BigInt('0'));
|
||||
}
|
||||
static addF32(builder, f32) {
|
||||
builder.addFieldFloat32(8, f32, 0.0);
|
||||
@@ -268,7 +268,7 @@ export class TypeAliases {
|
||||
}
|
||||
}
|
||||
export class TypeAliasesT {
|
||||
constructor(i8 = 0, u8 = 0, i16 = 0, u16 = 0, i32 = 0, u32 = 0, i64 = flatbuffers.createLong(0, 0), u64 = flatbuffers.createLong(0, 0), f32 = 0.0, f64 = 0.0, v8 = [], vf64 = []) {
|
||||
constructor(i8 = 0, u8 = 0, i16 = 0, u16 = 0, i32 = 0, u32 = 0, i64 = BigInt('0'), u64 = BigInt('0'), f32 = 0.0, f64 = 0.0, v8 = [], vf64 = []) {
|
||||
this.i8 = i8;
|
||||
this.u8 = u8;
|
||||
this.i16 = i16;
|
||||
|
||||
@@ -118,12 +118,12 @@ mutate_u32(value:number):boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
i64():flatbuffers.Long {
|
||||
i64():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 16);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
mutate_i64(value:flatbuffers.Long):boolean {
|
||||
mutate_i64(value:bigint):boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 16);
|
||||
|
||||
if (offset === 0) {
|
||||
@@ -134,12 +134,12 @@ mutate_i64(value:flatbuffers.Long):boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
u64():flatbuffers.Long {
|
||||
u64():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 18);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
mutate_u64(value:flatbuffers.Long):boolean {
|
||||
mutate_u64(value:bigint):boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 18);
|
||||
|
||||
if (offset === 0) {
|
||||
@@ -244,12 +244,12 @@ static addU32(builder:flatbuffers.Builder, u32:number) {
|
||||
builder.addFieldInt32(5, u32, 0);
|
||||
}
|
||||
|
||||
static addI64(builder:flatbuffers.Builder, i64:flatbuffers.Long) {
|
||||
builder.addFieldInt64(6, i64, builder.createLong(0, 0));
|
||||
static addI64(builder:flatbuffers.Builder, i64:bigint) {
|
||||
builder.addFieldInt64(6, i64, BigInt('0'));
|
||||
}
|
||||
|
||||
static addU64(builder:flatbuffers.Builder, u64:flatbuffers.Long) {
|
||||
builder.addFieldInt64(7, u64, builder.createLong(0, 0));
|
||||
static addU64(builder:flatbuffers.Builder, u64:bigint) {
|
||||
builder.addFieldInt64(7, u64, BigInt('0'));
|
||||
}
|
||||
|
||||
static addF32(builder:flatbuffers.Builder, f32:number) {
|
||||
@@ -307,7 +307,7 @@ static endTypeAliases(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createTypeAliases(builder:flatbuffers.Builder, i8:number, u8:number, i16:number, u16:number, i32:number, u32:number, i64:flatbuffers.Long, u64:flatbuffers.Long, f32:number, f64:number, v8Offset:flatbuffers.Offset, vf64Offset:flatbuffers.Offset):flatbuffers.Offset {
|
||||
static createTypeAliases(builder:flatbuffers.Builder, i8:number, u8:number, i16:number, u16:number, i32:number, u32:number, i64:bigint, u64:bigint, f32:number, f64:number, v8Offset:flatbuffers.Offset, vf64Offset:flatbuffers.Offset):flatbuffers.Offset {
|
||||
TypeAliases.startTypeAliases(builder);
|
||||
TypeAliases.addI8(builder, i8);
|
||||
TypeAliases.addU8(builder, u8);
|
||||
@@ -374,8 +374,8 @@ constructor(
|
||||
public u16: number = 0,
|
||||
public i32: number = 0,
|
||||
public u32: number = 0,
|
||||
public i64: flatbuffers.Long = flatbuffers.createLong(0, 0),
|
||||
public u64: flatbuffers.Long = flatbuffers.createLong(0, 0),
|
||||
public i64: bigint = BigInt('0'),
|
||||
public u64: bigint = BigInt('0'),
|
||||
public f32: number = 0.0,
|
||||
public f64: number = 0.0,
|
||||
public v8: (number)[] = [],
|
||||
|
||||
@@ -95,7 +95,7 @@ export class ScalarStuff {
|
||||
}
|
||||
justI64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 40);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
maybeI64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 42);
|
||||
@@ -103,11 +103,11 @@ export class ScalarStuff {
|
||||
}
|
||||
defaultI64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 44);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(42, 0);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('42');
|
||||
}
|
||||
justU64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 46);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
maybeU64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 48);
|
||||
@@ -115,7 +115,7 @@ export class ScalarStuff {
|
||||
}
|
||||
defaultU64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 50);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : this.bb.createLong(42, 0);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('42');
|
||||
}
|
||||
justF32() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 52);
|
||||
@@ -223,22 +223,22 @@ export class ScalarStuff {
|
||||
builder.addFieldInt32(17, defaultU32, 42);
|
||||
}
|
||||
static addJustI64(builder, justI64) {
|
||||
builder.addFieldInt64(18, justI64, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(18, justI64, BigInt('0'));
|
||||
}
|
||||
static addMaybeI64(builder, maybeI64) {
|
||||
builder.addFieldInt64(19, maybeI64, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(19, maybeI64, BigInt(0));
|
||||
}
|
||||
static addDefaultI64(builder, defaultI64) {
|
||||
builder.addFieldInt64(20, defaultI64, builder.createLong(42, 0));
|
||||
builder.addFieldInt64(20, defaultI64, BigInt('42'));
|
||||
}
|
||||
static addJustU64(builder, justU64) {
|
||||
builder.addFieldInt64(21, justU64, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(21, justU64, BigInt('0'));
|
||||
}
|
||||
static addMaybeU64(builder, maybeU64) {
|
||||
builder.addFieldInt64(22, maybeU64, builder.createLong(0, 0));
|
||||
builder.addFieldInt64(22, maybeU64, BigInt(0));
|
||||
}
|
||||
static addDefaultU64(builder, defaultU64) {
|
||||
builder.addFieldInt64(23, defaultU64, builder.createLong(42, 0));
|
||||
builder.addFieldInt64(23, defaultU64, BigInt('42'));
|
||||
}
|
||||
static addJustF32(builder, justF32) {
|
||||
builder.addFieldFloat32(24, justF32, 0.0);
|
||||
|
||||
@@ -117,34 +117,34 @@ defaultU32():number {
|
||||
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 42;
|
||||
}
|
||||
|
||||
justI64():flatbuffers.Long {
|
||||
justI64():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 40);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
maybeI64():flatbuffers.Long|null {
|
||||
maybeI64():bigint|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 42);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : null;
|
||||
}
|
||||
|
||||
defaultI64():flatbuffers.Long {
|
||||
defaultI64():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 44);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(42, 0);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('42');
|
||||
}
|
||||
|
||||
justU64():flatbuffers.Long {
|
||||
justU64():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 46);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : this.bb!.createLong(0, 0);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
maybeU64():flatbuffers.Long|null {
|
||||
maybeU64():bigint|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 48);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : null;
|
||||
}
|
||||
|
||||
defaultU64():flatbuffers.Long {
|
||||
defaultU64():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 50);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : this.bb!.createLong(42, 0);
|
||||
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('42');
|
||||
}
|
||||
|
||||
justF32():number {
|
||||
@@ -283,28 +283,28 @@ static addDefaultU32(builder:flatbuffers.Builder, defaultU32:number) {
|
||||
builder.addFieldInt32(17, defaultU32, 42);
|
||||
}
|
||||
|
||||
static addJustI64(builder:flatbuffers.Builder, justI64:flatbuffers.Long) {
|
||||
builder.addFieldInt64(18, justI64, builder.createLong(0, 0));
|
||||
static addJustI64(builder:flatbuffers.Builder, justI64:bigint) {
|
||||
builder.addFieldInt64(18, justI64, BigInt('0'));
|
||||
}
|
||||
|
||||
static addMaybeI64(builder:flatbuffers.Builder, maybeI64:flatbuffers.Long) {
|
||||
builder.addFieldInt64(19, maybeI64, builder.createLong(0, 0));
|
||||
static addMaybeI64(builder:flatbuffers.Builder, maybeI64:bigint) {
|
||||
builder.addFieldInt64(19, maybeI64, BigInt(0));
|
||||
}
|
||||
|
||||
static addDefaultI64(builder:flatbuffers.Builder, defaultI64:flatbuffers.Long) {
|
||||
builder.addFieldInt64(20, defaultI64, builder.createLong(42, 0));
|
||||
static addDefaultI64(builder:flatbuffers.Builder, defaultI64:bigint) {
|
||||
builder.addFieldInt64(20, defaultI64, BigInt('42'));
|
||||
}
|
||||
|
||||
static addJustU64(builder:flatbuffers.Builder, justU64:flatbuffers.Long) {
|
||||
builder.addFieldInt64(21, justU64, builder.createLong(0, 0));
|
||||
static addJustU64(builder:flatbuffers.Builder, justU64:bigint) {
|
||||
builder.addFieldInt64(21, justU64, BigInt('0'));
|
||||
}
|
||||
|
||||
static addMaybeU64(builder:flatbuffers.Builder, maybeU64:flatbuffers.Long) {
|
||||
builder.addFieldInt64(22, maybeU64, builder.createLong(0, 0));
|
||||
static addMaybeU64(builder:flatbuffers.Builder, maybeU64:bigint) {
|
||||
builder.addFieldInt64(22, maybeU64, BigInt(0));
|
||||
}
|
||||
|
||||
static addDefaultU64(builder:flatbuffers.Builder, defaultU64:flatbuffers.Long) {
|
||||
builder.addFieldInt64(23, defaultU64, builder.createLong(42, 0));
|
||||
static addDefaultU64(builder:flatbuffers.Builder, defaultU64:bigint) {
|
||||
builder.addFieldInt64(23, defaultU64, BigInt('42'));
|
||||
}
|
||||
|
||||
static addJustF32(builder:flatbuffers.Builder, justF32:number) {
|
||||
@@ -368,7 +368,7 @@ static finishSizePrefixedScalarStuffBuffer(builder:flatbuffers.Builder, offset:f
|
||||
builder.finish(offset, 'NULL', true);
|
||||
}
|
||||
|
||||
static createScalarStuff(builder:flatbuffers.Builder, justI8:number, maybeI8:number|null, defaultI8:number, justU8:number, maybeU8:number|null, defaultU8:number, justI16:number, maybeI16:number|null, defaultI16:number, justU16:number, maybeU16:number|null, defaultU16:number, justI32:number, maybeI32:number|null, defaultI32:number, justU32:number, maybeU32:number|null, defaultU32:number, justI64:flatbuffers.Long, maybeI64:flatbuffers.Long|null, defaultI64:flatbuffers.Long, justU64:flatbuffers.Long, maybeU64:flatbuffers.Long|null, defaultU64:flatbuffers.Long, justF32:number, maybeF32:number|null, defaultF32:number, justF64:number, maybeF64:number|null, defaultF64:number, justBool:boolean, maybeBool:boolean|null, defaultBool:boolean, justEnum:OptionalByte, maybeEnum:OptionalByte|null, defaultEnum:OptionalByte):flatbuffers.Offset {
|
||||
static createScalarStuff(builder:flatbuffers.Builder, justI8:number, maybeI8:number|null, defaultI8:number, justU8:number, maybeU8:number|null, defaultU8:number, justI16:number, maybeI16:number|null, defaultI16:number, justU16:number, maybeU16:number|null, defaultU16:number, justI32:number, maybeI32:number|null, defaultI32:number, justU32:number, maybeU32:number|null, defaultU32:number, justI64:bigint, maybeI64:bigint|null, defaultI64:bigint, justU64:bigint, maybeU64:bigint|null, defaultU64:bigint, justF32:number, maybeF32:number|null, defaultF32:number, justF64:number, maybeF64:number|null, defaultF64:number, justBool:boolean, maybeBool:boolean|null, defaultBool:boolean, justEnum:OptionalByte, maybeEnum:OptionalByte|null, defaultEnum:OptionalByte):flatbuffers.Offset {
|
||||
ScalarStuff.startScalarStuff(builder);
|
||||
ScalarStuff.addJustI8(builder, justI8);
|
||||
if (maybeI8 !== null)
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
export { Attacker, AttackerT } from './attacker';
|
||||
export { BookReader, BookReaderT } from './book-reader';
|
||||
export { Character, unionToCharacter, unionListToCharacter } from './character';
|
||||
export { FallingTub, FallingTubT } from './falling-tub';
|
||||
export { Gadget, unionToGadget, unionListToGadget } from './gadget';
|
||||
export { HandFan, HandFanT } from './hand-fan';
|
||||
export { Movie, MovieT } from './movie';
|
||||
export { Rapunzel, RapunzelT } from './rapunzel';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { ByteBuffer } from "./byte-buffer"
|
||||
import { SIZEOF_SHORT, SIZE_PREFIX_LENGTH, SIZEOF_INT, FILE_IDENTIFIER_LENGTH } from "./constants"
|
||||
import { Offset, IGeneratedObject } from "./types"
|
||||
import { Long } from "./long"
|
||||
|
||||
export class Builder {
|
||||
private bb: ByteBuffer
|
||||
@@ -136,7 +135,7 @@ export class Builder {
|
||||
this.bb.writeInt32(this.space -= 4, value);
|
||||
}
|
||||
|
||||
writeInt64(value: Long): void {
|
||||
writeInt64(value: bigint): void {
|
||||
this.bb.writeInt64(this.space -= 8, value);
|
||||
}
|
||||
|
||||
@@ -179,7 +178,7 @@ export class Builder {
|
||||
* Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
|
||||
* @param value The `int64` to add the the buffer.
|
||||
*/
|
||||
addInt64(value: Long): void {
|
||||
addInt64(value: bigint): void {
|
||||
this.prep(8, 0);
|
||||
this.writeInt64(value);
|
||||
}
|
||||
@@ -223,8 +222,8 @@ export class Builder {
|
||||
}
|
||||
}
|
||||
|
||||
addFieldInt64(voffset: number, value: Long, defaultValue: Long): void {
|
||||
if (this.force_defaults || !value.equals(defaultValue)) {
|
||||
addFieldInt64(voffset: number, value: bigint, defaultValue: bigint): void {
|
||||
if (this.force_defaults || value !== defaultValue) {
|
||||
this.addInt64(value);
|
||||
this.slot(voffset);
|
||||
}
|
||||
@@ -574,13 +573,6 @@ export class Builder {
|
||||
return this.endVector();
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper function to avoid generated code depending on this file directly.
|
||||
*/
|
||||
createLong(low: number, high: number): Long {
|
||||
return Long.create(low, high);
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper function to pack an object
|
||||
*
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { FILE_IDENTIFIER_LENGTH, SIZEOF_INT } from "./constants";
|
||||
import { Long } from "./long";
|
||||
import { int32, isLittleEndian, float32, float64 } from "./utils";
|
||||
import { Offset, Table, IGeneratedObject } from "./types";
|
||||
import { Encoding } from "./encoding";
|
||||
@@ -75,12 +74,12 @@ export class ByteBuffer {
|
||||
return this.readInt32(offset) >>> 0;
|
||||
}
|
||||
|
||||
readInt64(offset: number): Long {
|
||||
return new Long(this.readInt32(offset), this.readInt32(offset + 4));
|
||||
readInt64(offset: number): bigint {
|
||||
return BigInt.asIntN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
|
||||
}
|
||||
|
||||
readUint64(offset: number): Long {
|
||||
return new Long(this.readUint32(offset), this.readUint32(offset + 4));
|
||||
readUint64(offset: number): bigint {
|
||||
return BigInt.asUintN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
|
||||
}
|
||||
|
||||
readFloat32(offset: number): number {
|
||||
@@ -108,8 +107,8 @@ export class ByteBuffer {
|
||||
}
|
||||
|
||||
writeUint16(offset: number, value: number): void {
|
||||
this.bytes_[offset] = value;
|
||||
this.bytes_[offset + 1] = value >> 8;
|
||||
this.bytes_[offset] = value;
|
||||
this.bytes_[offset + 1] = value >> 8;
|
||||
}
|
||||
|
||||
writeInt32(offset: number, value: number): void {
|
||||
@@ -120,20 +119,20 @@ export class ByteBuffer {
|
||||
}
|
||||
|
||||
writeUint32(offset: number, value: number): void {
|
||||
this.bytes_[offset] = value;
|
||||
this.bytes_[offset + 1] = value >> 8;
|
||||
this.bytes_[offset + 2] = value >> 16;
|
||||
this.bytes_[offset + 3] = value >> 24;
|
||||
this.bytes_[offset] = value;
|
||||
this.bytes_[offset + 1] = value >> 8;
|
||||
this.bytes_[offset + 2] = value >> 16;
|
||||
this.bytes_[offset + 3] = value >> 24;
|
||||
}
|
||||
|
||||
writeInt64(offset: number, value: Long): void {
|
||||
this.writeInt32(offset, value.low);
|
||||
this.writeInt32(offset + 4, value.high);
|
||||
writeInt64(offset: number, value: bigint): void {
|
||||
this.writeInt32(offset, Number(BigInt.asIntN(32, value)));
|
||||
this.writeInt32(offset + 4, Number(BigInt.asIntN(32, value >> BigInt(32))));
|
||||
}
|
||||
|
||||
writeUint64(offset: number, value: Long): void {
|
||||
this.writeUint32(offset, value.low);
|
||||
this.writeUint32(offset + 4, value.high);
|
||||
writeUint64(offset: number, value: bigint): void {
|
||||
this.writeUint32(offset, Number(BigInt.asUintN(32, value)));
|
||||
this.writeUint32(offset + 4, Number(BigInt.asUintN(32, value >> BigInt(32))));
|
||||
}
|
||||
|
||||
writeFloat32(offset: number, value: number): void {
|
||||
@@ -301,14 +300,7 @@ export class ByteBuffer {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper function to avoid generated code depending on this file directly.
|
||||
*/
|
||||
createLong(low: number, high: number): Long {
|
||||
return Long.create(low, high);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A helper function for generating list for obj api
|
||||
*/
|
||||
@@ -341,4 +333,4 @@ export class ByteBuffer {
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ export { Table, Offset } from './types'
|
||||
|
||||
export { int32, float32, float64, isLittleEndian } from './utils'
|
||||
|
||||
export { Long, createLong } from './long'
|
||||
export { Encoding } from './encoding'
|
||||
export { Builder } from './builder'
|
||||
export { ByteBuffer } from './byte-buffer'
|
||||
|
||||
@@ -3,15 +3,13 @@ import { toByteWidth, fromByteWidth } from './bit-width-util'
|
||||
import { toUTF8Array, fromUTF8Array } from './flexbuffers-util'
|
||||
import { Reference } from './reference'
|
||||
|
||||
import { Long } from '../long'
|
||||
|
||||
export function validateOffset(dataView: DataView, offset: number, width: number): void {
|
||||
if (dataView.byteLength <= offset + width || (offset & (toByteWidth(width) - 1)) !== 0) {
|
||||
throw "Bad offset: " + offset + ", width: " + width;
|
||||
}
|
||||
}
|
||||
|
||||
export function readInt(dataView: DataView, offset: number, width: number): number | Long | bigint {
|
||||
export function readInt(dataView: DataView, offset: number, width: number): number | bigint {
|
||||
if (width < 2) {
|
||||
if (width < 1) {
|
||||
return dataView.getInt8(offset);
|
||||
@@ -23,14 +21,14 @@ export function readInt(dataView: DataView, offset: number, width: number): numb
|
||||
return dataView.getInt32(offset, true)
|
||||
} else {
|
||||
if (dataView.setBigInt64 === undefined) {
|
||||
return new Long(dataView.getUint32(offset, true), dataView.getUint32(offset + 4, true))
|
||||
return BigInt(dataView.getUint32(offset, true)) + (BigInt(dataView.getUint32(offset + 4, true)) << BigInt(32));
|
||||
}
|
||||
return dataView.getBigInt64(offset, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function readUInt(dataView: DataView, offset: number, width: number): number | Long | bigint {
|
||||
export function readUInt(dataView: DataView, offset: number, width: number): number | bigint {
|
||||
if (width < 2) {
|
||||
if (width < 1) {
|
||||
return dataView.getUint8(offset);
|
||||
@@ -42,7 +40,7 @@ export function readUInt(dataView: DataView, offset: number, width: number): num
|
||||
return dataView.getUint32(offset, true)
|
||||
} else {
|
||||
if (dataView.getBigUint64 === undefined) {
|
||||
return new Long(dataView.getUint32(offset, true), dataView.getUint32(offset + 4, true))
|
||||
return BigInt(dataView.getUint32(offset, true)) + (BigInt(dataView.getUint32(offset + 4, true)) << BigInt(32));
|
||||
}
|
||||
return dataView.getBigUint64(offset, true)
|
||||
}
|
||||
@@ -116,4 +114,4 @@ export function keyForIndex(index: number, dataView: DataView, offset: number, p
|
||||
length++;
|
||||
}
|
||||
return fromUTF8Array(new Uint8Array(dataView.buffer, keyIndirectOffset, length));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { fromByteWidth } from './bit-width-util'
|
||||
import { ValueType } from './value-type'
|
||||
import { isNumber, isIndirectNumber, isAVector, fixedTypedVectorElementSize, isFixedTypedVector, isTypedVector, typedVectorElementType, packedType, fixedTypedVectorElementType } from './value-type-util'
|
||||
import { indirect, keyForIndex, keyIndex, readFloat, readInt, readUInt, valueForIndexWithKey } from './reference-util'
|
||||
import { Long } from '../long';
|
||||
import { fromUTF8Array } from './flexbuffers-util';
|
||||
import { BitWidth } from './bit-width';
|
||||
|
||||
@@ -48,7 +47,7 @@ export class Reference {
|
||||
return null;
|
||||
}
|
||||
|
||||
intValue(): number | Long | bigint | null {
|
||||
intValue(): number | bigint | null {
|
||||
if (this.valueType === ValueType.INT) {
|
||||
return readInt(this.dataView, this.offset, this.parentWidth);
|
||||
}
|
||||
@@ -74,7 +73,7 @@ export class Reference {
|
||||
return null;
|
||||
}
|
||||
|
||||
numericValue(): number | Long | bigint | null { return this.floatValue() || this.intValue()}
|
||||
numericValue(): number | bigint | null { return this.floatValue() || this.intValue()}
|
||||
|
||||
stringValue(): string | null {
|
||||
if (this.valueType === ValueType.STRING || this.valueType === ValueType.KEY) {
|
||||
|
||||
23
ts/long.ts
23
ts/long.ts
@@ -1,23 +0,0 @@
|
||||
export function createLong(low: number, high: number): Long {
|
||||
return Long.create(low, high);
|
||||
}
|
||||
|
||||
export class Long {
|
||||
static readonly ZERO = new Long(0, 0)
|
||||
low: number
|
||||
high: number
|
||||
constructor(low: number, high: number) {
|
||||
this.low = low | 0;
|
||||
this.high = high | 0;
|
||||
}
|
||||
static create(low: number, high: number): Long {
|
||||
// Special-case zero to avoid GC overhead for default values
|
||||
return low == 0 && high == 0 ? Long.ZERO : new Long(low, high);
|
||||
}
|
||||
toFloat64(): number {
|
||||
return (this.low >>> 0) + this.high * 0x100000000;
|
||||
}
|
||||
equals(other: Long): boolean {
|
||||
return this.low == other.low && this.high == other.high;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user