Skip to content

Commit

Permalink
fix(semantic/cfg): issue in unlabeled Ctxs. (#3678)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed Jun 14, 2024
1 parent eff9cff commit 7a58fec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/oxc_semantic/src/control_flow/builder/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,12 @@ impl<'a> ControlFlowGraphBuilder<'a> {
.filter(|it| it.flags.contains(flag))
.find(|it| it.is(label))
} else {
self.ctx_stack.iter_mut().rev().find(|it| it.flags.contains(flag))
self.ctx_stack
.iter_mut()
.rev()
// anything up the function is unreachable
.take_while(|it| !it.flags.intersects(CtxFlags::FUNCTION))
.find(|it| it.flags.contains(flag))
};

if let Some(ctx) = ctx {
Expand Down

0 comments on commit 7a58fec

Please sign in to comment.