11import { NonterminalKind } from '@nomicfoundation/slang/cst' ;
22import { joinExisting } from '../slang-utils/join-existing.js' ;
3- import { printVariant } from '../slang-printers/print -variant.js' ;
3+ import { extractVariant } from '../slang-utils/extract -variant.js' ;
44import { SlangNode } from './SlangNode.js' ;
55import { MappingKeyType } from './MappingKeyType.js' ;
66import { TerminalNode } from './TerminalNode.js' ;
@@ -12,14 +12,14 @@ import type { PrintFunction } from '../types.d.ts';
1212export class MappingKey extends SlangNode {
1313 readonly kind = NonterminalKind . MappingKey ;
1414
15- keyType : MappingKeyType ;
15+ keyType : MappingKeyType [ 'variant' ] ;
1616
1717 name ?: TerminalNode ;
1818
1919 constructor ( ast : ast . MappingKey ) {
2020 super ( ast ) ;
2121
22- this . keyType = new MappingKeyType ( ast . keyType ) ;
22+ this . keyType = extractVariant ( new MappingKeyType ( ast . keyType ) ) ;
2323 if ( ast . name ) {
2424 this . name = new TerminalNode ( ast . name ) ;
2525 }
@@ -29,7 +29,7 @@ export class MappingKey extends SlangNode {
2929
3030 print ( path : AstPath < MappingKey > , print : PrintFunction ) : Doc {
3131 return joinExisting ( ' ' , [
32- path . call ( printVariant ( print ) , 'keyType' ) ,
32+ path . call ( print , 'keyType' ) ,
3333 path . call ( print , 'name' )
3434 ] ) ;
3535 }
0 commit comments