@ohos-ports/hermes-parser 0.37.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/HermesAST.js.flow +57 -0
- package/dist/HermesASTAdapter.js +192 -0
- package/dist/HermesASTAdapter.js.flow +189 -0
- package/dist/HermesParser.js +108 -0
- package/dist/HermesParser.js.flow +163 -0
- package/dist/HermesParserDecodeUTF8String.js +68 -0
- package/dist/HermesParserDecodeUTF8String.js.flow +65 -0
- package/dist/HermesParserDeserializer.js +242 -0
- package/dist/HermesParserDeserializer.js.flow +260 -0
- package/dist/HermesParserNodeDeserializers.js +2594 -0
- package/dist/HermesParserNodeDeserializers.js.flow +16 -0
- package/dist/HermesParserWASM.js +6 -0
- package/dist/HermesParserWASM.js.flow +97 -0
- package/dist/HermesToESTreeAdapter.js +441 -0
- package/dist/HermesToESTreeAdapter.js.flow +423 -0
- package/dist/ParserOptions.js +20 -0
- package/dist/ParserOptions.js.flow +44 -0
- package/dist/babel/TransformESTreeToBabel.js +1197 -0
- package/dist/babel/TransformESTreeToBabel.js.flow +1349 -0
- package/dist/estree/StripFlowTypes.js +175 -0
- package/dist/estree/StripFlowTypes.js.flow +158 -0
- package/dist/estree/StripFlowTypesForBabel.js +215 -0
- package/dist/estree/StripFlowTypesForBabel.js.flow +216 -0
- package/dist/estree/TransformComponentSyntax.js +792 -0
- package/dist/estree/TransformComponentSyntax.js.flow +864 -0
- package/dist/estree/TransformEnumSyntax.js +106 -0
- package/dist/estree/TransformEnumSyntax.js.flow +125 -0
- package/dist/estree/TransformMatchSyntax.js +1083 -0
- package/dist/estree/TransformMatchSyntax.js.flow +991 -0
- package/dist/estree/TransformRecordSyntax.js +296 -0
- package/dist/estree/TransformRecordSyntax.js.flow +310 -0
- package/dist/generated/ESTreeVisitorKeys.js +233 -0
- package/dist/generated/ESTreeVisitorKeys.js.flow +15 -0
- package/dist/generated/ParserVisitorKeys.js +842 -0
- package/dist/generated/ParserVisitorKeys.js.flow +17 -0
- package/dist/getModuleDocblock.js +112 -0
- package/dist/getModuleDocblock.js.flow +118 -0
- package/dist/index.js +170 -0
- package/dist/index.js.flow +131 -0
- package/dist/src/HermesASTAdapter.js +192 -0
- package/dist/src/HermesParser.js +108 -0
- package/dist/src/HermesParserDecodeUTF8String.js +68 -0
- package/dist/src/HermesParserDeserializer.js +242 -0
- package/dist/src/HermesParserNodeDeserializers.js +2594 -0
- package/dist/src/HermesToESTreeAdapter.js +441 -0
- package/dist/src/ParserOptions.js +20 -0
- package/dist/src/babel/TransformESTreeToBabel.js +1197 -0
- package/dist/src/estree/StripFlowTypes.js +175 -0
- package/dist/src/estree/StripFlowTypesForBabel.js +215 -0
- package/dist/src/estree/TransformComponentSyntax.js +792 -0
- package/dist/src/estree/TransformEnumSyntax.js +106 -0
- package/dist/src/estree/TransformMatchSyntax.js +1083 -0
- package/dist/src/estree/TransformRecordSyntax.js +296 -0
- package/dist/src/generated/ESTreeVisitorKeys.js +233 -0
- package/dist/src/generated/ParserVisitorKeys.js +842 -0
- package/dist/src/getModuleDocblock.js +112 -0
- package/dist/src/index.js +170 -0
- package/dist/src/transform/SimpleTransform.js +145 -0
- package/dist/src/transform/astArrayMutationHelpers.js +62 -0
- package/dist/src/transform/astNodeMutationHelpers.js +201 -0
- package/dist/src/traverse/SimpleTraverser.js +139 -0
- package/dist/src/traverse/getVisitorKeys.js +39 -0
- package/dist/src/utils/Builders.js +190 -0
- package/dist/src/utils/GenID.js +46 -0
- package/dist/src/utils/createSyntaxError.js +25 -0
- package/dist/src/utils/isReservedWord.js +62 -0
- package/dist/src/utils/mutateESTreeASTForPrettier.js +127 -0
- package/dist/transform/SimpleTransform.js +145 -0
- package/dist/transform/SimpleTransform.js.flow +168 -0
- package/dist/transform/astArrayMutationHelpers.js +62 -0
- package/dist/transform/astArrayMutationHelpers.js.flow +71 -0
- package/dist/transform/astNodeMutationHelpers.js +201 -0
- package/dist/transform/astNodeMutationHelpers.js.flow +252 -0
- package/dist/traverse/SimpleTraverser.js +139 -0
- package/dist/traverse/SimpleTraverser.js.flow +133 -0
- package/dist/traverse/getVisitorKeys.js +39 -0
- package/dist/traverse/getVisitorKeys.js.flow +38 -0
- package/dist/utils/Builders.js +190 -0
- package/dist/utils/Builders.js.flow +218 -0
- package/dist/utils/GenID.js +46 -0
- package/dist/utils/GenID.js.flow +39 -0
- package/dist/utils/createSyntaxError.js +25 -0
- package/dist/utils/createSyntaxError.js.flow +24 -0
- package/dist/utils/isReservedWord.js +62 -0
- package/dist/utils/isReservedWord.js.flow +57 -0
- package/dist/utils/mutateESTreeASTForPrettier.js +127 -0
- package/dist/utils/mutateESTreeASTForPrettier.js.flow +130 -0
- package/package.json +30 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* strict
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
'use strict';
|
|
11
|
+
/**
|
|
12
|
+
* Transform record declarations.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
Object.defineProperty(exports, "__esModule", {
|
|
16
|
+
value: true
|
|
17
|
+
});
|
|
18
|
+
exports.transformProgram = transformProgram;
|
|
19
|
+
|
|
20
|
+
var _hermesEstree = require("hermes-estree");
|
|
21
|
+
|
|
22
|
+
var _SimpleTransform = require("../transform/SimpleTransform");
|
|
23
|
+
|
|
24
|
+
var _astNodeMutationHelpers = require("../transform/astNodeMutationHelpers");
|
|
25
|
+
|
|
26
|
+
var _Builders = require("../utils/Builders");
|
|
27
|
+
|
|
28
|
+
var _isReservedWord = _interopRequireDefault(require("../utils/isReservedWord"));
|
|
29
|
+
|
|
30
|
+
var _GenID = _interopRequireDefault(require("../utils/GenID"));
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
+
|
|
34
|
+
function nameOfKey(key) {
|
|
35
|
+
switch (key.type) {
|
|
36
|
+
case 'Identifier':
|
|
37
|
+
return key.name;
|
|
38
|
+
|
|
39
|
+
case 'Literal':
|
|
40
|
+
if ((0, _hermesEstree.isBigIntLiteral)(key)) {
|
|
41
|
+
return key.bigint;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return String(key.value);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function mapRecordDeclaration(genID, node) {
|
|
49
|
+
const ownProperties = [];
|
|
50
|
+
const staticProperties = [];
|
|
51
|
+
const methods = [];
|
|
52
|
+
const staticMethods = [];
|
|
53
|
+
|
|
54
|
+
for (const element of node.body.elements) {
|
|
55
|
+
switch (element.type) {
|
|
56
|
+
case 'RecordDeclarationProperty':
|
|
57
|
+
ownProperties.push(element);
|
|
58
|
+
break;
|
|
59
|
+
|
|
60
|
+
case 'RecordDeclarationStaticProperty':
|
|
61
|
+
staticProperties.push(element);
|
|
62
|
+
break;
|
|
63
|
+
|
|
64
|
+
case 'MethodDefinition':
|
|
65
|
+
if (element.static) {
|
|
66
|
+
staticMethods.push(element);
|
|
67
|
+
} else {
|
|
68
|
+
methods.push(element);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const reservedPropNames = new Map(); // Create constructor parameter as an object pattern with all properties
|
|
76
|
+
|
|
77
|
+
const constructorParam = {
|
|
78
|
+
type: 'ObjectPattern',
|
|
79
|
+
properties: ownProperties.map(prop => {
|
|
80
|
+
const {
|
|
81
|
+
key,
|
|
82
|
+
defaultValue
|
|
83
|
+
} = prop;
|
|
84
|
+
const keyName = nameOfKey(key);
|
|
85
|
+
|
|
86
|
+
const getValue = bindingIdent => defaultValue != null ? {
|
|
87
|
+
type: 'AssignmentPattern',
|
|
88
|
+
left: bindingIdent,
|
|
89
|
+
right: (0, _astNodeMutationHelpers.deepCloneNode)(defaultValue),
|
|
90
|
+
...(0, _Builders.etc)()
|
|
91
|
+
} : bindingIdent;
|
|
92
|
+
|
|
93
|
+
switch (key.type) {
|
|
94
|
+
case 'Identifier':
|
|
95
|
+
{
|
|
96
|
+
const needsNewBinding = (0, _isReservedWord.default)(keyName);
|
|
97
|
+
const bindingName = needsNewBinding ? genID.id() : keyName;
|
|
98
|
+
const bindingIdent = (0, _Builders.ident)(bindingName);
|
|
99
|
+
|
|
100
|
+
if (needsNewBinding) {
|
|
101
|
+
reservedPropNames.set(keyName, bindingName);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (needsNewBinding) {
|
|
105
|
+
return {
|
|
106
|
+
type: 'Property',
|
|
107
|
+
kind: 'init',
|
|
108
|
+
key: (0, _astNodeMutationHelpers.shallowCloneNode)(key),
|
|
109
|
+
value: getValue(bindingIdent),
|
|
110
|
+
shorthand: false,
|
|
111
|
+
method: false,
|
|
112
|
+
computed: false,
|
|
113
|
+
...(0, _Builders.etc)(),
|
|
114
|
+
parent: _Builders.EMPTY_PARENT
|
|
115
|
+
};
|
|
116
|
+
} else {
|
|
117
|
+
return {
|
|
118
|
+
type: 'Property',
|
|
119
|
+
kind: 'init',
|
|
120
|
+
key: (0, _astNodeMutationHelpers.shallowCloneNode)(key),
|
|
121
|
+
value: getValue(bindingIdent),
|
|
122
|
+
shorthand: true,
|
|
123
|
+
method: false,
|
|
124
|
+
computed: false,
|
|
125
|
+
...(0, _Builders.etc)(),
|
|
126
|
+
parent: _Builders.EMPTY_PARENT
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
case 'Literal':
|
|
132
|
+
{
|
|
133
|
+
const bindingName = genID.id();
|
|
134
|
+
const bindingIdent = (0, _Builders.ident)(bindingName);
|
|
135
|
+
reservedPropNames.set(keyName, bindingName);
|
|
136
|
+
return {
|
|
137
|
+
type: 'Property',
|
|
138
|
+
kind: 'init',
|
|
139
|
+
key: (0, _astNodeMutationHelpers.shallowCloneNode)(key),
|
|
140
|
+
value: getValue(bindingIdent),
|
|
141
|
+
shorthand: false,
|
|
142
|
+
method: false,
|
|
143
|
+
computed: false,
|
|
144
|
+
...(0, _Builders.etc)(),
|
|
145
|
+
parent: _Builders.EMPTY_PARENT
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}),
|
|
150
|
+
typeAnnotation: null,
|
|
151
|
+
...(0, _Builders.etc)()
|
|
152
|
+
}; // Create the constructor method
|
|
153
|
+
|
|
154
|
+
const constructor = {
|
|
155
|
+
type: 'MethodDefinition',
|
|
156
|
+
key: (0, _Builders.ident)('constructor'),
|
|
157
|
+
kind: 'constructor',
|
|
158
|
+
computed: false,
|
|
159
|
+
static: false,
|
|
160
|
+
decorators: [],
|
|
161
|
+
value: {
|
|
162
|
+
type: 'FunctionExpression',
|
|
163
|
+
id: null,
|
|
164
|
+
params: [constructorParam],
|
|
165
|
+
body: {
|
|
166
|
+
type: 'BlockStatement',
|
|
167
|
+
body: ownProperties.map(({
|
|
168
|
+
key
|
|
169
|
+
}) => {
|
|
170
|
+
var _reservedPropNames$ge;
|
|
171
|
+
|
|
172
|
+
const keyName = nameOfKey(key);
|
|
173
|
+
const bindingIdent = (0, _Builders.ident)((_reservedPropNames$ge = reservedPropNames.get(keyName)) != null ? _reservedPropNames$ge : keyName);
|
|
174
|
+
const object = {
|
|
175
|
+
type: 'ThisExpression',
|
|
176
|
+
...(0, _Builders.etc)()
|
|
177
|
+
};
|
|
178
|
+
const memberExpression = key.type === 'Identifier' ? {
|
|
179
|
+
type: 'MemberExpression',
|
|
180
|
+
object,
|
|
181
|
+
property: (0, _astNodeMutationHelpers.shallowCloneNode)(key),
|
|
182
|
+
computed: false,
|
|
183
|
+
optional: false,
|
|
184
|
+
...(0, _Builders.etc)()
|
|
185
|
+
} : {
|
|
186
|
+
type: 'MemberExpression',
|
|
187
|
+
object,
|
|
188
|
+
property: (0, _astNodeMutationHelpers.shallowCloneNode)(key),
|
|
189
|
+
computed: true,
|
|
190
|
+
optional: false,
|
|
191
|
+
...(0, _Builders.etc)()
|
|
192
|
+
};
|
|
193
|
+
return {
|
|
194
|
+
type: 'ExpressionStatement',
|
|
195
|
+
expression: {
|
|
196
|
+
type: 'AssignmentExpression',
|
|
197
|
+
operator: '=',
|
|
198
|
+
left: memberExpression,
|
|
199
|
+
right: bindingIdent,
|
|
200
|
+
...(0, _Builders.etc)()
|
|
201
|
+
},
|
|
202
|
+
directive: null,
|
|
203
|
+
...(0, _Builders.etc)()
|
|
204
|
+
};
|
|
205
|
+
}),
|
|
206
|
+
...(0, _Builders.etc)()
|
|
207
|
+
},
|
|
208
|
+
generator: false,
|
|
209
|
+
async: false,
|
|
210
|
+
predicate: null,
|
|
211
|
+
returnType: null,
|
|
212
|
+
typeParameters: null,
|
|
213
|
+
...(0, _Builders.etc)()
|
|
214
|
+
},
|
|
215
|
+
...(0, _Builders.etc)(),
|
|
216
|
+
parent: _Builders.EMPTY_PARENT
|
|
217
|
+
};
|
|
218
|
+
const classStaticProperties = staticProperties.map(prop => ({
|
|
219
|
+
type: 'PropertyDefinition',
|
|
220
|
+
key: (0, _astNodeMutationHelpers.shallowCloneNode)(prop.key),
|
|
221
|
+
value: (0, _astNodeMutationHelpers.deepCloneNode)(prop.value),
|
|
222
|
+
static: true,
|
|
223
|
+
decorators: [],
|
|
224
|
+
typeAnnotation: null,
|
|
225
|
+
variance: null,
|
|
226
|
+
computed: false,
|
|
227
|
+
declare: false,
|
|
228
|
+
optional: false,
|
|
229
|
+
...(0, _Builders.etc)(),
|
|
230
|
+
parent: _Builders.EMPTY_PARENT
|
|
231
|
+
}));
|
|
232
|
+
const classBodyElements = [constructor, ...methods, ...classStaticProperties, ...staticMethods];
|
|
233
|
+
return {
|
|
234
|
+
type: 'ClassDeclaration',
|
|
235
|
+
id: (0, _astNodeMutationHelpers.shallowCloneNode)(node.id),
|
|
236
|
+
body: {
|
|
237
|
+
type: 'ClassBody',
|
|
238
|
+
body: classBodyElements,
|
|
239
|
+
...(0, _Builders.etc)(),
|
|
240
|
+
parent: _Builders.EMPTY_PARENT
|
|
241
|
+
},
|
|
242
|
+
superClass: null,
|
|
243
|
+
typeParameters: null,
|
|
244
|
+
superTypeArguments: null,
|
|
245
|
+
implements: [],
|
|
246
|
+
decorators: [],
|
|
247
|
+
...(0, _Builders.etc)()
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function mapRecordExpression(node) {
|
|
252
|
+
const obj = {
|
|
253
|
+
type: 'ObjectExpression',
|
|
254
|
+
properties: node.properties.properties,
|
|
255
|
+
...(0, _Builders.etc)()
|
|
256
|
+
};
|
|
257
|
+
return {
|
|
258
|
+
type: 'NewExpression',
|
|
259
|
+
callee: node.recordConstructor,
|
|
260
|
+
arguments: [obj],
|
|
261
|
+
typeArguments: null,
|
|
262
|
+
...(0, _Builders.etc)()
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function transformProgram(program, _options) {
|
|
267
|
+
const genID = new _GenID.default('r');
|
|
268
|
+
return _SimpleTransform.SimpleTransform.transformProgram(program, {
|
|
269
|
+
transform(node) {
|
|
270
|
+
switch (node.type) {
|
|
271
|
+
case 'RecordDeclaration':
|
|
272
|
+
{
|
|
273
|
+
return mapRecordDeclaration(genID, node);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
case 'RecordExpression':
|
|
277
|
+
{
|
|
278
|
+
return mapRecordExpression(node);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
case 'Identifier':
|
|
282
|
+
{
|
|
283
|
+
// A rudimentary check to avoid some collisions with our generated
|
|
284
|
+
// variable names. Ideally, we would have access a scope analyzer
|
|
285
|
+
// inside the transform instead.
|
|
286
|
+
genID.addUsage(node.name);
|
|
287
|
+
return node;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
default:
|
|
291
|
+
return node;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
});
|
|
296
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @generated
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* !!! GENERATED FILE !!!
|
|
14
|
+
*
|
|
15
|
+
* Any manual changes to this file will be overwritten. To regenerate run `yarn build`.
|
|
16
|
+
*/
|
|
17
|
+
// lint directives to let us do some basic validation of generated files
|
|
18
|
+
|
|
19
|
+
/* eslint no-undef: 'error', no-unused-vars: ['error', {vars: "local"}], no-redeclare: 'error' */
|
|
20
|
+
|
|
21
|
+
/* global NonNullable, Partial, Readonly, ReadonlyArray, $FlowFixMe */
|
|
22
|
+
'use strict';
|
|
23
|
+
|
|
24
|
+
module.exports = {
|
|
25
|
+
AnyTypeAnnotation: [],
|
|
26
|
+
ArrayExpression: ['elements'],
|
|
27
|
+
ArrayPattern: ['elements', 'typeAnnotation'],
|
|
28
|
+
ArrayTypeAnnotation: ['elementType'],
|
|
29
|
+
ArrowFunctionExpression: ['params', 'body', 'typeParameters', 'returnType', 'predicate'],
|
|
30
|
+
AsConstExpression: ['expression'],
|
|
31
|
+
AsExpression: ['expression', 'typeAnnotation'],
|
|
32
|
+
AssignmentExpression: ['left', 'right'],
|
|
33
|
+
AssignmentPattern: ['left', 'right'],
|
|
34
|
+
AwaitExpression: ['argument'],
|
|
35
|
+
BigIntLiteralTypeAnnotation: [],
|
|
36
|
+
BigIntTypeAnnotation: [],
|
|
37
|
+
BinaryExpression: ['left', 'right'],
|
|
38
|
+
BlockStatement: ['body'],
|
|
39
|
+
BooleanLiteralTypeAnnotation: [],
|
|
40
|
+
BooleanTypeAnnotation: [],
|
|
41
|
+
BreakStatement: ['label'],
|
|
42
|
+
CallExpression: ['callee', 'typeArguments', 'arguments'],
|
|
43
|
+
CatchClause: ['param', 'body'],
|
|
44
|
+
ChainExpression: ['expression'],
|
|
45
|
+
ClassBody: ['body'],
|
|
46
|
+
ClassDeclaration: ['id', 'typeParameters', 'superClass', 'superTypeArguments', 'implements', 'decorators', 'body'],
|
|
47
|
+
ClassExpression: ['id', 'typeParameters', 'superClass', 'superTypeArguments', 'implements', 'decorators', 'body'],
|
|
48
|
+
ClassImplements: ['id', 'typeParameters'],
|
|
49
|
+
ComponentDeclaration: ['id', 'params', 'body', 'typeParameters', 'rendersType'],
|
|
50
|
+
ComponentParameter: ['name', 'local'],
|
|
51
|
+
ComponentTypeAnnotation: ['params', 'rest', 'typeParameters', 'rendersType'],
|
|
52
|
+
ComponentTypeParameter: ['name', 'typeAnnotation'],
|
|
53
|
+
ConditionalExpression: ['test', 'consequent', 'alternate'],
|
|
54
|
+
ConditionalTypeAnnotation: ['checkType', 'extendsType', 'trueType', 'falseType'],
|
|
55
|
+
ContinueStatement: ['label'],
|
|
56
|
+
DebuggerStatement: [],
|
|
57
|
+
DeclareClass: ['id', 'typeParameters', 'extends', 'implements', 'mixins', 'body'],
|
|
58
|
+
DeclareComponent: ['id', 'params', 'rest', 'typeParameters', 'rendersType'],
|
|
59
|
+
DeclaredPredicate: ['value'],
|
|
60
|
+
DeclareEnum: ['id', 'body'],
|
|
61
|
+
DeclareExportAllDeclaration: ['source'],
|
|
62
|
+
DeclareExportDeclaration: ['declaration', 'specifiers', 'source'],
|
|
63
|
+
DeclareFunction: ['id', 'predicate'],
|
|
64
|
+
DeclareHook: ['id'],
|
|
65
|
+
DeclareInterface: ['id', 'typeParameters', 'extends', 'body'],
|
|
66
|
+
DeclareModule: ['id', 'body'],
|
|
67
|
+
DeclareModuleExports: ['typeAnnotation'],
|
|
68
|
+
DeclareNamespace: ['id', 'body'],
|
|
69
|
+
DeclareOpaqueType: ['id', 'typeParameters', 'impltype', 'lowerBound', 'upperBound', 'supertype'],
|
|
70
|
+
DeclareTypeAlias: ['id', 'typeParameters', 'right'],
|
|
71
|
+
DeclareVariable: ['id'],
|
|
72
|
+
Decorator: ['expression'],
|
|
73
|
+
DoWhileStatement: ['body', 'test'],
|
|
74
|
+
EmptyStatement: [],
|
|
75
|
+
EmptyTypeAnnotation: [],
|
|
76
|
+
EnumBigIntBody: ['members'],
|
|
77
|
+
EnumBigIntMember: ['id', 'init'],
|
|
78
|
+
EnumBooleanBody: ['members'],
|
|
79
|
+
EnumBooleanMember: ['id', 'init'],
|
|
80
|
+
EnumDeclaration: ['id', 'body'],
|
|
81
|
+
EnumDefaultedMember: ['id'],
|
|
82
|
+
EnumNumberBody: ['members'],
|
|
83
|
+
EnumNumberMember: ['id', 'init'],
|
|
84
|
+
EnumStringBody: ['members'],
|
|
85
|
+
EnumStringMember: ['id', 'init'],
|
|
86
|
+
EnumSymbolBody: ['members'],
|
|
87
|
+
ExistsTypeAnnotation: [],
|
|
88
|
+
ExportAllDeclaration: ['exported', 'source'],
|
|
89
|
+
ExportDefaultDeclaration: ['declaration'],
|
|
90
|
+
ExportNamedDeclaration: ['declaration', 'specifiers', 'source'],
|
|
91
|
+
ExportSpecifier: ['exported', 'local'],
|
|
92
|
+
ExpressionStatement: ['expression'],
|
|
93
|
+
ForInStatement: ['left', 'right', 'body'],
|
|
94
|
+
ForOfStatement: ['left', 'right', 'body'],
|
|
95
|
+
ForStatement: ['init', 'test', 'update', 'body'],
|
|
96
|
+
FunctionDeclaration: ['id', 'params', 'body', 'typeParameters', 'returnType', 'predicate'],
|
|
97
|
+
FunctionExpression: ['id', 'params', 'body', 'typeParameters', 'returnType', 'predicate'],
|
|
98
|
+
FunctionTypeAnnotation: ['params', 'this', 'returnType', 'rest', 'typeParameters'],
|
|
99
|
+
FunctionTypeParam: ['name', 'typeAnnotation'],
|
|
100
|
+
GenericTypeAnnotation: ['id', 'typeParameters'],
|
|
101
|
+
HookDeclaration: ['id', 'params', 'body', 'typeParameters', 'returnType'],
|
|
102
|
+
HookTypeAnnotation: ['params', 'returnType', 'rest', 'typeParameters'],
|
|
103
|
+
Identifier: ['typeAnnotation'],
|
|
104
|
+
IfStatement: ['test', 'consequent', 'alternate'],
|
|
105
|
+
ImportAttribute: ['key', 'value'],
|
|
106
|
+
ImportDeclaration: ['specifiers', 'source', 'attributes'],
|
|
107
|
+
ImportDefaultSpecifier: ['local'],
|
|
108
|
+
ImportExpression: ['source', 'options'],
|
|
109
|
+
ImportNamespaceSpecifier: ['local'],
|
|
110
|
+
ImportSpecifier: ['imported', 'local'],
|
|
111
|
+
IndexedAccessType: ['objectType', 'indexType'],
|
|
112
|
+
InferredPredicate: [],
|
|
113
|
+
InferTypeAnnotation: ['typeParameter'],
|
|
114
|
+
InterfaceDeclaration: ['id', 'typeParameters', 'extends', 'body'],
|
|
115
|
+
InterfaceExtends: ['id', 'typeParameters'],
|
|
116
|
+
InterfaceTypeAnnotation: ['extends', 'body'],
|
|
117
|
+
IntersectionTypeAnnotation: ['types'],
|
|
118
|
+
JSXAttribute: ['name', 'value'],
|
|
119
|
+
JSXClosingElement: ['name'],
|
|
120
|
+
JSXClosingFragment: [],
|
|
121
|
+
JSXElement: ['openingElement', 'children', 'closingElement'],
|
|
122
|
+
JSXEmptyExpression: [],
|
|
123
|
+
JSXExpressionContainer: ['expression'],
|
|
124
|
+
JSXFragment: ['openingFragment', 'children', 'closingFragment'],
|
|
125
|
+
JSXIdentifier: [],
|
|
126
|
+
JSXMemberExpression: ['object', 'property'],
|
|
127
|
+
JSXNamespacedName: ['namespace', 'name'],
|
|
128
|
+
JSXOpeningElement: ['name', 'attributes', 'typeArguments'],
|
|
129
|
+
JSXOpeningFragment: [],
|
|
130
|
+
JSXSpreadAttribute: ['argument'],
|
|
131
|
+
JSXSpreadChild: ['expression'],
|
|
132
|
+
JSXText: [],
|
|
133
|
+
KeyofTypeAnnotation: ['argument'],
|
|
134
|
+
LabeledStatement: ['label', 'body'],
|
|
135
|
+
LogicalExpression: ['left', 'right'],
|
|
136
|
+
MatchArrayPattern: ['elements', 'rest'],
|
|
137
|
+
MatchAsPattern: ['pattern', 'target'],
|
|
138
|
+
MatchBindingPattern: ['id'],
|
|
139
|
+
MatchExpression: ['argument', 'cases'],
|
|
140
|
+
MatchExpressionCase: ['pattern', 'body', 'guard'],
|
|
141
|
+
MatchIdentifierPattern: ['id'],
|
|
142
|
+
MatchInstanceObjectPattern: ['properties', 'rest'],
|
|
143
|
+
MatchInstancePattern: ['targetConstructor', 'properties'],
|
|
144
|
+
MatchLiteralPattern: ['literal'],
|
|
145
|
+
MatchMemberPattern: ['base', 'property'],
|
|
146
|
+
MatchObjectPattern: ['properties', 'rest'],
|
|
147
|
+
MatchObjectPatternProperty: ['key', 'pattern'],
|
|
148
|
+
MatchOrPattern: ['patterns'],
|
|
149
|
+
MatchRestPattern: ['argument'],
|
|
150
|
+
MatchStatement: ['argument', 'cases'],
|
|
151
|
+
MatchStatementCase: ['pattern', 'body', 'guard'],
|
|
152
|
+
MatchUnaryPattern: ['argument'],
|
|
153
|
+
MatchWildcardPattern: [],
|
|
154
|
+
MemberExpression: ['object', 'property'],
|
|
155
|
+
MetaProperty: ['meta', 'property'],
|
|
156
|
+
MethodDefinition: ['key', 'value', 'decorators'],
|
|
157
|
+
MixedTypeAnnotation: [],
|
|
158
|
+
NeverTypeAnnotation: [],
|
|
159
|
+
NewExpression: ['callee', 'typeArguments', 'arguments'],
|
|
160
|
+
NullableTypeAnnotation: ['typeAnnotation'],
|
|
161
|
+
NullLiteralTypeAnnotation: [],
|
|
162
|
+
NumberLiteralTypeAnnotation: [],
|
|
163
|
+
NumberTypeAnnotation: [],
|
|
164
|
+
ObjectExpression: ['properties'],
|
|
165
|
+
ObjectPattern: ['properties', 'typeAnnotation'],
|
|
166
|
+
ObjectTypeAnnotation: ['properties', 'indexers', 'callProperties', 'internalSlots'],
|
|
167
|
+
ObjectTypeCallProperty: ['value'],
|
|
168
|
+
ObjectTypeIndexer: ['id', 'key', 'value', 'variance'],
|
|
169
|
+
ObjectTypeInternalSlot: ['id', 'value'],
|
|
170
|
+
ObjectTypeMappedTypeProperty: ['keyTparam', 'propType', 'sourceType', 'variance'],
|
|
171
|
+
ObjectTypeProperty: ['key', 'value', 'variance'],
|
|
172
|
+
ObjectTypeSpreadProperty: ['argument'],
|
|
173
|
+
OpaqueType: ['id', 'typeParameters', 'impltype', 'lowerBound', 'upperBound', 'supertype'],
|
|
174
|
+
OptionalIndexedAccessType: ['objectType', 'indexType'],
|
|
175
|
+
PrivateIdentifier: [],
|
|
176
|
+
Program: ['body'],
|
|
177
|
+
Property: ['key', 'value'],
|
|
178
|
+
PropertyDefinition: ['key', 'value', 'decorators', 'variance', 'typeAnnotation'],
|
|
179
|
+
QualifiedTypeIdentifier: ['qualification', 'id'],
|
|
180
|
+
QualifiedTypeofIdentifier: ['qualification', 'id'],
|
|
181
|
+
RecordDeclaration: ['id', 'typeParameters', 'implements', 'body'],
|
|
182
|
+
RecordDeclarationBody: ['elements'],
|
|
183
|
+
RecordDeclarationImplements: ['id', 'typeArguments'],
|
|
184
|
+
RecordDeclarationProperty: ['key', 'typeAnnotation', 'defaultValue'],
|
|
185
|
+
RecordDeclarationStaticProperty: ['key', 'typeAnnotation', 'value'],
|
|
186
|
+
RecordExpression: ['recordConstructor', 'typeArguments', 'properties'],
|
|
187
|
+
RecordExpressionProperties: ['properties'],
|
|
188
|
+
RestElement: ['argument'],
|
|
189
|
+
ReturnStatement: ['argument'],
|
|
190
|
+
SequenceExpression: ['expressions'],
|
|
191
|
+
SpreadElement: ['argument'],
|
|
192
|
+
StaticBlock: ['body'],
|
|
193
|
+
StringLiteralTypeAnnotation: [],
|
|
194
|
+
StringTypeAnnotation: [],
|
|
195
|
+
Super: [],
|
|
196
|
+
SwitchCase: ['test', 'consequent'],
|
|
197
|
+
SwitchStatement: ['discriminant', 'cases'],
|
|
198
|
+
SymbolTypeAnnotation: [],
|
|
199
|
+
TaggedTemplateExpression: ['tag', 'quasi'],
|
|
200
|
+
TemplateElement: [],
|
|
201
|
+
TemplateLiteral: ['quasis', 'expressions'],
|
|
202
|
+
ThisExpression: [],
|
|
203
|
+
ThisTypeAnnotation: [],
|
|
204
|
+
ThrowStatement: ['argument'],
|
|
205
|
+
TryStatement: ['block', 'handler', 'finalizer'],
|
|
206
|
+
TupleTypeAnnotation: ['elementTypes'],
|
|
207
|
+
TupleTypeLabeledElement: ['label', 'elementType', 'variance'],
|
|
208
|
+
TupleTypeSpreadElement: ['label', 'typeAnnotation'],
|
|
209
|
+
TypeAlias: ['id', 'typeParameters', 'right'],
|
|
210
|
+
TypeAnnotation: ['typeAnnotation'],
|
|
211
|
+
TypeCastExpression: ['expression', 'typeAnnotation'],
|
|
212
|
+
TypeofTypeAnnotation: ['argument', 'typeArguments'],
|
|
213
|
+
TypeOperator: ['typeAnnotation'],
|
|
214
|
+
TypeParameter: ['bound', 'variance', 'default'],
|
|
215
|
+
TypeParameterDeclaration: ['params'],
|
|
216
|
+
TypeParameterInstantiation: ['params'],
|
|
217
|
+
TypePredicate: ['parameterName', 'typeAnnotation'],
|
|
218
|
+
UnaryExpression: ['argument'],
|
|
219
|
+
UndefinedTypeAnnotation: [],
|
|
220
|
+
UnionTypeAnnotation: ['types'],
|
|
221
|
+
UnknownTypeAnnotation: [],
|
|
222
|
+
UpdateExpression: ['argument'],
|
|
223
|
+
VariableDeclaration: ['declarations'],
|
|
224
|
+
VariableDeclarator: ['id', 'init'],
|
|
225
|
+
Variance: [],
|
|
226
|
+
VoidTypeAnnotation: [],
|
|
227
|
+
WhileStatement: ['test', 'body'],
|
|
228
|
+
WithStatement: ['object', 'body'],
|
|
229
|
+
YieldExpression: ['argument'],
|
|
230
|
+
OptionalMemberExpression: ['object', 'property'],
|
|
231
|
+
OptionalCallExpression: ['callee', 'typeArguments', 'arguments'],
|
|
232
|
+
Literal: []
|
|
233
|
+
};
|