-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: code path analysis for class static blocks (#15282)
Class static blocks are implicit functions. Therefore, they should be treated as separate code paths. This adds `class-static-block` code paths. Each `StaticBlock` node will start a new `class-static-block` code path. Refs #15016
- Loading branch information
1 parent
15c1397
commit b3669fd
Showing
13 changed files
with
363 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
tests/fixtures/code-path-analysis/class-static-blocks--between-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/*expected | ||
initial->s2_1->s2_2->s2_3; | ||
s2_1->s2_3->final; | ||
*/ | ||
/*expected | ||
initial->s3_1->s3_2->s3_3->s3_4; | ||
s3_1->s3_4; | ||
s3_2->s3_4->final; | ||
*/ | ||
/*expected | ||
initial->s4_1->s4_2->s4_3->s4_4->s4_5; | ||
s4_1->s4_5; | ||
s4_2->s4_5; | ||
s4_3->s4_5->final; | ||
*/ | ||
/*expected | ||
initial->s1_1->final; | ||
*/ | ||
class Foo { bar = a || b; static { x || y || z } baz = p || q || r || s; } | ||
|
||
/*DOT | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s2_1[label="LogicalExpression:enter\nIdentifier (a)"]; | ||
s2_2[label="Identifier (b)"]; | ||
s2_3[label="LogicalExpression:exit"]; | ||
initial->s2_1->s2_2->s2_3; | ||
s2_1->s2_3->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s3_1[label="StaticBlock:enter\nExpressionStatement:enter\nLogicalExpression:enter\nLogicalExpression:enter\nIdentifier (x)"]; | ||
s3_2[label="Identifier (y)\nLogicalExpression:exit"]; | ||
s3_3[label="Identifier (z)"]; | ||
s3_4[label="LogicalExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"]; | ||
initial->s3_1->s3_2->s3_3->s3_4; | ||
s3_1->s3_4; | ||
s3_2->s3_4->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s4_1[label="LogicalExpression:enter\nLogicalExpression:enter\nLogicalExpression:enter\nIdentifier (p)"]; | ||
s4_2[label="Identifier (q)\nLogicalExpression:exit"]; | ||
s4_3[label="Identifier (r)\nLogicalExpression:exit"]; | ||
s4_4[label="Identifier (s)"]; | ||
s4_5[label="LogicalExpression:exit"]; | ||
initial->s4_1->s4_2->s4_3->s4_4->s4_5; | ||
s4_1->s4_5; | ||
s4_2->s4_5; | ||
s4_3->s4_5->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nPropertyDefinition:enter\nIdentifier (bar)\nLogicalExpression\nPropertyDefinition:exit\nStaticBlock\nPropertyDefinition:enter\nIdentifier (baz)\nLogicalExpression\nPropertyDefinition:exit\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"]; | ||
initial->s1_1->final; | ||
} | ||
*/ |
65 changes: 65 additions & 0 deletions
65
tests/fixtures/code-path-analysis/class-static-blocks--between-methods.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/*expected | ||
initial->s2_1->s2_2->s2_3; | ||
s2_1->s2_3->final; | ||
*/ | ||
/*expected | ||
initial->s3_1->s3_2->s3_3->s3_4; | ||
s3_1->s3_4; | ||
s3_2->s3_4->final; | ||
*/ | ||
/*expected | ||
initial->s4_1->s4_2->s4_3->s4_4->s4_5; | ||
s4_1->s4_5; | ||
s4_2->s4_5; | ||
s4_3->s4_5->final; | ||
*/ | ||
/*expected | ||
initial->s1_1->final; | ||
*/ | ||
class Foo { bar () { a || b } static { x || y || z } baz() { p || q || r || s } } | ||
|
||
/*DOT | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s2_1[label="FunctionExpression:enter\nBlockStatement:enter\nExpressionStatement:enter\nLogicalExpression:enter\nIdentifier (a)"]; | ||
s2_2[label="Identifier (b)"]; | ||
s2_3[label="LogicalExpression:exit\nExpressionStatement:exit\nBlockStatement:exit\nFunctionExpression:exit"]; | ||
initial->s2_1->s2_2->s2_3; | ||
s2_1->s2_3->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s3_1[label="StaticBlock:enter\nExpressionStatement:enter\nLogicalExpression:enter\nLogicalExpression:enter\nIdentifier (x)"]; | ||
s3_2[label="Identifier (y)\nLogicalExpression:exit"]; | ||
s3_3[label="Identifier (z)"]; | ||
s3_4[label="LogicalExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"]; | ||
initial->s3_1->s3_2->s3_3->s3_4; | ||
s3_1->s3_4; | ||
s3_2->s3_4->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s4_1[label="FunctionExpression:enter\nBlockStatement:enter\nExpressionStatement:enter\nLogicalExpression:enter\nLogicalExpression:enter\nLogicalExpression:enter\nIdentifier (p)"]; | ||
s4_2[label="Identifier (q)\nLogicalExpression:exit"]; | ||
s4_3[label="Identifier (r)\nLogicalExpression:exit"]; | ||
s4_4[label="Identifier (s)"]; | ||
s4_5[label="LogicalExpression:exit\nExpressionStatement:exit\nBlockStatement:exit\nFunctionExpression:exit"]; | ||
initial->s4_1->s4_2->s4_3->s4_4->s4_5; | ||
s4_1->s4_5; | ||
s4_2->s4_5; | ||
s4_3->s4_5->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nMethodDefinition:enter\nIdentifier (bar)\nFunctionExpression\nMethodDefinition:exit\nStaticBlock\nMethodDefinition:enter\nIdentifier (baz)\nFunctionExpression\nMethodDefinition:exit\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"]; | ||
initial->s1_1->final; | ||
} | ||
*/ |
29 changes: 29 additions & 0 deletions
29
tests/fixtures/code-path-analysis/class-static-blocks--conditional.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/*expected | ||
initial->s2_1->s2_2->s2_4; | ||
s2_1->s2_3->s2_4->final; | ||
*/ | ||
/*expected | ||
initial->s1_1->final; | ||
*/ | ||
class Foo { static { this.bar = a ? b : c; } } | ||
|
||
/*DOT | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s2_1[label="StaticBlock:enter\nExpressionStatement:enter\nAssignmentExpression:enter\nMemberExpression:enter\nThisExpression\nIdentifier (bar)\nMemberExpression:exit\nConditionalExpression:enter\nIdentifier (a)"]; | ||
s2_2[label="Identifier (b)"]; | ||
s2_4[label="ConditionalExpression:exit\nAssignmentExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"]; | ||
s2_3[label="Identifier (c)"]; | ||
initial->s2_1->s2_2->s2_4; | ||
s2_1->s2_3->s2_4->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"]; | ||
initial->s1_1->final; | ||
} | ||
*/ |
24 changes: 24 additions & 0 deletions
24
tests/fixtures/code-path-analysis/class-static-blocks--empty.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/*expected | ||
initial->s2_1->final; | ||
*/ | ||
/*expected | ||
initial->s1_1->final; | ||
*/ | ||
class Foo { static {} } | ||
|
||
/*DOT | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s2_1[label="StaticBlock"]; | ||
initial->s2_1->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"]; | ||
initial->s1_1->final; | ||
} | ||
*/ |
34 changes: 34 additions & 0 deletions
34
tests/fixtures/code-path-analysis/class-static-blocks--function-inside.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*expected | ||
initial->s3_1->final; | ||
*/ | ||
/*expected | ||
initial->s2_1->final; | ||
*/ | ||
/*expected | ||
initial->s1_1->final; | ||
*/ | ||
class Foo { static { (p) => {} } } | ||
|
||
/*DOT | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s3_1[label="ArrowFunctionExpression:enter\nIdentifier (p)\nBlockStatement\nArrowFunctionExpression:exit"]; | ||
initial->s3_1->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s2_1[label="StaticBlock:enter\nExpressionStatement:enter\nArrowFunctionExpression\nExpressionStatement:exit\nStaticBlock:exit"]; | ||
initial->s2_1->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"]; | ||
initial->s1_1->final; | ||
} | ||
*/ |
29 changes: 29 additions & 0 deletions
29
tests/fixtures/code-path-analysis/class-static-blocks--if-else.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/*expected | ||
initial->s2_1->s2_2->s2_4; | ||
s2_1->s2_3->s2_4->final; | ||
*/ | ||
/*expected | ||
initial->s1_1->final; | ||
*/ | ||
class Foo { static { if (bar) { this.baz = 1; } else { this.qux = 2; } } } | ||
|
||
/*DOT | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s2_1[label="StaticBlock:enter\nIfStatement:enter\nIdentifier (bar)"]; | ||
s2_2[label="BlockStatement:enter\nExpressionStatement:enter\nAssignmentExpression:enter\nMemberExpression:enter\nThisExpression\nIdentifier (baz)\nMemberExpression:exit\nLiteral (1)\nAssignmentExpression:exit\nExpressionStatement:exit\nBlockStatement:exit"]; | ||
s2_4[label="IfStatement:exit\nStaticBlock:exit"]; | ||
s2_3[label="BlockStatement:enter\nExpressionStatement:enter\nAssignmentExpression:enter\nMemberExpression:enter\nThisExpression\nIdentifier (qux)\nMemberExpression:exit\nLiteral (2)\nAssignmentExpression:exit\nExpressionStatement:exit\nBlockStatement:exit"]; | ||
initial->s2_1->s2_2->s2_4; | ||
s2_1->s2_3->s2_4->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"]; | ||
initial->s1_1->final; | ||
} | ||
*/ |
34 changes: 34 additions & 0 deletions
34
tests/fixtures/code-path-analysis/class-static-blocks--multiple-1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*expected | ||
initial->s2_1->final; | ||
*/ | ||
/*expected | ||
initial->s3_1->final; | ||
*/ | ||
/*expected | ||
initial->s1_1->final; | ||
*/ | ||
class Foo { static { this.bar = 1; } static { this.baz = 2; } } | ||
|
||
/*DOT | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s2_1[label="StaticBlock:enter\nExpressionStatement:enter\nAssignmentExpression:enter\nMemberExpression:enter\nThisExpression\nIdentifier (bar)\nMemberExpression:exit\nLiteral (1)\nAssignmentExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"]; | ||
initial->s2_1->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s3_1[label="StaticBlock:enter\nExpressionStatement:enter\nAssignmentExpression:enter\nMemberExpression:enter\nThisExpression\nIdentifier (baz)\nMemberExpression:exit\nLiteral (2)\nAssignmentExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"]; | ||
initial->s3_1->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"]; | ||
initial->s1_1->final; | ||
} | ||
*/ |
45 changes: 45 additions & 0 deletions
45
tests/fixtures/code-path-analysis/class-static-blocks--multiple-2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/*expected | ||
initial->s2_1->s2_2->s2_3->s2_4; | ||
s2_1->s2_4; | ||
s2_2->s2_4->final; | ||
*/ | ||
/*expected | ||
initial->s3_1->s3_2->s3_3; | ||
s3_1->s3_3->final; | ||
*/ | ||
/*expected | ||
initial->s1_1->final; | ||
*/ | ||
class Foo { static { x || y || z } static { p || q } } | ||
|
||
/*DOT | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s2_1[label="StaticBlock:enter\nExpressionStatement:enter\nLogicalExpression:enter\nLogicalExpression:enter\nIdentifier (x)"]; | ||
s2_2[label="Identifier (y)\nLogicalExpression:exit"]; | ||
s2_3[label="Identifier (z)"]; | ||
s2_4[label="LogicalExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"]; | ||
initial->s2_1->s2_2->s2_3->s2_4; | ||
s2_1->s2_4; | ||
s2_2->s2_4->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s3_1[label="StaticBlock:enter\nExpressionStatement:enter\nLogicalExpression:enter\nIdentifier (p)"]; | ||
s3_2[label="Identifier (q)"]; | ||
s3_3[label="LogicalExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"]; | ||
initial->s3_1->s3_2->s3_3; | ||
s3_1->s3_3->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"]; | ||
initial->s1_1->final; | ||
} | ||
*/ |
24 changes: 24 additions & 0 deletions
24
tests/fixtures/code-path-analysis/class-static-blocks--simple.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/*expected | ||
initial->s2_1->final; | ||
*/ | ||
/*expected | ||
initial->s1_1->final; | ||
*/ | ||
class Foo { static { this.bar = baz; } } | ||
|
||
/*DOT | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s2_1[label="StaticBlock:enter\nExpressionStatement:enter\nAssignmentExpression:enter\nMemberExpression:enter\nThisExpression\nIdentifier (bar)\nMemberExpression:exit\nIdentifier (baz)\nAssignmentExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"]; | ||
initial->s2_1->final; | ||
} | ||
digraph { | ||
node[shape=box,style="rounded,filled",fillcolor=white]; | ||
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25]; | ||
s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"]; | ||
initial->s1_1->final; | ||
} | ||
*/ |
Oops, something went wrong.