Skip to content

Commit

Permalink
chore: 🤖 tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
IWANABETHATGUY committed Sep 9, 2024
1 parent 9271d18 commit ca5e452
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1633,17 +1633,18 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
self.visit_function_body(body);
}

/* cfg */
control_flow!(self, |cfg| {
let c = cfg.current_basic_block();
// If the last is an unreachable instruction, it means there is already a explicit
// return or throw statement at the end of function body, we don't need to
// insert an implicit return.
if !matches!(
c.instructions().last().map(|inst| &inst.kind),
Some(InstructionKind::Unreachable)
) {
cfg.push_implicit_return();
}
});
/* cfg */
control_flow!(self, |cfg| {
cfg.ctx(None).resolve_expect(CtxFlags::FUNCTION);
cfg.release_error_harness(error_harness);
cfg.pop_finalization_stack();
Expand Down Expand Up @@ -1696,6 +1697,16 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {

/* cfg */
control_flow!(self, |cfg| {
let c = cfg.current_basic_block();
// If the last is an unreachable instruction, it means there is already a explicit
// return or throw statement at the end of function body, we don't need to
// insert an implicit return.
if !matches!(
c.instructions().last().map(|inst| &inst.kind),
Some(InstructionKind::Unreachable)
) {
cfg.push_implicit_return();
}
cfg.ctx(None).resolve_expect(CtxFlags::FUNCTION);
cfg.release_error_harness(error_harness);
cfg.pop_finalization_stack();
Expand Down

0 comments on commit ca5e452

Please sign in to comment.