File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,4 +19,3 @@ createListCommand(program);
1919program . showHelpAfterError ( ) ;
2020
2121await program . parseAsync ( process . argv ) ;
22- await new Promise ( ( resolve ) => setTimeout ( resolve , 5000 ) ) ;
Original file line number Diff line number Diff line change @@ -149,6 +149,17 @@ export class Codemod {
149149 this . entityRegistry = new Map ( ) ;
150150 }
151151
152+ releaseASTs ( ) {
153+ for ( const parsed of this . input . parsedModels . values ( ) ) {
154+ ( parsed as { ast : unknown ; root : unknown } ) . ast = null ;
155+ ( parsed as { ast : unknown ; root : unknown } ) . root = null ;
156+ }
157+ for ( const parsed of this . input . parsedMixins . values ( ) ) {
158+ ( parsed as { ast : unknown ; root : unknown } ) . ast = null ;
159+ ( parsed as { ast : unknown ; root : unknown } ) . root = null ;
160+ }
161+ }
162+
152163 findMixinsUsedByModels ( ) {
153164 const result = analyzeModelMixinUsage ( this , this . finalOptions ) ;
154165 linkEntities ( this . entityRegistry , result . modelToMixinsMap ) ;
Original file line number Diff line number Diff line change @@ -468,6 +468,11 @@ export async function runMigration(options: MigrateOptions): Promise<void> {
468468 log,
469469 } ) ;
470470
471+ // Release AST references so native tree-sitter trees are finalized
472+ // individually by GC rather than all at once during process exit,
473+ // which causes a stack overflow in tree-sitter's recursive destructor.
474+ codemod . releaseASTs ( ) ;
475+
471476 // Aggregate all skipped files from every phase
472477 const allSkipped : SkippedFile [ ] = [ ...codemod . input . skipped , ...results . skipped ] ;
473478
You can’t perform that action at this time.
0 commit comments