@@ -96,21 +96,6 @@ class TestCoverage {
9696
9797 const statements = [ ] ;
9898
99- // acorn-walk's simple() fires a generic "Statement" visitor for every
100- // node dispatched in a statement position (Program body, block bodies,
101- // if/for/while bodies, etc.). This automatically covers all current and
102- // future ESTree statement types without hardcoding a list.
103- const visitor = { __proto__ : null } ;
104- visitor . Statement = ( node ) => {
105- if ( kExcludedStatementTypes . has ( node . type ) ) return ;
106- ArrayPrototypePush ( statements , {
107- __proto__ : null ,
108- startOffset : node . start ,
109- endOffset : node . end ,
110- count : 0 ,
111- } ) ;
112- } ;
113-
11499 // Parse as script with permissive flags — script mode is non-strict,
115100 // so it handles legacy CJS (e.g. `with` statements) while the
116101 // allow* flags enable ESM syntax (import/export/top-level await).
@@ -132,7 +117,22 @@ class TestCoverage {
132117 return null ;
133118 }
134119
135- acornWalkSimple ( ast , visitor ) ;
120+ // acorn-walk's simple() fires a generic "Statement" visitor for every
121+ // node dispatched in a statement position (Program body, block bodies,
122+ // if/for/while bodies, etc.). This automatically covers all current and
123+ // future ESTree statement types without hardcoding a list.
124+ acornWalkSimple ( ast , {
125+ __proto__ : null ,
126+ Statement ( node ) {
127+ if ( kExcludedStatementTypes . has ( node . type ) ) return ;
128+ ArrayPrototypePush ( statements , {
129+ __proto__ : null ,
130+ startOffset : node . start ,
131+ endOffset : node . end ,
132+ count : 0 ,
133+ } ) ;
134+ } ,
135+ } ) ;
136136
137137 this . #sourceStatements. set ( fileUrl , statements ) ;
138138 return statements ;
0 commit comments