-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathExperimentalPragma.ts
More file actions
29 lines (22 loc) · 976 Bytes
/
ExperimentalPragma.ts
File metadata and controls
29 lines (22 loc) · 976 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
import { NonterminalKind } from '@nomicfoundation/slang/cst';
import { extractVariant } from '../slang-utils/extract-variant.js';
import { SlangNode } from './SlangNode.js';
import { ExperimentalFeature } from './ExperimentalFeature.js';
import type * as ast from '@nomicfoundation/slang/ast';
import type { AstPath, Doc, ParserOptions } from 'prettier';
import type { PrintFunction } from '../types.d.ts';
import type { AstNode } from './types.d.ts';
export class ExperimentalPragma extends SlangNode {
readonly kind = NonterminalKind.ExperimentalPragma;
feature: ExperimentalFeature['variant'];
constructor(ast: ast.ExperimentalPragma, options: ParserOptions<AstNode>) {
super(ast);
this.feature = extractVariant(
new ExperimentalFeature(ast.feature, options)
);
this.updateMetadata(this.feature);
}
print(path: AstPath<ExperimentalPragma>, print: PrintFunction): Doc {
return ['experimental ', path.call(print, 'feature')];
}
}