MCPcopy Create free account
hub / github.com/apache/fory / varInt32ObjectReadKind

Function varInt32ObjectReadKind

javascript/packages/core/lib/gen/struct.ts:115–136  ·  view source on GitHub ↗
(
  typeInfo: TypeInfo,
  typeResolver: CodecBuilder["resolver"],
)

Source from the content-addressed store, hash-verified

113}
114
115function varInt32ObjectReadKind(
116 typeInfo: TypeInfo,
117 typeResolver: CodecBuilder["resolver"],
118): "number" | "bigint" | null {
119 if (
120 toRefMode(typeInfo.trackingRef, typeInfo.nullable) !== RefMode.NONE
121 || !typeResolver.isMonomorphic(typeInfo, typeInfo.dynamic)
122 ) {
123 return null;
124 }
125 const scalarAction = getCompatibleScalarReadAction(typeInfo);
126 if (scalarAction !== undefined) {
127 return scalarAction.remoteNullable !== true
128 && scalarAction.remoteTypeId === TypeId.VARINT32
129 && (scalarAction.localTypeId === TypeId.INT64
130 || scalarAction.localTypeId === TypeId.VARINT64
131 || scalarAction.localTypeId === TypeId.TAGGED_INT64)
132 ? "bigint"
133 : null;
134 }
135 return typeInfo.typeId === TypeId.VARINT32 ? "number" : null;
136}
137
138function directNumericFieldReadExpr(
139 typeInfo: TypeInfo,

Callers 2

isDirectVarInt32FieldFunction · 0.85

Calls 3

toRefModeFunction · 0.85
isMonomorphicMethod · 0.45

Tested by

no test coverage detected