(accessor: string)
| 462 | } |
| 463 | |
| 464 | write(accessor: string): string { |
| 465 | const anySerializer = this.builder.getExternal(MapAnySerializer.name); |
| 466 | if (!this.isAny()) { |
| 467 | return this.writeSpecificType(accessor); |
| 468 | } |
| 469 | const innerSerializer = (innerTypeInfo: TypeInfo) => { |
| 470 | return this.scope.declare( |
| 471 | "map_inner_ser", |
| 472 | TypeId.isNamedType(innerTypeInfo.typeId) |
| 473 | ? this.builder.typeResolver.getSerializerByName( |
| 474 | CodecBuilder.replaceBackslashAndQuote(innerTypeInfo.named!), |
| 475 | ) |
| 476 | : this.builder.typeResolver.getSerializerById( |
| 477 | innerTypeInfo.typeId, |
| 478 | innerTypeInfo.userTypeId, |
| 479 | ), |
| 480 | ); |
| 481 | }; |
| 482 | return `new (${anySerializer})(${this.builder.getWriteContextName()}, ${this.builder.getReadContextName()}, ${ |
| 483 | this.typeInfo.options!.key!.typeId !== TypeId.UNKNOWN |
| 484 | ? innerSerializer(this.typeInfo.options!.key!) |
| 485 | : null |
| 486 | }, ${ |
| 487 | this.typeInfo.options!.value!.typeId !== TypeId.UNKNOWN |
| 488 | ? innerSerializer(this.typeInfo.options!.value!) |
| 489 | : null |
| 490 | }).write(${accessor})`; |
| 491 | } |
| 492 | |
| 493 | private readSpecificType( |
| 494 | accessor: (expr: string) => string, |
nothing calls this directly
no test coverage detected