| 25 | import { Scope } from "./scope"; |
| 26 | |
| 27 | function buildNumberSerializer(writeFun: (builder: CodecBuilder, accessor: string) => string, read: (builder: CodecBuilder) => string) { |
| 28 | return class NumberSerializerGenerator extends BaseSerializerGenerator { |
| 29 | typeInfo: TypeInfo; |
| 30 | |
| 31 | constructor(typeInfo: TypeInfo, builder: CodecBuilder, scope: Scope) { |
| 32 | super(typeInfo, builder, scope); |
| 33 | this.typeInfo = typeInfo; |
| 34 | } |
| 35 | |
| 36 | write(accessor: string): string { |
| 37 | return writeFun(this.builder, accessor); |
| 38 | } |
| 39 | |
| 40 | read(accessor: (expr: string) => string): string { |
| 41 | return accessor(read(this.builder)); |
| 42 | } |
| 43 | |
| 44 | getFixedSize(): number { |
| 45 | return 11; |
| 46 | } |
| 47 | }; |
| 48 | } |
| 49 | |
| 50 | CodegenRegistry.register(TypeId.INT8, |
| 51 | buildNumberSerializer( |