Skip to content

Commit

Permalink
fix: keep new functions always as reachable.
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed Jun 13, 2024
1 parent 4df840e commit 0478a0b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/oxc_semantic/src/control_flow/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ impl<'a> ControlFlowGraphBuilder<'a> {
}

pub fn add_edge(&mut self, a: BasicBlockId, b: BasicBlockId, weight: EdgeType) {
if self.basic_block(a).unreachable {
if matches!(weight, EdgeType::NewFunction) {
self.basic_block_mut(b).unreachable = false;
} else if self.basic_block(a).unreachable {
if self.graph.edges_directed(b, Direction::Incoming).count() == 0 {
self.basic_block_mut(b).unreachable = true;
}
Expand Down

0 comments on commit 0478a0b

Please sign in to comment.