-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathEnumMembers.ts
More file actions
29 lines (22 loc) · 881 Bytes
/
EnumMembers.ts
File metadata and controls
29 lines (22 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { NonterminalKind } = await import('@nomicfoundation/slang/cst');
import { doc } from 'prettier';
import { printSeparatedList } from '../slang-printers/print-separated-list.js';
import { SlangNode } from './SlangNode.js';
import { Identifier } from './Identifier.js';
import type * as ast from '@nomicfoundation/slang/ast';
import type { AstPath, Doc } from 'prettier';
import type { PrintFunction } from '../types.d.ts';
const { hardline } = doc.builders;
export class EnumMembers extends SlangNode {
readonly kind = NonterminalKind.EnumMembers;
items: Identifier[];
constructor(ast: ast.EnumMembers) {
super(ast, true);
this.items = ast.items.map((item) => new Identifier(item));
}
print(path: AstPath<EnumMembers>, print: PrintFunction): Doc {
return printSeparatedList(path.map(print, 'items'), {
firstSeparator: hardline
});
}
}