11import { NonterminalKind } from '@nomicfoundation/slang/cst' ;
2- import { printVariant } from '../slang-printers/print -variant.js' ;
2+ import { extractVariant } from '../slang-utils/extract -variant.js' ;
33import { SlangNode } from './SlangNode.js' ;
44import { UsingClause } from './UsingClause.js' ;
55import { UsingTarget } from './UsingTarget.js' ;
@@ -12,17 +12,17 @@ import type { AstNode } from './types.d.ts';
1212export class UsingDirective extends SlangNode {
1313 readonly kind = NonterminalKind . UsingDirective ;
1414
15- clause : UsingClause ;
15+ clause : UsingClause [ 'variant' ] ;
1616
17- target : UsingTarget ;
17+ target : UsingTarget [ 'variant' ] ;
1818
1919 globalKeyword ?: string ;
2020
2121 constructor ( ast : ast . UsingDirective , options : ParserOptions < AstNode > ) {
2222 super ( ast ) ;
2323
24- this . clause = new UsingClause ( ast . clause ) ;
25- this . target = new UsingTarget ( ast . target , options ) ;
24+ this . clause = extractVariant ( new UsingClause ( ast . clause ) ) ;
25+ this . target = extractVariant ( new UsingTarget ( ast . target , options ) ) ;
2626 this . globalKeyword = ast . globalKeyword ?. unparse ( ) ;
2727
2828 this . updateMetadata ( this . clause , this . target ) ;
@@ -31,9 +31,9 @@ export class UsingDirective extends SlangNode {
3131 print ( path : AstPath < UsingDirective > , print : PrintFunction ) : Doc {
3232 return [
3333 'using ' ,
34- path . call ( printVariant ( print ) , 'clause' ) ,
34+ path . call ( print , 'clause' ) ,
3535 ' for ' ,
36- path . call ( printVariant ( print ) , 'target' ) ,
36+ path . call ( print , 'target' ) ,
3737 this . globalKeyword ? ' global;' : ';'
3838 ] ;
3939 }
0 commit comments