Skip to content

Commit 0478a0b

Browse files
committed
fix: keep new functions always as reachable.
1 parent 4df840e commit 0478a0b

File tree

1 file changed

+3
-1
lines changed
  • crates/oxc_semantic/src/control_flow/builder

1 file changed

+3
-1
lines changed

crates/oxc_semantic/src/control_flow/builder/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ impl<'a> ControlFlowGraphBuilder<'a> {
111111
}
112112

113113
pub fn add_edge(&mut self, a: BasicBlockId, b: BasicBlockId, weight: EdgeType) {
114-
if self.basic_block(a).unreachable {
114+
if matches!(weight, EdgeType::NewFunction) {
115+
self.basic_block_mut(b).unreachable = false;
116+
} else if self.basic_block(a).unreachable {
115117
if self.graph.edges_directed(b, Direction::Incoming).count() == 0 {
116118
self.basic_block_mut(b).unreachable = true;
117119
}

0 commit comments

Comments
 (0)