@@ -198,42 +198,6 @@ export class KotlinGenerator implements ClassGenerator {
198
198
}
199
199
}
200
200
201
- mapOf ( items : string [ ] ) : string {
202
- switch ( items . length ) {
203
- case 0 :
204
- return `emptyMap()` ;
205
- case 1 :
206
- return `mapOf(${ items [ 0 ] } )` ;
207
- default :
208
- return `\
209
- mapOf(
210
- ${ this . leftPad ( items . join ( ',\n' ) , 4 ) }
211
- )` ;
212
- }
213
-
214
- }
215
-
216
- createSchema ( schemaHash : string ) : string {
217
- const schemaNames = this . node . schema . names . map ( n => `SchemaName("${ n } ")` ) ;
218
- return `\
219
- Schema(
220
- listOf(${ schemaNames . join ( ',\n' + ' ' . repeat ( 8 ) ) } ),
221
- SchemaFields(
222
- singletons = ${ this . leftPad ( this . mapOf ( this . singletonSchemaFields ) , 8 , true ) } ,
223
- collections = ${ this . leftPad ( this . mapOf ( this . collectionSchemaFields ) , 8 , true ) }
224
- ),
225
- "${ schemaHash } "
226
- )` ;
227
- }
228
-
229
- leftPad ( input : string , indent : number , skipFirst : boolean = false ) {
230
- return input
231
- . split ( '\n' )
232
- . map ( ( line : string , idx : number ) => ( idx === 0 && skipFirst ) ? line : ' ' . repeat ( indent ) + line )
233
- . join ( '\n' ) ;
234
- }
235
-
236
-
237
201
createSchema ( schemaHash : string ) : string {
238
202
const schemaNames = this . node . schema . names . map ( n => `SchemaName("${ n } ")` ) ;
239
203
return `\
@@ -247,7 +211,6 @@ Schema(
247
211
)` ;
248
212
}
249
213
250
-
251
214
generate ( schemaHash : string , fieldCount : number ) : string {
252
215
const { name, aliases} = this . node ;
253
216
@@ -324,7 +287,7 @@ class ${name}_Spec() : ${this.getType('EntitySpec')}<${name}> {
324
287
${ this . opts . wasm ? '' : `\
325
288
326
289
companion object {
327
- val schema = ${ this . leftPad ( this . createSchema ( schemaHash ) , 8 , true ) }
290
+ val schema = ${ leftPad ( this . createSchema ( schemaHash ) , 8 , true ) }
328
291
329
292
init {
330
293
SchemaRegistry.register(schema)
0 commit comments