Forchapeatl commented on code in PR #1825:
URL: https://github.com/apache/fury/pull/1825#discussion_r1779472755
##########
javascript/packages/fury/lib/gen/object.ts:
##########
@@ -80,11 +70,18 @@ class ObjectSerializerGenerator extends
BaseSerializerGenerator {
writeStmt(accessor: string): string {
const options = this.description.options;
const expectHash = computeStructHash(this.description);
- const metaInformation =
Buffer.from(computeMetaInformation(this.description));
+ // const metaInformation =
Buffer.from(computeMetaInformation(this.description));
+ const fields = Object.entries(this.description).map(([key, value]) => {
+ return new FieldInfo(key, value.type);
+ });
+ const typeMetaBinary = new Uint8Array(TypeMeta.fromFields(256,
fields).toBytes());
+ const typeMetaDeclare = this.scope.declare("typeMeta", `new
Uint8Array([${typeMetaBinary.toString()}])`);
return `
${this.builder.writer.int32(expectHash)};
-
${this.builder.writer.buffer(`Buffer.from("${metaInformation.toString("base64")}",
"base64")`)};
+
+ ${this.builder.writer.buffer(typeMetaDeclare)};
Review Comment:
Hi @theweipeng , My solution is to check the fury modes and write/read`
typeMeta` only when the mode is `compatible` . Problem is every time i try to
log the `fury.config`
```ts
console.log(`${JSON.stringify(this.builder.config)}`);
```
i get undefined .
--
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]