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

Method read

javascript/packages/core/lib/gen/ext.ts:50–67  ·  view source on GitHub ↗
(accessor: (expr: string) => string, refState: string)

Source from the content-addressed store, hash-verified

48 }
49
50 read(accessor: (expr: string) => string, refState: string): string {
51 const result = this.scope.uniqueName("result");
52 return `
53 ${this.typeInfo.options!.withConstructor
54 ? `
55 const ${result} = new ${this.builder.getOptions("creator")}();
56 `
57 : `
58 const ${result} = {};
59 `
60 }
61 ${this.maybeReference(result, refState)}
62 ${this.builder.getOptions("customSerializer")}.read(${this.builder.getReadContextName()}, ${result})
63 ${
64 accessor(result)
65 }
66 `;
67 }
68
69 readNoRef(assignStmt: (v: string) => string, refState: string): string {
70 const result = this.scope.uniqueName("result");

Callers 1

readNoRefMethod · 0.95

Calls 3

uniqueNameMethod · 0.80
getOptionsMethod · 0.80
getReadContextNameMethod · 0.80

Tested by

no test coverage detected