Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1573,12 +1573,7 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
self.visit_catch_clause(handler);

/* cfg */
control_flow!(self, |cfg| {
let catch_block_end_ix = cfg.current_node_ix;
// TODO: we shouldn't directly change the current node index.
cfg.current_node_ix = after_try_block_graph_ix;
Some(catch_block_end_ix)
})
control_flow!(self, |cfg| Some(cfg.current_node_ix))
/* cfg */
} else {
None
Expand All @@ -1605,12 +1600,7 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
self.visit_block_statement(finalizer);

/* cfg */
control_flow!(self, |cfg| {
let finally_block_end_ix = cfg.current_node_ix;
// TODO: we shouldn't directly change the current node index.
cfg.current_node_ix = after_try_block_graph_ix;
Some(finally_block_end_ix)
})
control_flow!(self, |cfg| Some(cfg.current_node_ix))
/* cfg */
} else {
None
Expand All @@ -1623,7 +1613,6 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {

/* cfg */
control_flow!(self, |cfg| {
let after_try_statement_block_ix = cfg.new_basic_block_normal();
cfg.add_edge(
before_try_statement_graph_ix,
before_try_block_graph_ix,
Expand All @@ -1632,6 +1621,7 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
if let Some(catch_block_end_ix) = catch_block_end_ix
&& finally_block_end_ix.is_none()
{
let after_try_statement_block_ix = cfg.new_basic_block_normal();
cfg.add_edge(
after_try_block_graph_ix,
after_try_statement_block_ix,
Expand All @@ -1641,6 +1631,7 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
cfg.add_edge(catch_block_end_ix, after_try_statement_block_ix, EdgeType::Normal);
}
if let Some(finally_block_end_ix) = finally_block_end_ix {
let after_try_statement_block_ix = cfg.new_basic_block_normal();
if catch_block_end_ix.is_some() {
cfg.add_edge(
finally_block_end_ix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ return" shape = box]
9 -> 10 [ label="Normal", style="dotted"]
9 -> 7 [ label="Backedge", style="dotted", color=grey]
7 -> 10 [ label="Jump", color=green]
11 -> 2 [ label="Error(Implicit)", color=red, style=dashed]
3 -> 5 [ label="Normal"]
11 -> 2 [ label="Error(Implicit)", color=red, style=dashed]
10 -> 11 [ label="Join"]
12 -> 0 [ label="Error(Implicit)", color=red, style=dashed]
1 -> 12 [ label="Normal"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ ExpressionStatement" shape = box]
4 -> 6 [ label="NewFunction"]
7 -> 0 [ label="Error(Implicit)", color=red, style=dashed]
4 -> 7 [ label="Normal"]
8 -> 0 [ label="Error(Implicit)", color=red, style=dashed]
1 -> 3 [ label="Normal"]
8 -> 0 [ label="Error(Implicit)", color=red, style=dashed]
7 -> 8 [ label="Join"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ unreachable" shape = box]
9 -> 0 [ label="Error(Implicit)", color=red, style=dashed]
8 -> 9 [ label="Normal"]
6 -> 9 [ label="Jump", color=green]
10 -> 0 [ label="Error(Implicit)", color=red, style=dashed]
1 -> 3 [ label="Normal"]
10 -> 0 [ label="Error(Implicit)", color=red, style=dashed]
3 -> 10 [ label="Normal"]
9 -> 10 [ label="Normal"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ unreachable" shape = box]
4 -> 7 [ label="Normal"]
8 -> 2 [ label="Error(Implicit)", style=dashed, color=red]
7 -> 8 [ label="Unreachable", style="dotted"]
9 -> 2 [ label="Error(Implicit)", style=dashed, color=red]
3 -> 5 [ label="Normal"]
9 -> 2 [ label="Error(Implicit)", style=dashed, color=red]
8 -> 9 [ label="Unreachable", style="dotted"]
10 -> 2 [ label="Error(Implicit)", color=red, style=dashed]
9 -> 10 [ label="Normal", style="dotted"]
Expand Down
Loading