(source: string)
| 381 | } |
| 382 | |
| 383 | function syncModelSource(source: string): string { |
| 384 | // Sync each model's Opaque ctor to the block mode (make → OpaqueShape, type → OpaqueType, |
| 385 | // else plain Opaque). Done outside codegen blocks, on the class declarations. Only for files |
| 386 | // that actually contain a model codegen block, so manual OpaqueType/Shape usage is untouched. |
| 387 | if (modelBlockRe.test(source)) { |
| 388 | const facade = facadeModelBlockRe.test(source) |
| 389 | const mode: CtorMode = staticMakeModelBlockRe.test(source) |
| 390 | ? "make" |
| 391 | : staticTypeModelBlockRe.test(source) |
| 392 | ? "type" |
| 393 | : "plain" |
| 394 | const modelNames = getExportedModelNames(source) |
| 395 | if (facade) { |
| 396 | // Only rewrite Opaque-struct models into facades; leave Class-based models |
| 397 | // as-is so a mixed file still converts the facade-able ones. |
| 398 | return syncFacade(source, getFacadeableModelNames(source), true) |
| 399 | } |
| 400 | return syncCtor(syncFacade(source, modelNames, false), modelNames, mode) |
| 401 | } |
| 402 | return source |
| 403 | } |
| 404 | |
| 405 | function updateFile( |
| 406 | filePath: string, |
no test coverage detected
searching dependent graphs…