Files
eslint/tests/fixtures/code-path-analysis/class-static-blocks--simple.js
Milos DjermanovicandGitHub 93aa4f8b35 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
2021-11-17 17:15:18 +01:00

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;
}
*/