@@ -649,6 +649,7 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
649
649
self . visit_statement ( & stmt. body ) ;
650
650
651
651
/* cfg - condition basic block */
652
+ let after_body_graph_ix = self . cfg . current_node_ix ;
652
653
let start_of_condition_graph_ix = self . cfg . new_basic_block ( ) ;
653
654
/* cfg */
654
655
@@ -659,18 +660,14 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
659
660
660
661
let end_do_while_graph_ix = self . cfg . new_basic_block ( ) ;
661
662
662
- // before do while to start of condition basic block
663
- self . cfg . add_edge (
664
- before_do_while_stmt_graph_ix,
665
- start_of_condition_graph_ix,
666
- EdgeType :: Normal ,
667
- ) ;
663
+ // before do while to start of body basic block
664
+ self . cfg . add_edge ( before_do_while_stmt_graph_ix, start_body_graph_ix, EdgeType :: Normal ) ;
668
665
// body of do-while to start of condition
669
- self . cfg . add_edge ( start_body_graph_ix , start_of_condition_graph_ix, EdgeType :: Backedge ) ;
666
+ self . cfg . add_edge ( after_body_graph_ix , start_of_condition_graph_ix, EdgeType :: Normal ) ;
670
667
// end of condition to after do while
671
668
self . cfg . add_edge ( end_of_condition_graph_ix, end_do_while_graph_ix, EdgeType :: Normal ) ;
672
669
// end of condition to after start of body
673
- self . cfg . add_edge ( end_of_condition_graph_ix, start_body_graph_ix, EdgeType :: Normal ) ;
670
+ self . cfg . add_edge ( end_of_condition_graph_ix, start_body_graph_ix, EdgeType :: Backedge ) ;
674
671
675
672
self . cfg . restore_state (
676
673
& statement_state,
0 commit comments