(accessor: string, assignStmt: (expr: string) => string)
| 130 | } |
| 131 | |
| 132 | writeRefOrNull(accessor: string, assignStmt: (expr: string) => string) { |
| 133 | let refFlagStmt = ""; |
| 134 | if (this.needToWriteRef()) { |
| 135 | const existsId = this.scope.uniqueName("existsId"); |
| 136 | refFlagStmt = ` |
| 137 | const ${existsId} = ${this.builder.referenceResolver.getWrittenRefId(accessor)}; |
| 138 | if (typeof ${existsId} === "number") { |
| 139 | ${this.builder.writer.writeInt8(RefFlags.RefFlag)} |
| 140 | ${this.builder.writer.writeVarUInt32(existsId)} |
| 141 | ${assignStmt("true")}; |
| 142 | } else { |
| 143 | ${this.builder.writer.writeInt8(RefFlags.RefValueFlag)} |
| 144 | ${this.builder.referenceResolver.writeRef(accessor)} |
| 145 | } |
| 146 | `; |
| 147 | } else { |
| 148 | refFlagStmt = this.builder.writer.writeInt8(RefFlags.NotNullValueFlag); |
| 149 | } |
| 150 | return ` |
| 151 | if (${accessor} === null || ${accessor} === undefined) { |
| 152 | ${this.builder.writer.writeInt8(RefFlags.NullFlag)}; |
| 153 | ${assignStmt("true")}; |
| 154 | } else { |
| 155 | ${refFlagStmt} |
| 156 | } |
| 157 | `; |
| 158 | } |
| 159 | |
| 160 | writeTypeInfo(accessor: string) { |
| 161 | void accessor; |
nothing calls this directly
no test coverage detected