File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -2054,7 +2054,7 @@ impl Compiler {
20542054 ) -> CompileResult < ( ) > {
20552055 self . compile_expression ( subject) ?;
20562056 // Block at the end of the switch statement that we jump to after finishing a branch
2057- let pattern_blocks = std:: iter:: repeat_with ( || self . new_block ( ) )
2057+ let mut pattern_blocks = std:: iter:: repeat_with ( || self . new_block ( ) )
20582058 . take ( cases. len ( ) + 1 )
20592059 . collect :: < Vec < _ > > ( ) ;
20602060 eprintln ! ( "created pattern_blocks: {:?} - {:?}(end block)" , pattern_blocks. first( ) . unwrap( ) , pattern_blocks. last( ) . unwrap( ) ) ;
@@ -2118,7 +2118,21 @@ impl Compiler {
21182118 }
21192119 self . compile_statements ( & m. body ) ?;
21202120 }
2121-
2121+ let block = self . new_block ( ) ;
2122+ pattern_blocks. push ( block) ;
2123+ let code = self . current_code_info ( ) ;
2124+ let _ = pattern_blocks. iter ( )
2125+ . zip ( pattern_blocks. iter ( ) . skip ( 1 ) )
2126+ . for_each ( |( a, b) | {
2127+ eprintln ! ( "linking: {} -> {}" , a. 0 , b. 0 ) ;
2128+ code. blocks [ a. 0 as usize ] . next = * b;
2129+ } ) ;
2130+ self . switch_to_block ( * pattern_blocks. last ( ) . unwrap ( ) ) ;
2131+ let code = self . current_code_info ( ) ;
2132+ for block in pattern_blocks {
2133+ let b = & code. blocks [ block. 0 as usize ] ;
2134+ eprintln ! ( "block: {} -> {}" , block. 0 , b. next. 0 ) ;
2135+ }
21222136 Ok ( ( ) )
21232137 }
21242138
Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ impl CodeInfo {
227227 let mut start_depths = vec ! [ u32 :: MAX ; self . blocks. len( ) ] ;
228228 start_depths[ 0 ] = 0 ;
229229 stack. push ( BlockIdx ( 0 ) ) ;
230- const DEBUG : bool = false ;
230+ const DEBUG : bool = true ;
231231 ' process_blocks: while let Some ( block) = stack. pop ( ) {
232232 let mut depth = start_depths[ block. idx ( ) ] ;
233233 if DEBUG {
You can’t perform that action at this time.
0 commit comments