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

Method readNoRef

javascript/packages/core/lib/gen/struct.ts:1020–1062  ·  view source on GitHub ↗
(assignStmt: (v: string) => string, refState: string)

Source from the content-addressed store, hash-verified

1018 }
1019
1020 readNoRef(assignStmt: (v: string) => string, refState: string): string {
1021 const result = this.scope.uniqueName("result");
1022 if (!this.typeInfo.options?.props || Object.keys(this.typeInfo.options.props).length === 0) {
1023 return this.readTypeInfoThen(
1024 changedSerializer => `
1025 ${assignStmt(`${changedSerializer}.read(${refState})`)};
1026 `,
1027 () => `
1028 ${this.builder.getReadContextName()}.incReadDepth();
1029 let ${result} = ${this.serializerExpr}.read(${refState});
1030 ${this.builder.getReadContextName()}.decReadDepth();
1031 ${assignStmt(result)};
1032 `,
1033 true,
1034 );
1035 }
1036 if (this.isDepthFreeStruct()) {
1037 return this.readTypeInfoThen(
1038 changedSerializer => `
1039 ${assignStmt(`${changedSerializer}.read(${refState})`)};
1040 `,
1041 () => `
1042 let ${result};
1043 ${this.read(v => `${result} = ${v}`, refState)};
1044 ${assignStmt(result)};
1045 `,
1046 true,
1047 );
1048 }
1049 return this.readTypeInfoThen(
1050 changedSerializer => `
1051 ${assignStmt(`${changedSerializer}.read(${refState})`)};
1052 `,
1053 () => `
1054 ${this.builder.getReadContextName()}.incReadDepth();
1055 let ${result};
1056 ${this.read(v => `${result} = ${v}`, refState)};
1057 ${this.builder.getReadContextName()}.decReadDepth();
1058 ${assignStmt(result)};
1059 `,
1060 true,
1061 );
1062 }
1063
1064 readTypeInfo(): string {
1065 return this.readTypeInfoThen();

Callers

nothing calls this directly

Calls 6

readTypeInfoThenMethod · 0.95
isDepthFreeStructMethod · 0.95
readMethod · 0.95
uniqueNameMethod · 0.80
getReadContextNameMethod · 0.80
keysMethod · 0.45

Tested by

no test coverage detected