mirror of
https://github.com/hanzoai/eslint.git
synced 2026-10-30 19:38:10 +00:00
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
25 lines
1.1 KiB
JavaScript
25 lines
1.1 KiB
JavaScript
/*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;
|
|
}
|
|
*/
|