chaokunyang commented on code in PR #3394:
URL: https://github.com/apache/fory/pull/3394#discussion_r3044316494
##########
javascript/packages/core/lib/gen/struct.ts:
##########
@@ -326,13 +437,13 @@ class StructSerializerGenerator extends
BaseSerializerGenerator {
let writeUserTypeIdStmt = "";
switch (internalTypeId) {
case TypeId.STRUCT:
- writeUserTypeIdStmt =
this.builder.writer.writeVarUint32Small7(this.typeInfo.userTypeId);
+ writeUserTypeIdStmt =
this.builder.writer.writeVarUInt32(this.typeInfo.userTypeId);
break;
case TypeId.NAMED_COMPATIBLE_STRUCT:
case TypeId.COMPATIBLE_STRUCT:
{
const bytes = this.scope.declare("typeInfoBytes", `new
Uint8Array([${TypeMeta.fromTypeInfo(this.typeInfo).toBytes().join(",")}])`);
- typeMeta =
this.builder.typeMetaResolver.writeTypeMeta(this.builder.getTypeInfo(),
this.builder.writer.ownName(), bytes);
+ typeMeta =
this.builder.typeMetaResolver.writeTypeMeta(this.ownTypeInfoExpr,
this.builder.writer.ownName(), bytes);
Review Comment:
The constructor already computes this.ownTypeInfoExpr. Extract a single
serializerExpr string field in the constructor
and reuse it everywhere.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]