/
spec.ts
96 lines (91 loc) · 2.46 KB
/
spec.ts
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import type { AST_NODE_TYPES } from '../../ast-node-types';
import type { BaseNode } from '../../base/BaseNode';
import type {
LetOrConstOrVarDeclarator,
UsingInForOfDeclarator,
UsingInNomalConextDeclarator,
} from '../../special/VariableDeclarator/spec';
export interface LetOrConstOrVarDeclaration extends BaseNode {
type: AST_NODE_TYPES.VariableDeclaration;
/**
* The variables declared by this declaration.
* Note that there may be 0 declarations (i.e. `const;`).
* ```
* let x;
* let y, z;
* ```
*/
// TODO(#1852) - this should be guaranteed to have at least 1 element in it.
declarations: LetOrConstOrVarDeclarator[];
/**
* Whether the declaration is `declare`d
* ```
* declare const x = 1;
* ```
*/
declare: boolean;
/**
* The keyword used to declare the variable(s)
* ```
* const x = 1;
* let y = 2;
* var z = 3;
* ```
*/
kind: 'const' | 'let' | 'var';
}
export interface UsingInNomalConextDeclaration extends BaseNode {
type: AST_NODE_TYPES.VariableDeclaration;
/**
* The variables declared by this declaration.
* Note that there may be 0 declarations (i.e. `const;`).
* ```
* using x = 1;
* using y =1, z = 2;
* ```
*/
// TODO(#1852) - this should be guaranteed to have at least 1 element in it.
declarations: UsingInNomalConextDeclarator[];
/**
* This value will always be `false`
* because 'declare' modifier cannot appear on a 'using' declaration.
*/
declare: false;
/**
* The keyword used to declare the variable(s)
* ```
* using x = 1;
* await using y = 2;
* ```
*/
kind: 'await using' | 'using';
}
export interface UsingInForOfDeclaration extends BaseNode {
type: AST_NODE_TYPES.VariableDeclaration;
/**
* The variables declared by this declaration.
* Note that there may be 0 declarations (i.e. `const;`).
* ```
* for(using x of y){}
* ```
*/
// TODO - this should be guaranteed to have 1 element in it.
declarations: UsingInForOfDeclarator[];
/**
* This value will always be `false`
* because 'declare' modifier cannot appear on a 'using' declaration.
*/
declare: false;
/**
* The keyword used to declare the variable(s)
* ```
* for(using x of y){}
* for(await using x of y){}
* ```
*/
kind: 'await using' | 'using';
}
export type UsingDeclaration =
| UsingInForOfDeclaration
| UsingInNomalConextDeclaration;
export type VariableDeclaration = LetOrConstOrVarDeclaration | UsingDeclaration;