()
| 281 | } |
| 282 | |
| 283 | toSerializer() { |
| 284 | this.scope.assertNameNotDuplicate("read"); |
| 285 | this.scope.assertNameNotDuplicate("readInner"); |
| 286 | this.scope.assertNameNotDuplicate("write"); |
| 287 | this.scope.assertNameNotDuplicate("writeInner"); |
| 288 | this.scope.assertNameNotDuplicate("typeResolver"); |
| 289 | this.scope.assertNameNotDuplicate("external"); |
| 290 | this.scope.assertNameNotDuplicate("options"); |
| 291 | this.scope.assertNameNotDuplicate("typeInfo"); |
| 292 | |
| 293 | const declare = ` |
| 294 | const getHash = () => { |
| 295 | return ${this.getHash()}; |
| 296 | } |
| 297 | const getTypeMetaBytes = () => { |
| 298 | return ${this.getTypeMetaBytes()}; |
| 299 | } |
| 300 | const write = (v) => { |
| 301 | ${this.write("v")} |
| 302 | }; |
| 303 | const writeRef = (v) => { |
| 304 | ${this.writeRef("v")} |
| 305 | }; |
| 306 | const writeNoRef = (v) => { |
| 307 | ${this.writeNoRef("v")} |
| 308 | }; |
| 309 | const writeRefOrNull = (v) => { |
| 310 | ${this.writeRefOrNull("v", expr => `return ${expr};`)} |
| 311 | }; |
| 312 | const writeTypeInfo = (v) => { |
| 313 | ${this.writeTypeInfo("v")} |
| 314 | }; |
| 315 | const read = (fromRef) => { |
| 316 | ${this.read(assignStmt => `return ${assignStmt}`, "fromRef")} |
| 317 | }; |
| 318 | const readRef = () => { |
| 319 | ${this.readRef(assignStmt => `return ${assignStmt}`)} |
| 320 | }; |
| 321 | const readRefWithoutTypeInfo = () => { |
| 322 | ${this.readRefWithoutTypeInfo(assignStmt => `return ${assignStmt}`)} |
| 323 | }; |
| 324 | const readNoRef = (fromRef) => { |
| 325 | ${this.readNoRef(assignStmt => `return ${assignStmt}`, "fromRef")} |
| 326 | }; |
| 327 | const readTypeInfo = () => { |
| 328 | ${this.readTypeInfo()} |
| 329 | }; |
| 330 | `; |
| 331 | return ` |
| 332 | return function (typeResolver, external, typeInfo, options) { |
| 333 | ${this.scope.generate()} |
| 334 | ${declare} |
| 335 | return { |
| 336 | _initialized: true, |
| 337 | fixedSize: ${this.getFixedSize()}, |
| 338 | needToWriteRef: () => ${this.needToWriteRef()}, |
| 339 | getTypeId: () => ${this.getTypeId()}, |
| 340 | getUserTypeId: () => ${this.getUserTypeId()}, |
nothing calls this directly
no test coverage detected