11import { NonterminalKind } from '@nomicfoundation/slang/cst' ;
22import { doc } from 'prettier' ;
33import { printGroupAndIndentIfBreakPair } from '../slang-printers/print-group-and-indent-if-break-pair.js' ;
4- import { printVariant } from '../slang-printers/print -variant.js' ;
4+ import { extractVariant } from '../slang-utils/extract -variant.js' ;
55import { SlangNode } from './SlangNode.js' ;
66import { TypeName } from './TypeName.js' ;
77import { StateVariableAttributes } from './StateVariableAttributes.js' ;
@@ -18,7 +18,7 @@ const { indent } = doc.builders;
1818export class StateVariableDefinition extends SlangNode {
1919 readonly kind = NonterminalKind . StateVariableDefinition ;
2020
21- typeName : TypeName ;
21+ typeName : TypeName [ 'variant' ] ;
2222
2323 attributes : StateVariableAttributes ;
2424
@@ -32,7 +32,7 @@ export class StateVariableDefinition extends SlangNode {
3232 ) {
3333 super ( ast ) ;
3434
35- this . typeName = new TypeName ( ast . typeName , options ) ;
35+ this . typeName = extractVariant ( new TypeName ( ast . typeName , options ) ) ;
3636 this . attributes = new StateVariableAttributes ( ast . attributes ) ;
3737 this . name = new TerminalNode ( ast . name ) ;
3838 if ( ast . value ) {
@@ -45,7 +45,7 @@ export class StateVariableDefinition extends SlangNode {
4545 print ( path : AstPath < StateVariableDefinition > , print : PrintFunction ) : Doc {
4646 return printGroupAndIndentIfBreakPair (
4747 [
48- path . call ( printVariant ( print ) , 'typeName' ) ,
48+ path . call ( print , 'typeName' ) ,
4949 indent ( path . call ( print , 'attributes' ) ) ,
5050 ' ' ,
5151 path . call ( print , 'name' )
0 commit comments