@@ -83,17 +83,6 @@ private static int findChunkStartByEstimatedSize(List<Node> elements,
8383 private static final ThreadLocal <Deque <BlockNode >> pendingRefactorBlocks = ThreadLocal .withInitial (ArrayDeque ::new );
8484 private static final ThreadLocal <Boolean > processingPendingRefactors = ThreadLocal .withInitial (() -> false );
8585
86- public static void enqueueForRefactor (BlockNode node ) {
87- if (!IS_REFACTORING_ENABLED || node == null ) {
88- return ;
89- }
90- if (node .getBooleanAnnotation ("queuedForRefactor" )) {
91- return ;
92- }
93- node .setAnnotation ("queuedForRefactor" , true );
94- pendingRefactorBlocks .get ().addLast (node );
95- }
96-
9786 private static void processPendingRefactors () {
9887 if (processingPendingRefactors .get ()) {
9988 return ;
@@ -141,16 +130,6 @@ public static void forceRefactorForCodegen(BlockNode node, boolean isAutoRetry)
141130 processPendingRefactors ();
142131 }
143132
144- /**
145- * Legacy wrapper for compatibility.
146- *
147- * @param node The block to refactor
148- * @deprecated Use {@link #forceRefactorForCodegen(BlockNode, boolean)} instead
149- */
150- public static void forceRefactorForCodegen (BlockNode node ) {
151- forceRefactorForCodegen (node , false );
152- }
153-
154133 /**
155134 * Parse-time entry point: called from BlockNode constructor to refactor large blocks.
156135 * This applies smart chunking to split safe statement sequences into closures.
@@ -572,46 +551,6 @@ private static boolean tryWholeBlockRefactoring(EmitterVisitor emitterVisitor, B
572551 return true ;
573552 }
574553
575- /**
576- * Check if a node is a complete block/loop with its own scope.
577- */
578- private static boolean isCompleteBlock (Node node ) {
579- return node instanceof BlockNode ||
580- node instanceof For1Node ||
581- node instanceof For3Node ||
582- node instanceof IfNode ||
583- node instanceof TryNode ;
584- }
585-
586- /**
587- * Check if a chunk would be wrapped in a closure based on its size.
588- *
589- * @param chunk The chunk to check
590- * @return true if the chunk is large enough to be wrapped (>= MIN_CHUNK_SIZE)
591- */
592- private static boolean chunkWouldBeWrapped (List <Node > chunk ) {
593- return chunk .size () >= MIN_CHUNK_SIZE ;
594- }
595-
596- /**
597- * Check if a chunk contains unsafe control flow.
598- * This checks for any control flow statements (last/next/redo/goto) that would break
599- * if the chunk is wrapped in a closure.
600- *
601- * @param chunk The chunk to check
602- * @return true if unsafe control flow found
603- */
604- private static boolean chunkHasUnsafeControlFlow (List <Node > chunk ) {
605- controlFlowDetector .reset ();
606- for (Node element : chunk ) {
607- element .accept (controlFlowDetector );
608- if (controlFlowDetector .hasUnsafeControlFlow ()) {
609- return true ;
610- }
611- }
612- return false ;
613- }
614-
615554 private static BlockNode createBlockNode (List <Node > elements , int tokenIndex , ThreadLocal <Boolean > skipRefactoring ) {
616555 BlockNode block ;
617556 skipRefactoring .set (true );
0 commit comments