Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions javascript/packages/fory/lib/fory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default class {
this.binaryReader.reset(bytes);
this.typeMetaResolver.reset();
this.metaStringResolver.reset();
const bitmap = this.binaryReader.uint8();
const bitmap = this.binaryReader.readUint8();
if ((bitmap & ConfigFlags.isNullFlag) === ConfigFlags.isNullFlag) {
return null;
}
Expand Down Expand Up @@ -177,7 +177,7 @@ export default class {
bitmap |= ConfigFlags.isNullFlag;
}
bitmap |= ConfigFlags.isCrossLanguageFlag;
this.binaryWriter.uint8(bitmap);
this.binaryWriter.writeUint8(bitmap);
// reserve fixed size
this.binaryWriter.reserve(serializer.fixedSize);
// start write
Expand Down
2 changes: 1 addition & 1 deletion javascript/packages/fory/lib/gen/any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { TypeMeta } from "../meta/TypeMeta";

export class AnyHelper {
static detectSerializer(fory: Fory) {
const typeId = fory.binaryReader.uint8();
const typeId = fory.binaryReader.readUint8();
let userTypeId = -1;
if (TypeId.needsUserTypeId(typeId) && typeId !== TypeId.COMPATIBLE_STRUCT) {
userTypeId = fory.binaryReader.readVarUint32Small7();
Expand Down
4 changes: 2 additions & 2 deletions javascript/packages/fory/lib/gen/bool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class BoolSerializerGenerator extends BaseSerializerGenerator {
}

write(accessor: string): string {
return this.builder.writer.uint8(`${accessor} ? 1 : 0`);
return this.builder.writer.writeUint8(`${accessor} ? 1 : 0`);
}

read(accessor: (expr: string) => string): string {
return accessor(`${this.builder.reader.uint8()} === 1`);
return accessor(`${this.builder.reader.readUint8()} === 1`);
}

getFixedSize(): number {
Expand Down
160 changes: 80 additions & 80 deletions javascript/packages/fory/lib/gen/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ export class BinaryReaderBuilder {
return this.holder;
}

getCursor() {
return `${this.holder}.getCursor()`;
readGetCursor() {
return `${this.holder}.readGetCursor()`;
}

setCursor(v: number | string) {
return `${this.holder}.setCursor(${v})`;
readSetCursor(v: number | string) {
return `${this.holder}.readSetCursor(${v})`;
}

varInt32() {
return `${this.holder}.varInt32()`;
readVarInt32() {
return `${this.holder}.readVarInt32()`;
}

readTaggedInt64() {
Expand All @@ -59,20 +59,20 @@ export class BinaryReaderBuilder {
return `${this.holder}.readTaggedUInt64()`;
}

varInt64() {
return `${this.holder}.varInt64()`;
readVarInt64() {
return `${this.holder}.readVarInt64()`;
}

varUInt32() {
return `${this.holder}.varUInt32()`;
readVarUInt32() {
return `${this.holder}.readVarUInt32()`;
}

varUInt64() {
return `${this.holder}.varUInt64()`;
readVarUInt64() {
return `${this.holder}.readVarUInt64()`;
}

int8() {
return `${this.holder}.int8()`;
readInt8() {
return `${this.holder}.readInt8()`;
}

buffer(len: string | number) {
Expand All @@ -83,8 +83,8 @@ export class BinaryReaderBuilder {
return `${this.holder}.bufferRef(${len})`;
}

uint8() {
return `${this.holder}.uint8()`;
readUint8() {
return `${this.holder}.readUint8()`;
}

stringUtf8At() {
Expand All @@ -103,56 +103,56 @@ export class BinaryReaderBuilder {
return `${this.holder}.stringWithHeader()`;
}

float64() {
return `${this.holder}.float64()`;
readFloat64() {
return `${this.holder}.readFloat64()`;
}

float32() {
return `${this.holder}.float32()`;
readFloat32() {
return `${this.holder}.readFloat32()`;
}

float16() {
return `${this.holder}.float16()`;
readFloat16() {
return `${this.holder}.readFloat16()`;
}

bfloat16() {
return `${this.holder}.bfloat16()`;
readBfloat16() {
return `${this.holder}.readBfloat16()`;
}

uint16() {
return `${this.holder}.uint16()`;
readUint16() {
return `${this.holder}.readUint16()`;
}

int16() {
return `${this.holder}.int16()`;
readInt16() {
return `${this.holder}.readInt16()`;
}

readVarUint32Small7() {
return `${this.holder}.readVarUint32Small7()`;
}

uint64() {
return `${this.holder}.uint64()`;
readUint64() {
return `${this.holder}.readUint64()`;
}

skip(v: number) {
return `${this.holder}.skip(${v})`;
readSkip(v: number) {
return `${this.holder}.readSkip(${v})`;
}

int64() {
return `${this.holder}.int64()`;
readInt64() {
return `${this.holder}.readInt64()`;
}

sliInt64() {
return `${this.holder}.sliInt64()`;
readSliInt64() {
return `${this.holder}.readSliInt64()`;
}

uint32() {
return `${this.holder}.uint32()`;
readUint32() {
return `${this.holder}.readUint32()`;
}

int32() {
return `${this.holder}.int32()`;
readInt32() {
return `${this.holder}.readInt32()`;
}
}

Expand All @@ -165,8 +165,8 @@ class BinaryWriterBuilder {
return this.holder;
}

skip(v: number | string) {
return `${this.holder}.skip(${v})`;
writeSkip(v: number | string) {
return `${this.holder}.writeSkip(${v})`;
}

getByteLen() {
Expand All @@ -185,40 +185,40 @@ class BinaryWriterBuilder {
return `${this.holder}.arrayBuffer(${buffer}, ${byteOffset}, ${byteLength})`;
}

uint16(v: number | string) {
return `${this.holder}.uint16(${v})`;
writeUint16(v: number | string) {
return `${this.holder}.writeUint16(${v})`;
}

int8(v: number | string) {
return `${this.holder}.int8(${v})`;
writeInt8(v: number | string) {
return `${this.holder}.writeInt8(${v})`;
}

int24(v: number | string) {
return `${this.holder}.int24(${v})`;
writeInt24(v: number | string) {
return `${this.holder}.writeInt24(${v})`;
}

uint8(v: number | string) {
return `${this.holder}.uint8(${v})`;
writeUint8(v: number | string) {
return `${this.holder}.writeUint8(${v})`;
}

int16(v: number | string) {
return `${this.holder}.int16(${v})`;
writeInt16(v: number | string) {
return `${this.holder}.writeInt16(${v})`;
}

varInt32(v: number | string) {
return `${this.holder}.varInt32(${v})`;
writeVarInt32(v: number | string) {
return `${this.holder}.writeVarInt32(${v})`;
}

writeVarUint32Small7(v: number | string) {
return `${this.holder}.writeVarUint32Small7(${v})`;
}

varUInt32(v: number | string) {
return `${this.holder}.varUInt32(${v})`;
writeVarUInt32(v: number | string) {
return `${this.holder}.writeVarUInt32(${v})`;
}

varUInt64(v: number | string) {
return `${this.holder}.varUInt64(${v})`;
writeVarUInt64(v: number | string) {
return `${this.holder}.writeVarUInt64(${v})`;
}

writeTaggedInt64(v: number | string) {
Expand All @@ -229,8 +229,8 @@ class BinaryWriterBuilder {
return `${this.holder}.writeTaggedUInt64(${v})`;
}

varInt64(v: number | string) {
return `${this.holder}.varInt64(${v})`;
writeVarInt64(v: number | string) {
return `${this.holder}.writeVarInt64(${v})`;
}

stringWithHeader(str: string) {
Expand All @@ -241,48 +241,48 @@ class BinaryWriterBuilder {
return `${this.holder}.bufferWithoutMemCheck(${v})`;
}

uint64(v: number | string) {
return `${this.holder}.uint64(${v})`;
writeUint64(v: number | string) {
return `${this.holder}.writeUint64(${v})`;
}

buffer(v: string) { // Accepting Uint8Array as a parameter
return `${this.holder}.buffer(${v})`;
}

float64(v: number | string) {
return `${this.holder}.float64(${v})`;
writeFloat64(v: number | string) {
return `${this.holder}.writeFloat64(${v})`;
}

float32(v: number | string) {
return `${this.holder}.float32(${v})`;
writeFloat32(v: number | string) {
return `${this.holder}.writeFloat32(${v})`;
}

float16(v: number | string) {
return `${this.holder}.float16(${v})`;
writeFloat16(v: number | string) {
return `${this.holder}.writeFloat16(${v})`;
}

bfloat16(v: number | string) {
return `${this.holder}.bfloat16(${v})`;
writeBfloat16(v: number | string) {
return `${this.holder}.writeBfloat16(${v})`;
}

int64(v: number | string) {
return `${this.holder}.int64(${v})`;
writeInt64(v: number | string) {
return `${this.holder}.writeInt64(${v})`;
}

sliInt64(v: number | string) {
return `${this.holder}.sliInt64(${v})`;
writeSliInt64(v: number | string) {
return `${this.holder}.writeSliInt64(${v})`;
}

uint32(v: number | string) {
return `${this.holder}.uint32(${v})`;
writeUint32(v: number | string) {
return `${this.holder}.writeUint32(${v})`;
}

int32(v: number | string) {
return `${this.holder}.int32(${v})`;
writeInt32(v: number | string) {
return `${this.holder}.writeInt32(${v})`;
}

getCursor() {
return `${this.holder}.getCursor()`;
writeGetCursor() {
return `${this.holder}.writeGetCursor()`;
}

setUint32Position(offset: number | string, v: number | string) {
Expand Down
Loading
Loading