11import { NonterminalKind } from '@nomicfoundation/slang/cst' ;
2- import { isBlockComment } from '../slang-utils/is-comment.js' ;
32import { getNodeMetadata , updateMetadata } from '../slang-utils/metadata.js' ;
43import { IdentifierPath } from './IdentifierPath.js' ;
54import { ArgumentsDeclaration } from './ArgumentsDeclaration.js' ;
@@ -16,8 +15,6 @@ export class ModifierInvocation implements SlangNode {
1615
1716 loc ;
1817
19- cleanModifierInvocationArguments ;
20-
2118 name : IdentifierPath ;
2219
2320 arguments ?: ArgumentsDeclaration ;
@@ -43,20 +40,17 @@ export class ModifierInvocation implements SlangNode {
4340
4441 this . comments = metadata . comments ;
4542 this . loc = metadata . loc ;
43+ }
4644
47- this . cleanModifierInvocationArguments = ( ) : void => {
48- if (
49- this . arguments &&
50- this . arguments . variant . kind ===
51- NonterminalKind . PositionalArgumentsDeclaration &&
52- this . arguments . variant . arguments . items . length === 0 && // no arguments
53- ! ast . arguments ! . variant . cst . children . some ( ( child ) =>
54- isBlockComment ( child . node )
55- ) // no comments, at this point we need to check the CST
56- ) {
57- delete this . arguments ;
58- }
59- } ;
45+ cleanModifierInvocationArguments ( ) : void {
46+ if (
47+ this . arguments &&
48+ this . arguments . variant . kind ===
49+ NonterminalKind . PositionalArgumentsDeclaration &&
50+ this . arguments . variant . isEmpty ( )
51+ ) {
52+ delete this . arguments ;
53+ }
6054 }
6155
6256 print ( path : AstPath < ModifierInvocation > , print : PrintFunction ) : Doc {
0 commit comments