Skip to content

Commit 7a58fec

Browse files
committed
fix(semantic/cfg): issue in unlabeled Ctxs. (#3678)
[oxlint-ecosystem-ci](https://github.com/rzvxa/oxlint-ecosystem-ci/actions/runs/9519079285)
1 parent eff9cff commit 7a58fec

File tree

1 file changed

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

1 file changed

+6
-1
lines changed

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,12 @@ impl<'a> ControlFlowGraphBuilder<'a> {
240240
.filter(|it| it.flags.contains(flag))
241241
.find(|it| it.is(label))
242242
} else {
243-
self.ctx_stack.iter_mut().rev().find(|it| it.flags.contains(flag))
243+
self.ctx_stack
244+
.iter_mut()
245+
.rev()
246+
// anything up the function is unreachable
247+
.take_while(|it| !it.flags.intersects(CtxFlags::FUNCTION))
248+
.find(|it| it.flags.contains(flag))
244249
};
245250

246251
if let Some(ctx) = ctx {

0 commit comments

Comments
 (0)