From 805fbac44c0c04b3dbdc4dbbffa1c5ca24150035 Mon Sep 17 00:00:00 2001 From: IWANABETHATGUY <17974631+IWANABETHATGUY@users.noreply.github.com> Date: Thu, 12 Sep 2024 18:39:01 +0000 Subject: [PATCH] feat(oxc_cfg): better control flow graph dot dot repr (#5731) 1. add basic block index for each basicblock, so there should no basic block display empty string 2. use `shape` box, since it is basic **block** ## Before ![image](https://github.com/user-attachments/assets/9b556cca-8401-40bd-b3b6-d31c5e7cf8ba) ## After ![image](https://github.com/user-attachments/assets/b8e4c52d-ecdf-4e92-85be-ea37f0cb2330) --- crates/oxc_semantic/src/dot.rs | 16 +++- .../integration/snapshots/argument_map.snap | 11 +-- .../snapshots/arrow_expressions.snap | 16 ++-- .../snapshots/assignment_operators.snap | 21 +++-- .../break_from_a_label_in_global_scope.snap | 11 ++- .../tests/integration/snapshots/class.snap | 11 +-- .../snapshots/class_extend_super.snap | 14 +-- .../snapshots/cond_expr_in_arrow_fn.snap | 19 ++-- .../snapshots/conditional_expression.snap | 15 ++-- .../integration/snapshots/do_while_break.snap | 34 ++++--- .../snapshots/expression_spread.snap | 5 +- .../fn_return_obj_expr_with_computed_key.snap | 14 +-- .../tests/integration/snapshots/for_in.snap | 23 +++-- .../snapshots/function_as_expression.snap | 88 +++++++++++-------- .../snapshots/function_in_finally.snap | 22 +++-- .../tests/integration/snapshots/if_else.snap | 38 +++++--- .../snapshots/if_stmt_in_for_in.snap | 55 ++++++++---- .../snapshots/import_as_function.snap | 10 ++- .../index_into_object_with_symbol_as_arg.snap | 5 +- .../indexing_into_class_expression.snap | 6 +- .../snapshots/infix_operators.snap | 10 ++- .../snapshots/labeled_block_break.snap | 32 ++++--- .../snapshots/labelled_try_break.snap | 36 +++++--- .../logical_expressions_short_circuit.snap | 44 ++++++---- .../member_access_with_numbered_index.snap | 18 ++-- .../member_access_with_unreachable.snap | 18 ++-- .../nested_computed_member_expression.snap | 14 +-- .../integration/snapshots/new_and_meta.snap | 5 +- .../snapshots/new_class_then_call_fn.snap | 5 +- .../object_in_computer_member_expression.snap | 5 +- .../parenthesized_and_sequence_expr.snap | 18 ++-- .../integration/snapshots/private_in.snap | 14 +-- .../integration/snapshots/simple_spread.snap | 14 +-- .../snapshots/spread_in_a_spread.snap | 14 +-- .../tests/integration/snapshots/string.snap | 4 +- .../snapshots/switch_in_while.snap | 32 ++++--- .../snapshots/switch_statement.snap | 74 +++++++++++----- .../snapshots/template_literal.snap | 5 +- .../snapshots/template_string.snap | 5 +- .../integration/snapshots/two_functions.snap | 24 ++--- .../integration/snapshots/unary_operator.snap | 7 +- .../tests/integration/snapshots/while.snap | 31 ++++--- .../yield_as_statement_and_expression.snap | 13 +-- 43 files changed, 540 insertions(+), 336 deletions(-) diff --git a/crates/oxc_semantic/src/dot.rs b/crates/oxc_semantic/src/dot.rs index df3354ef781fb..432c4dd82cd19 100644 --- a/crates/oxc_semantic/src/dot.rs +++ b/crates/oxc_semantic/src/dot.rs @@ -66,10 +66,18 @@ impl DebugDot for ControlFlowGraph { label } }, - &|_graph, node| format!( - "label = {:?} ", - self.basic_blocks[*node.1].debug_dot(ctx).trim() - ), + &|_graph, node| { + let basic_block_index = *node.1; + let basic_block_debug_str = self.basic_blocks[*node.1].debug_dot(ctx); + let trimmed_debug_str = basic_block_debug_str.trim(); + if trimmed_debug_str.is_empty() { + format!("label = \"bb{basic_block_index}\" shape = box",) + } else { + format!( + "label = \"bb{basic_block_index}\n{trimmed_debug_str}\" shape = box", + ) + } + }, ) ) } diff --git a/crates/oxc_semantic/tests/integration/snapshots/argument_map.snap b/crates/oxc_semantic/tests/integration/snapshots/argument_map.snap index 8efbe03ef451a..8210b0493d9c5 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/argument_map.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/argument_map.snap @@ -24,11 +24,12 @@ bb4: { } digraph { - 0 [ label = "" ] - 1 [ label = "" ] - 2 [ label = "" ] - 3 [ label = "ExpressionStatement" ] - 4 [ label = "" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3 +ExpressionStatement" shape = box] + 4 [ label = "bb4" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 3 -> 2 [ label = "Error(Implicit)" ] 1 -> 3 [ label = "NewFunction" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/arrow_expressions.snap b/crates/oxc_semantic/tests/integration/snapshots/arrow_expressions.snap index cb8781ba012b8..931b1a3b1991d 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/arrow_expressions.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/arrow_expressions.snap @@ -29,12 +29,16 @@ bb5: { } digraph { - 0 [ label = "" ] - 1 [ label = "ExpressionStatement\nVariableDeclaration" ] - 2 [ label = "" ] - 3 [ label = "ExpressionStatement" ] - 4 [ label = "" ] - 5 [ label = "ExpressionStatement" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1 +ExpressionStatement +VariableDeclaration" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3 +ExpressionStatement" shape = box] + 4 [ label = "bb4" shape = box] + 5 [ label = "bb5 +ExpressionStatement" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 3 -> 2 [ label = "Error(Implicit)" ] 1 -> 3 [ label = "NewFunction" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/assignment_operators.snap b/crates/oxc_semantic/tests/integration/snapshots/assignment_operators.snap index 4e45c2366fd83..8d8b8f10db2aa 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/assignment_operators.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/assignment_operators.snap @@ -37,14 +37,19 @@ bb7: { } digraph { - 0 [ label = "" ] - 1 [ label = "ExpressionStatement" ] - 2 [ label = "" ] - 3 [ label = "ExpressionStatement" ] - 4 [ label = "" ] - 5 [ label = "ExpressionStatement" ] - 6 [ label = "" ] - 7 [ label = "ExpressionStatement\nExpressionStatement" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1 +ExpressionStatement" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3 +ExpressionStatement" shape = box] + 4 [ label = "bb4" shape = box] + 5 [ label = "bb5 +ExpressionStatement" shape = box] + 6 [ label = "bb6" shape = box] + 7 [ label = "bb7 +ExpressionStatement +ExpressionStatement" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 2 -> 0 [ label = "Error(Implicit)" ] 3 -> 0 [ label = "Error(Implicit)" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/break_from_a_label_in_global_scope.snap b/crates/oxc_semantic/tests/integration/snapshots/break_from_a_label_in_global_scope.snap index 91d109bad8692..a604a3391158a 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/break_from_a_label_in_global_scope.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/break_from_a_label_in_global_scope.snap @@ -21,10 +21,13 @@ bb3: { } digraph { - 0 [ label = "" ] - 1 [ label = "LabeledStatement(A)\nbreak " ] - 2 [ label = "unreachable" ] - 3 [ label = "" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1 +LabeledStatement(A) +break " shape = box] + 2 [ label = "bb2 +unreachable" shape = box] + 3 [ label = "bb3" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 2 -> 0 [ label = "Error(Implicit)" , style = "dotted" ] 1 -> 2 [ label = "Unreachable" , style = "dotted" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/class.snap b/crates/oxc_semantic/tests/integration/snapshots/class.snap index a2e523c101260..aa661869b1d8f 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/class.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/class.snap @@ -24,11 +24,12 @@ bb4: { } digraph { - 0 [ label = "" ] - 1 [ label = "" ] - 2 [ label = "" ] - 3 [ label = "ExpressionStatement" ] - 4 [ label = "" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3 +ExpressionStatement" shape = box] + 4 [ label = "bb4" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 3 -> 2 [ label = "Error(Implicit)" ] 1 -> 3 [ label = "NewFunction" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/class_extend_super.snap b/crates/oxc_semantic/tests/integration/snapshots/class_extend_super.snap index 23bdddb5f4187..7c13554c45daf 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/class_extend_super.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/class_extend_super.snap @@ -28,12 +28,14 @@ bb5: { } digraph { - 0 [ label = "" ] - 1 [ label = "" ] - 2 [ label = "" ] - 3 [ label = "return " ] - 4 [ label = "unreachable" ] - 5 [ label = "" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3 +return " shape = box] + 4 [ label = "bb4 +unreachable" shape = box] + 5 [ label = "bb5" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 3 -> 2 [ label = "Error(Implicit)" ] 1 -> 3 [ label = "NewFunction" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/cond_expr_in_arrow_fn.snap b/crates/oxc_semantic/tests/integration/snapshots/cond_expr_in_arrow_fn.snap index 5e7a79e9d20f1..496b0a5f831d3 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/cond_expr_in_arrow_fn.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/cond_expr_in_arrow_fn.snap @@ -36,14 +36,17 @@ bb7: { } digraph { - 0 [ label = "" ] - 1 [ label = "VariableDeclaration" ] - 2 [ label = "" ] - 3 [ label = "ExpressionStatement" ] - 4 [ label = "Condition(CallExpression(a))" ] - 5 [ label = "" ] - 6 [ label = "" ] - 7 [ label = "" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1 +VariableDeclaration" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3 +ExpressionStatement" shape = box] + 4 [ label = "bb4 +Condition(CallExpression(a))" shape = box] + 5 [ label = "bb5" shape = box] + 6 [ label = "bb6" shape = box] + 7 [ label = "bb7" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 3 -> 2 [ label = "Error(Implicit)" ] 1 -> 3 [ label = "NewFunction" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/conditional_expression.snap b/crates/oxc_semantic/tests/integration/snapshots/conditional_expression.snap index 444513aacfa91..3a66031d3eae6 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/conditional_expression.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/conditional_expression.snap @@ -28,12 +28,15 @@ bb5: { } digraph { - 0 [ label = "" ] - 1 [ label = "VariableDeclaration" ] - 2 [ label = "Condition(CallExpression(a))" ] - 3 [ label = "" ] - 4 [ label = "" ] - 5 [ label = "VariableDeclaration" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1 +VariableDeclaration" shape = box] + 2 [ label = "bb2 +Condition(CallExpression(a))" shape = box] + 3 [ label = "bb3" shape = box] + 4 [ label = "bb4" shape = box] + 5 [ label = "bb5 +VariableDeclaration" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 2 -> 0 [ label = "Error(Implicit)" ] 3 -> 0 [ label = "Error(Implicit)" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/do_while_break.snap b/crates/oxc_semantic/tests/integration/snapshots/do_while_break.snap index ae5a163fa42c7..1df3a3772f610 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/do_while_break.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/do_while_break.snap @@ -57,19 +57,27 @@ bb12: { } digraph { - 0 [ label = "" ] - 1 [ label = "VariableDeclaration" ] - 2 [ label = "" ] - 3 [ label = "TryStatement" ] - 4 [ label = "" ] - 5 [ label = "BlockStatement" ] - 6 [ label = "DoWhileStatement" ] - 7 [ label = "BlockStatement\nbreak" ] - 8 [ label = "unreachable" ] - 9 [ label = "Condition(true)" ] - 10 [ label = "" ] - 11 [ label = "" ] - 12 [ label = "" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1 +VariableDeclaration" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3 +TryStatement" shape = box] + 4 [ label = "bb4" shape = box] + 5 [ label = "bb5 +BlockStatement" shape = box] + 6 [ label = "bb6 +DoWhileStatement" shape = box] + 7 [ label = "bb7 +BlockStatement +break" shape = box] + 8 [ label = "bb8 +unreachable" shape = box] + 9 [ label = "bb9 +Condition(true)" shape = box] + 10 [ label = "bb10" shape = box] + 11 [ label = "bb11" shape = box] + 12 [ label = "bb12" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 3 -> 2 [ label = "Error(Implicit)" ] 1 -> 3 [ label = "NewFunction" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/expression_spread.snap b/crates/oxc_semantic/tests/integration/snapshots/expression_spread.snap index 742931734aa54..c0d0e9ba18110 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/expression_spread.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/expression_spread.snap @@ -12,7 +12,8 @@ bb1: { } digraph { - 0 [ label = "" ] - 1 [ label = "VariableDeclaration" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1 +VariableDeclaration" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] } diff --git a/crates/oxc_semantic/tests/integration/snapshots/fn_return_obj_expr_with_computed_key.snap b/crates/oxc_semantic/tests/integration/snapshots/fn_return_obj_expr_with_computed_key.snap index 6bce4ae9b581e..84aed787a5b94 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/fn_return_obj_expr_with_computed_key.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/fn_return_obj_expr_with_computed_key.snap @@ -28,12 +28,14 @@ bb5: { } digraph { - 0 [ label = "" ] - 1 [ label = "" ] - 2 [ label = "" ] - 3 [ label = "return " ] - 4 [ label = "unreachable" ] - 5 [ label = "" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3 +return " shape = box] + 4 [ label = "bb4 +unreachable" shape = box] + 5 [ label = "bb5" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 3 -> 2 [ label = "Error(Implicit)" ] 1 -> 3 [ label = "NewFunction" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/for_in.snap b/crates/oxc_semantic/tests/integration/snapshots/for_in.snap index 92f50f16ba64b..727e7cf993487 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/for_in.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/for_in.snap @@ -41,15 +41,20 @@ bb8: { } digraph { - 0 [ label = "" ] - 1 [ label = "" ] - 2 [ label = "" ] - 3 [ label = "ForStatement\nVariableDeclaration" ] - 4 [ label = "Condition(test)" ] - 5 [ label = "" ] - 6 [ label = "ExpressionStatement" ] - 7 [ label = "ExpressionStatement" ] - 8 [ label = "" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3 +ForStatement +VariableDeclaration" shape = box] + 4 [ label = "bb4 +Condition(test)" shape = box] + 5 [ label = "bb5" shape = box] + 6 [ label = "bb6 +ExpressionStatement" shape = box] + 7 [ label = "bb7 +ExpressionStatement" shape = box] + 8 [ label = "bb8" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 3 -> 2 [ label = "Error(Implicit)" ] 1 -> 3 [ label = "NewFunction" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/function_as_expression.snap b/crates/oxc_semantic/tests/integration/snapshots/function_as_expression.snap index e2c2872a6294c..d875f8a932243 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/function_as_expression.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/function_as_expression.snap @@ -160,45 +160,55 @@ bb38: { } digraph { - 0 [ label = "" ] - 1 [ label = "ExpressionStatement" ] - 2 [ label = "" ] - 3 [ label = "" ] - 4 [ label = "ExpressionStatement" ] - 5 [ label = "" ] - 6 [ label = "" ] - 7 [ label = "" ] - 8 [ label = "" ] - 9 [ label = "" ] - 10 [ label = "ExpressionStatement" ] - 11 [ label = "" ] - 12 [ label = "" ] - 13 [ label = "ExpressionStatement" ] - 14 [ label = "" ] - 15 [ label = "" ] - 16 [ label = "ExpressionStatement" ] - 17 [ label = "" ] - 18 [ label = "" ] - 19 [ label = "ExpressionStatement" ] - 20 [ label = "" ] - 21 [ label = "" ] - 22 [ label = "ExpressionStatement" ] - 23 [ label = "" ] - 24 [ label = "" ] - 25 [ label = "" ] - 26 [ label = "" ] - 27 [ label = "ExpressionStatement" ] - 28 [ label = "" ] - 29 [ label = "" ] - 30 [ label = "" ] - 31 [ label = "" ] - 32 [ label = "ExpressionStatement" ] - 33 [ label = "" ] - 34 [ label = "" ] - 35 [ label = "ExpressionStatement" ] - 36 [ label = "" ] - 37 [ label = "" ] - 38 [ label = "" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1 +ExpressionStatement" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3" shape = box] + 4 [ label = "bb4 +ExpressionStatement" shape = box] + 5 [ label = "bb5" shape = box] + 6 [ label = "bb6" shape = box] + 7 [ label = "bb7" shape = box] + 8 [ label = "bb8" shape = box] + 9 [ label = "bb9" shape = box] + 10 [ label = "bb10 +ExpressionStatement" shape = box] + 11 [ label = "bb11" shape = box] + 12 [ label = "bb12" shape = box] + 13 [ label = "bb13 +ExpressionStatement" shape = box] + 14 [ label = "bb14" shape = box] + 15 [ label = "bb15" shape = box] + 16 [ label = "bb16 +ExpressionStatement" shape = box] + 17 [ label = "bb17" shape = box] + 18 [ label = "bb18" shape = box] + 19 [ label = "bb19 +ExpressionStatement" shape = box] + 20 [ label = "bb20" shape = box] + 21 [ label = "bb21" shape = box] + 22 [ label = "bb22 +ExpressionStatement" shape = box] + 23 [ label = "bb23" shape = box] + 24 [ label = "bb24" shape = box] + 25 [ label = "bb25" shape = box] + 26 [ label = "bb26" shape = box] + 27 [ label = "bb27 +ExpressionStatement" shape = box] + 28 [ label = "bb28" shape = box] + 29 [ label = "bb29" shape = box] + 30 [ label = "bb30" shape = box] + 31 [ label = "bb31" shape = box] + 32 [ label = "bb32 +ExpressionStatement" shape = box] + 33 [ label = "bb33" shape = box] + 34 [ label = "bb34" shape = box] + 35 [ label = "bb35 +ExpressionStatement" shape = box] + 36 [ label = "bb36" shape = box] + 37 [ label = "bb37" shape = box] + 38 [ label = "bb38" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 3 -> 2 [ label = "Error(Implicit)" ] 1 -> 3 [ label = "NewFunction" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/function_in_finally.snap b/crates/oxc_semantic/tests/integration/snapshots/function_in_finally.snap index 789ca61d83e4d..d0a61a8d42c09 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/function_in_finally.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/function_in_finally.snap @@ -41,15 +41,19 @@ bb8: { } digraph { - 0 [ label = "" ] - 1 [ label = "TryStatement" ] - 2 [ label = "" ] - 3 [ label = "BlockStatement\nExpressionStatement" ] - 4 [ label = "" ] - 5 [ label = "" ] - 6 [ label = "" ] - 7 [ label = "ExpressionStatement" ] - 8 [ label = "" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1 +TryStatement" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3 +BlockStatement +ExpressionStatement" shape = box] + 4 [ label = "bb4" shape = box] + 5 [ label = "bb5" shape = box] + 6 [ label = "bb6" shape = box] + 7 [ label = "bb7 +ExpressionStatement" shape = box] + 8 [ label = "bb8" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 3 -> 0 [ label = "Error(Implicit)" ] 3 -> 2 [ label = "Finalize" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/if_else.snap b/crates/oxc_semantic/tests/integration/snapshots/if_else.snap index 1569002280bae..ebf78c52b3215 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/if_else.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/if_else.snap @@ -62,20 +62,30 @@ bb13: { } digraph { - 0 [ label = "" ] - 1 [ label = "" ] - 2 [ label = "" ] - 3 [ label = "IfStatement" ] - 4 [ label = "Condition(LogicalExpression)" ] - 5 [ label = "" ] - 6 [ label = "" ] - 7 [ label = "BlockStatement\nreturn " ] - 8 [ label = "unreachable" ] - 9 [ label = "BlockStatement\nreturn " ] - 10 [ label = "unreachable" ] - 11 [ label = "return " ] - 12 [ label = "unreachable" ] - 13 [ label = "" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3 +IfStatement" shape = box] + 4 [ label = "bb4 +Condition(LogicalExpression)" shape = box] + 5 [ label = "bb5" shape = box] + 6 [ label = "bb6" shape = box] + 7 [ label = "bb7 +BlockStatement +return " shape = box] + 8 [ label = "bb8 +unreachable" shape = box] + 9 [ label = "bb9 +BlockStatement +return " shape = box] + 10 [ label = "bb10 +unreachable" shape = box] + 11 [ label = "bb11 +return " shape = box] + 12 [ label = "bb12 +unreachable" shape = box] + 13 [ label = "bb13" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 3 -> 2 [ label = "Error(Implicit)" ] 1 -> 3 [ label = "NewFunction" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/if_stmt_in_for_in.snap b/crates/oxc_semantic/tests/integration/snapshots/if_stmt_in_for_in.snap index dd6f6f7965b8f..f09d2e482c30d 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/if_stmt_in_for_in.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/if_stmt_in_for_in.snap @@ -83,24 +83,43 @@ bb17: { } digraph { - 0 [ label = "" ] - 1 [ label = "" ] - 2 [ label = "" ] - 3 [ label = "ForInStatement\nVariableDeclaration" ] - 4 [ label = "" ] - 5 [ label = "Iteration(IdentifierReference(array) in expr)" ] - 6 [ label = "BlockStatement\nIfStatement" ] - 7 [ label = "Condition(if cond)" ] - 8 [ label = "BlockStatement\nExpressionStatement\nbreak" ] - 9 [ label = "unreachable" ] - 10 [ label = "IfStatement" ] - 11 [ label = "Condition(else cond)" ] - 12 [ label = "BlockStatement\nExpressionStatement\ncontinue" ] - 13 [ label = "unreachable" ] - 14 [ label = "" ] - 15 [ label = "ExpressionStatement\nExpressionStatement" ] - 16 [ label = "ExpressionStatement" ] - 17 [ label = "" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3 +ForInStatement +VariableDeclaration" shape = box] + 4 [ label = "bb4" shape = box] + 5 [ label = "bb5 +Iteration(IdentifierReference(array) in expr)" shape = box] + 6 [ label = "bb6 +BlockStatement +IfStatement" shape = box] + 7 [ label = "bb7 +Condition(if cond)" shape = box] + 8 [ label = "bb8 +BlockStatement +ExpressionStatement +break" shape = box] + 9 [ label = "bb9 +unreachable" shape = box] + 10 [ label = "bb10 +IfStatement" shape = box] + 11 [ label = "bb11 +Condition(else cond)" shape = box] + 12 [ label = "bb12 +BlockStatement +ExpressionStatement +continue" shape = box] + 13 [ label = "bb13 +unreachable" shape = box] + 14 [ label = "bb14" shape = box] + 15 [ label = "bb15 +ExpressionStatement +ExpressionStatement" shape = box] + 16 [ label = "bb16 +ExpressionStatement" shape = box] + 17 [ label = "bb17" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 3 -> 2 [ label = "Error(Implicit)" ] 1 -> 3 [ label = "NewFunction" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/import_as_function.snap b/crates/oxc_semantic/tests/integration/snapshots/import_as_function.snap index fd80beaa47729..ba325c462ee26 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/import_as_function.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/import_as_function.snap @@ -20,10 +20,12 @@ bb3: { } digraph { - 0 [ label = "" ] - 1 [ label = "ExpressionStatement" ] - 2 [ label = "" ] - 3 [ label = "ExpressionStatement" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1 +ExpressionStatement" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3 +ExpressionStatement" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 3 -> 2 [ label = "Error(Implicit)" ] 1 -> 3 [ label = "NewFunction" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/index_into_object_with_symbol_as_arg.snap b/crates/oxc_semantic/tests/integration/snapshots/index_into_object_with_symbol_as_arg.snap index 614ee7de21563..07b6dc5b88b5e 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/index_into_object_with_symbol_as_arg.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/index_into_object_with_symbol_as_arg.snap @@ -12,7 +12,8 @@ bb1: { } digraph { - 0 [ label = "" ] - 1 [ label = "ExpressionStatement" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1 +ExpressionStatement" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] } diff --git a/crates/oxc_semantic/tests/integration/snapshots/indexing_into_class_expression.snap b/crates/oxc_semantic/tests/integration/snapshots/indexing_into_class_expression.snap index eec74b2eb76f6..72caaf33324a6 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/indexing_into_class_expression.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/indexing_into_class_expression.snap @@ -13,7 +13,9 @@ bb1: { } digraph { - 0 [ label = "" ] - 1 [ label = "ExpressionStatement\nExpressionStatement" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1 +ExpressionStatement +ExpressionStatement" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] } diff --git a/crates/oxc_semantic/tests/integration/snapshots/infix_operators.snap b/crates/oxc_semantic/tests/integration/snapshots/infix_operators.snap index aaf622a2c6357..9ac3f416171ba 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/infix_operators.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/infix_operators.snap @@ -21,10 +21,12 @@ bb3: { } digraph { - 0 [ label = "" ] - 1 [ label = "ExpressionStatement\nExpressionStatement" ] - 2 [ label = "" ] - 3 [ label = "" ] + 0 [ label = "bb0" shape = box] + 1 [ label = "bb1 +ExpressionStatement +ExpressionStatement" shape = box] + 2 [ label = "bb2" shape = box] + 3 [ label = "bb3" shape = box] 1 -> 0 [ label = "Error(Implicit)" ] 2 -> 0 [ label = "Error(Implicit)" ] 3 -> 0 [ label = "Error(Implicit)" ] diff --git a/crates/oxc_semantic/tests/integration/snapshots/labeled_block_break.snap b/crates/oxc_semantic/tests/integration/snapshots/labeled_block_break.snap index 44e98e0d65b84..971843622431b 100644 --- a/crates/oxc_semantic/tests/integration/snapshots/labeled_block_break.snap +++ b/crates/oxc_semantic/tests/integration/snapshots/labeled_block_break.snap @@ -52,17 +52,27 @@ bb10: { } digraph { - 0 [ label = "" ] - 1 [ label = "TryStatement" ] - 2 [ label = "" ] - 3 [ label = "BlockStatement" ] - 4 [ label = "BlockStatement\nLabeledStatement(LABEL)\nBlockStatement\nIfStatement" ] - 5 [ label = "Condition(IdentifierReference(condition))" ] - 6 [ label = "BlockStatement\nbreak