@yuku-parser/wasm 0.5.31 → 0.5.32
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/README.md +1 -3
- package/decode.js +807 -184
- package/index.d.ts +69 -1941
- package/index.js +2 -0
- package/package.json +5 -1
- package/walk.js +198 -0
- package/yuku-parser.wasm +0 -0
package/decode.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// generated by tools/
|
|
1
|
+
// generated by tools/estree/decoder.zig, do not edit
|
|
2
2
|
const NULL = -1;
|
|
3
3
|
const _td = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
4
4
|
const BINARY_OPS = ["==", "!=", "===", "!==", "<", "<=", ">", ">=", "+", "-", "*", "/", "%", "**", "|", "^", "&", "<<", ">>", ">>>", "in", "instanceof"];
|
|
@@ -19,6 +19,540 @@ const TS_METHOD_SIGNATURE_KINDS = ["method", "get", "set"];
|
|
|
19
19
|
const TS_MODULE_KINDS = ["namespace", "module"];
|
|
20
20
|
const TS_MAPPED_OPTIONAL = [false, true, "+", "-"];
|
|
21
21
|
const TS_MAPPED_READONLY = [null, true, "+", "-"];
|
|
22
|
+
const CHILD_KEYS = Object.create(null);
|
|
23
|
+
function _ck(type, keys) {
|
|
24
|
+
const prev = CHILD_KEYS[type];
|
|
25
|
+
if (prev === undefined) CHILD_KEYS[type] = keys;
|
|
26
|
+
else for (const k of keys) if (!prev.includes(k)) prev.push(k);
|
|
27
|
+
}
|
|
28
|
+
_ck("SequenceExpression", ["expressions"]);
|
|
29
|
+
_ck("ParenthesizedExpression", ["expression"]);
|
|
30
|
+
_ck("ArrowFunctionExpression", ["params", "body", "typeParameters", "returnType"]);
|
|
31
|
+
_ck("FunctionDeclaration", ["id", "params", "body", "typeParameters", "returnType"]);
|
|
32
|
+
_ck("FunctionExpression", ["id", "params", "body", "typeParameters", "returnType"]);
|
|
33
|
+
_ck("TSDeclareFunction", ["id", "params", "body", "typeParameters", "returnType"]);
|
|
34
|
+
_ck("TSEmptyBodyFunctionExpression", ["id", "params", "body", "typeParameters", "returnType"]);
|
|
35
|
+
_ck("BlockStatement", ["body"]);
|
|
36
|
+
_ck("BlockStatement", ["body"]);
|
|
37
|
+
_ck("BinaryExpression", ["left", "right"]);
|
|
38
|
+
_ck("LogicalExpression", ["left", "right"]);
|
|
39
|
+
_ck("ConditionalExpression", ["test", "consequent", "alternate"]);
|
|
40
|
+
_ck("UnaryExpression", ["argument"]);
|
|
41
|
+
_ck("UpdateExpression", ["argument"]);
|
|
42
|
+
_ck("AssignmentExpression", ["left", "right"]);
|
|
43
|
+
_ck("ArrayExpression", ["elements"]);
|
|
44
|
+
_ck("ObjectExpression", ["properties"]);
|
|
45
|
+
_ck("SpreadElement", ["argument"]);
|
|
46
|
+
_ck("Property", ["key", "value"]);
|
|
47
|
+
_ck("MemberExpression", ["object", "property"]);
|
|
48
|
+
_ck("CallExpression", ["callee", "arguments", "typeArguments"]);
|
|
49
|
+
_ck("ChainExpression", ["expression"]);
|
|
50
|
+
_ck("TaggedTemplateExpression", ["tag", "quasi", "typeArguments"]);
|
|
51
|
+
_ck("NewExpression", ["callee", "arguments", "typeArguments"]);
|
|
52
|
+
_ck("AwaitExpression", ["argument"]);
|
|
53
|
+
_ck("YieldExpression", ["argument"]);
|
|
54
|
+
_ck("MetaProperty", ["meta", "property"]);
|
|
55
|
+
_ck("Decorator", ["expression"]);
|
|
56
|
+
_ck("ClassDeclaration", ["decorators", "id", "superClass", "body", "typeParameters", "superTypeArguments", "implements"]);
|
|
57
|
+
_ck("ClassExpression", ["decorators", "id", "superClass", "body", "typeParameters", "superTypeArguments", "implements"]);
|
|
58
|
+
_ck("ClassBody", ["body"]);
|
|
59
|
+
_ck("MethodDefinition", ["decorators", "key", "value"]);
|
|
60
|
+
_ck("TSAbstractMethodDefinition", ["decorators", "key", "value"]);
|
|
61
|
+
_ck("PropertyDefinition", ["decorators", "key", "value", "typeAnnotation"]);
|
|
62
|
+
_ck("AccessorProperty", ["decorators", "key", "value", "typeAnnotation"]);
|
|
63
|
+
_ck("TSAbstractPropertyDefinition", ["decorators", "key", "value", "typeAnnotation"]);
|
|
64
|
+
_ck("TSAbstractAccessorProperty", ["decorators", "key", "value", "typeAnnotation"]);
|
|
65
|
+
_ck("StaticBlock", ["body"]);
|
|
66
|
+
_ck("Super", []);
|
|
67
|
+
_ck("Literal", []);
|
|
68
|
+
_ck("Literal", []);
|
|
69
|
+
_ck("Literal", []);
|
|
70
|
+
_ck("Literal", []);
|
|
71
|
+
_ck("Literal", []);
|
|
72
|
+
_ck("ThisExpression", []);
|
|
73
|
+
_ck("Literal", []);
|
|
74
|
+
_ck("TemplateLiteral", ["quasis", "expressions"]);
|
|
75
|
+
_ck("TemplateElement", []);
|
|
76
|
+
_ck("Identifier", []);
|
|
77
|
+
_ck("PrivateIdentifier", []);
|
|
78
|
+
_ck("Identifier", ["decorators", "typeAnnotation"]);
|
|
79
|
+
_ck("Identifier", []);
|
|
80
|
+
_ck("Identifier", []);
|
|
81
|
+
_ck("ExpressionStatement", ["expression"]);
|
|
82
|
+
_ck("IfStatement", ["test", "consequent", "alternate"]);
|
|
83
|
+
_ck("SwitchStatement", ["discriminant", "cases"]);
|
|
84
|
+
_ck("SwitchCase", ["test", "consequent"]);
|
|
85
|
+
_ck("ForStatement", ["init", "test", "update", "body"]);
|
|
86
|
+
_ck("ForInStatement", ["left", "right", "body"]);
|
|
87
|
+
_ck("ForOfStatement", ["left", "right", "body"]);
|
|
88
|
+
_ck("WhileStatement", ["test", "body"]);
|
|
89
|
+
_ck("DoWhileStatement", ["body", "test"]);
|
|
90
|
+
_ck("BreakStatement", ["label"]);
|
|
91
|
+
_ck("ContinueStatement", ["label"]);
|
|
92
|
+
_ck("LabeledStatement", ["label", "body"]);
|
|
93
|
+
_ck("WithStatement", ["object", "body"]);
|
|
94
|
+
_ck("ReturnStatement", ["argument"]);
|
|
95
|
+
_ck("ThrowStatement", ["argument"]);
|
|
96
|
+
_ck("TryStatement", ["block", "handler", "finalizer"]);
|
|
97
|
+
_ck("CatchClause", ["param", "body"]);
|
|
98
|
+
_ck("DebuggerStatement", []);
|
|
99
|
+
_ck("EmptyStatement", []);
|
|
100
|
+
_ck("VariableDeclaration", ["declarations"]);
|
|
101
|
+
_ck("VariableDeclarator", ["id", "init"]);
|
|
102
|
+
_ck("ExpressionStatement", ["expression"]);
|
|
103
|
+
_ck("AssignmentPattern", ["left", "right", "decorators", "typeAnnotation"]);
|
|
104
|
+
_ck("RestElement", ["argument", "decorators", "typeAnnotation"]);
|
|
105
|
+
_ck("ArrayPattern", ["decorators", "elements", "typeAnnotation"]);
|
|
106
|
+
_ck("ObjectPattern", ["decorators", "properties", "typeAnnotation"]);
|
|
107
|
+
_ck("Property", ["key", "value"]);
|
|
108
|
+
_ck("Program", ["hashbang", "body"]);
|
|
109
|
+
_ck("ImportExpression", ["source", "options"]);
|
|
110
|
+
_ck("ImportDeclaration", ["specifiers", "source", "attributes"]);
|
|
111
|
+
_ck("ImportSpecifier", ["imported", "local"]);
|
|
112
|
+
_ck("ImportDefaultSpecifier", ["local"]);
|
|
113
|
+
_ck("ImportNamespaceSpecifier", ["local"]);
|
|
114
|
+
_ck("ImportAttribute", ["key", "value"]);
|
|
115
|
+
_ck("ExportNamedDeclaration", ["declaration", "specifiers", "source", "attributes"]);
|
|
116
|
+
_ck("ExportDefaultDeclaration", ["declaration"]);
|
|
117
|
+
_ck("ExportAllDeclaration", ["exported", "source", "attributes"]);
|
|
118
|
+
_ck("ExportSpecifier", ["local", "exported"]);
|
|
119
|
+
_ck("TSTypeAnnotation", ["typeAnnotation"]);
|
|
120
|
+
_ck("TSAnyKeyword", []);
|
|
121
|
+
_ck("TSUnknownKeyword", []);
|
|
122
|
+
_ck("TSNeverKeyword", []);
|
|
123
|
+
_ck("TSVoidKeyword", []);
|
|
124
|
+
_ck("TSNullKeyword", []);
|
|
125
|
+
_ck("TSUndefinedKeyword", []);
|
|
126
|
+
_ck("TSStringKeyword", []);
|
|
127
|
+
_ck("TSNumberKeyword", []);
|
|
128
|
+
_ck("TSBigIntKeyword", []);
|
|
129
|
+
_ck("TSBooleanKeyword", []);
|
|
130
|
+
_ck("TSSymbolKeyword", []);
|
|
131
|
+
_ck("TSObjectKeyword", []);
|
|
132
|
+
_ck("TSIntrinsicKeyword", []);
|
|
133
|
+
_ck("TSThisType", []);
|
|
134
|
+
_ck("TSTypeReference", ["typeName", "typeArguments"]);
|
|
135
|
+
_ck("TSQualifiedName", ["left", "right"]);
|
|
136
|
+
_ck("TSTypeQuery", ["exprName", "typeArguments"]);
|
|
137
|
+
_ck("TSImportType", ["source", "options", "qualifier", "typeArguments"]);
|
|
138
|
+
_ck("TSTypeParameter", ["name", "constraint", "default"]);
|
|
139
|
+
_ck("TSTypeParameterDeclaration", ["params"]);
|
|
140
|
+
_ck("TSTypeParameterInstantiation", ["params"]);
|
|
141
|
+
_ck("TSLiteralType", ["literal"]);
|
|
142
|
+
_ck("TSTemplateLiteralType", ["quasis", "types"]);
|
|
143
|
+
_ck("TSArrayType", ["elementType"]);
|
|
144
|
+
_ck("TSIndexedAccessType", ["objectType", "indexType"]);
|
|
145
|
+
_ck("TSTupleType", ["elementTypes"]);
|
|
146
|
+
_ck("TSNamedTupleMember", ["label", "elementType"]);
|
|
147
|
+
_ck("TSOptionalType", ["typeAnnotation"]);
|
|
148
|
+
_ck("TSRestType", ["typeAnnotation"]);
|
|
149
|
+
_ck("TSJSDocNullableType", ["typeAnnotation"]);
|
|
150
|
+
_ck("TSJSDocNonNullableType", ["typeAnnotation"]);
|
|
151
|
+
_ck("TSJSDocUnknownType", []);
|
|
152
|
+
_ck("TSUnionType", ["types"]);
|
|
153
|
+
_ck("TSIntersectionType", ["types"]);
|
|
154
|
+
_ck("TSConditionalType", ["checkType", "extendsType", "trueType", "falseType"]);
|
|
155
|
+
_ck("TSInferType", ["typeParameter"]);
|
|
156
|
+
_ck("TSTypeOperator", ["typeAnnotation"]);
|
|
157
|
+
_ck("TSParenthesizedType", ["typeAnnotation"]);
|
|
158
|
+
_ck("TSFunctionType", ["typeParameters", "params", "returnType"]);
|
|
159
|
+
_ck("TSConstructorType", ["typeParameters", "params", "returnType"]);
|
|
160
|
+
_ck("TSTypePredicate", ["parameterName", "typeAnnotation"]);
|
|
161
|
+
_ck("TSTypeLiteral", ["members"]);
|
|
162
|
+
_ck("TSMappedType", ["key", "constraint", "nameType", "typeAnnotation"]);
|
|
163
|
+
_ck("TSPropertySignature", ["key", "typeAnnotation"]);
|
|
164
|
+
_ck("TSMethodSignature", ["key", "typeParameters", "params", "returnType"]);
|
|
165
|
+
_ck("TSCallSignatureDeclaration", ["typeParameters", "params", "returnType"]);
|
|
166
|
+
_ck("TSConstructSignatureDeclaration", ["typeParameters", "params", "returnType"]);
|
|
167
|
+
_ck("TSIndexSignature", ["parameters", "typeAnnotation"]);
|
|
168
|
+
_ck("TSTypeAliasDeclaration", ["id", "typeParameters", "typeAnnotation"]);
|
|
169
|
+
_ck("TSInterfaceDeclaration", ["id", "typeParameters", "extends", "body"]);
|
|
170
|
+
_ck("TSInterfaceBody", ["body"]);
|
|
171
|
+
_ck("TSInterfaceHeritage", ["expression", "typeArguments"]);
|
|
172
|
+
_ck("TSClassImplements", ["expression", "typeArguments"]);
|
|
173
|
+
_ck("TSEnumDeclaration", ["id", "body"]);
|
|
174
|
+
_ck("TSEnumBody", ["members"]);
|
|
175
|
+
_ck("TSEnumMember", ["id", "initializer"]);
|
|
176
|
+
_ck("TSModuleDeclaration", ["id", "body"]);
|
|
177
|
+
_ck("TSModuleBlock", ["body"]);
|
|
178
|
+
_ck("TSModuleDeclaration", ["id", "body"]);
|
|
179
|
+
_ck("TSParameterProperty", ["decorators", "parameter"]);
|
|
180
|
+
_ck("Identifier", ["typeAnnotation"]);
|
|
181
|
+
_ck("TSAsExpression", ["expression", "typeAnnotation"]);
|
|
182
|
+
_ck("TSSatisfiesExpression", ["expression", "typeAnnotation"]);
|
|
183
|
+
_ck("TSTypeAssertion", ["typeAnnotation", "expression"]);
|
|
184
|
+
_ck("TSNonNullExpression", ["expression"]);
|
|
185
|
+
_ck("TSInstantiationExpression", ["expression", "typeArguments"]);
|
|
186
|
+
_ck("TSExportAssignment", ["expression"]);
|
|
187
|
+
_ck("TSNamespaceExportDeclaration", ["id"]);
|
|
188
|
+
_ck("TSImportEqualsDeclaration", ["id", "moduleReference"]);
|
|
189
|
+
_ck("TSExternalModuleReference", ["expression"]);
|
|
190
|
+
_ck("JSXElement", ["openingElement", "children", "closingElement"]);
|
|
191
|
+
_ck("JSXOpeningElement", ["name", "attributes", "typeArguments"]);
|
|
192
|
+
_ck("JSXClosingElement", ["name"]);
|
|
193
|
+
_ck("JSXFragment", ["openingFragment", "children", "closingFragment"]);
|
|
194
|
+
_ck("JSXOpeningFragment", []);
|
|
195
|
+
_ck("JSXClosingFragment", []);
|
|
196
|
+
_ck("JSXIdentifier", []);
|
|
197
|
+
_ck("JSXNamespacedName", ["namespace", "name"]);
|
|
198
|
+
_ck("JSXMemberExpression", ["object", "property"]);
|
|
199
|
+
_ck("JSXAttribute", ["name", "value"]);
|
|
200
|
+
_ck("JSXSpreadAttribute", ["argument"]);
|
|
201
|
+
_ck("JSXExpressionContainer", ["expression"]);
|
|
202
|
+
_ck("JSXEmptyExpression", []);
|
|
203
|
+
_ck("JSXText", []);
|
|
204
|
+
_ck("JSXSpreadChild", ["expression"]);
|
|
205
|
+
_ck("Hashbang", []);
|
|
206
|
+
const SCAN_CHILDREN = [
|
|
207
|
+
[2, 2],
|
|
208
|
+
[0, 2],
|
|
209
|
+
[0, 2, 0, 3, 0, 4, 0, 5],
|
|
210
|
+
[0, 2, 0, 3, 0, 4, 0, 5, 0, 6],
|
|
211
|
+
[2, 2],
|
|
212
|
+
[2, 2],
|
|
213
|
+
[2, 2, 0, 3],
|
|
214
|
+
[0, 2, 0, 3],
|
|
215
|
+
[0, 2, 0, 3],
|
|
216
|
+
[0, 2, 0, 3, 0, 4],
|
|
217
|
+
[0, 2],
|
|
218
|
+
[0, 2],
|
|
219
|
+
[0, 2, 0, 3],
|
|
220
|
+
[2, 2],
|
|
221
|
+
[2, 2],
|
|
222
|
+
[0, 2],
|
|
223
|
+
[0, 2, 0, 3],
|
|
224
|
+
[0, 2, 0, 3],
|
|
225
|
+
[0, 2, 2, 3, 0, 4],
|
|
226
|
+
[0, 2],
|
|
227
|
+
[0, 2, 0, 3, 0, 4],
|
|
228
|
+
[0, 2, 2, 3, 0, 4],
|
|
229
|
+
[0, 2],
|
|
230
|
+
[0, 2],
|
|
231
|
+
[0, 2, 0, 3],
|
|
232
|
+
[0, 2],
|
|
233
|
+
[2, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 1, 8],
|
|
234
|
+
[2, 2],
|
|
235
|
+
[2, 2, 0, 3, 0, 4],
|
|
236
|
+
[2, 2, 0, 3, 0, 4, 0, 5],
|
|
237
|
+
[2, 2],
|
|
238
|
+
[],
|
|
239
|
+
[],
|
|
240
|
+
[],
|
|
241
|
+
[],
|
|
242
|
+
[],
|
|
243
|
+
[],
|
|
244
|
+
[],
|
|
245
|
+
[],
|
|
246
|
+
[2, 2, 1, 3],
|
|
247
|
+
[],
|
|
248
|
+
[],
|
|
249
|
+
[],
|
|
250
|
+
[2, 4, 0, 5],
|
|
251
|
+
[],
|
|
252
|
+
[],
|
|
253
|
+
[0, 2],
|
|
254
|
+
[0, 2, 0, 3, 0, 4],
|
|
255
|
+
[0, 2, 2, 3],
|
|
256
|
+
[0, 2, 2, 3],
|
|
257
|
+
[0, 2, 0, 3, 0, 4, 0, 5],
|
|
258
|
+
[0, 2, 0, 3, 0, 4],
|
|
259
|
+
[0, 2, 0, 3, 0, 4],
|
|
260
|
+
[0, 2, 0, 3],
|
|
261
|
+
[0, 2, 0, 3],
|
|
262
|
+
[0, 2],
|
|
263
|
+
[0, 2],
|
|
264
|
+
[0, 2, 0, 3],
|
|
265
|
+
[0, 2, 0, 3],
|
|
266
|
+
[0, 2],
|
|
267
|
+
[0, 2],
|
|
268
|
+
[0, 2, 0, 3, 0, 4],
|
|
269
|
+
[0, 2, 0, 3],
|
|
270
|
+
[],
|
|
271
|
+
[],
|
|
272
|
+
[2, 2],
|
|
273
|
+
[0, 2, 0, 3],
|
|
274
|
+
[0, 2],
|
|
275
|
+
[0, 2, 0, 3, 2, 4, 0, 5],
|
|
276
|
+
[0, 2, 2, 3, 0, 4],
|
|
277
|
+
[2, 2, 0, 3, 1, 4, 0, 6],
|
|
278
|
+
[2, 2, 0, 3, 1, 4, 0, 6],
|
|
279
|
+
[0, 2, 0, 3],
|
|
280
|
+
[2, 2],
|
|
281
|
+
[0, 2, 0, 3],
|
|
282
|
+
[2, 2, 0, 3, 1, 4],
|
|
283
|
+
[0, 2, 0, 3],
|
|
284
|
+
[0, 2],
|
|
285
|
+
[0, 2],
|
|
286
|
+
[0, 2, 0, 3],
|
|
287
|
+
[0, 2, 2, 3, 0, 4, 1, 5],
|
|
288
|
+
[0, 2],
|
|
289
|
+
[0, 2, 0, 3, 2, 4],
|
|
290
|
+
[0, 2, 0, 3],
|
|
291
|
+
[0, 2],
|
|
292
|
+
[],
|
|
293
|
+
[],
|
|
294
|
+
[],
|
|
295
|
+
[],
|
|
296
|
+
[],
|
|
297
|
+
[],
|
|
298
|
+
[],
|
|
299
|
+
[],
|
|
300
|
+
[],
|
|
301
|
+
[],
|
|
302
|
+
[],
|
|
303
|
+
[],
|
|
304
|
+
[],
|
|
305
|
+
[],
|
|
306
|
+
[0, 2, 0, 3],
|
|
307
|
+
[0, 2, 0, 3],
|
|
308
|
+
[0, 2, 0, 3],
|
|
309
|
+
[0, 2, 0, 3, 0, 4, 0, 5],
|
|
310
|
+
[0, 2, 0, 3, 0, 4],
|
|
311
|
+
[2, 2],
|
|
312
|
+
[2, 2],
|
|
313
|
+
[0, 2],
|
|
314
|
+
[2, 2, 1, 3],
|
|
315
|
+
[0, 2],
|
|
316
|
+
[0, 2, 0, 3],
|
|
317
|
+
[2, 2],
|
|
318
|
+
[0, 2, 0, 3],
|
|
319
|
+
[0, 2],
|
|
320
|
+
[0, 2],
|
|
321
|
+
[0, 2],
|
|
322
|
+
[0, 2],
|
|
323
|
+
[],
|
|
324
|
+
[2, 2],
|
|
325
|
+
[2, 2],
|
|
326
|
+
[0, 2, 0, 3, 0, 4, 0, 5],
|
|
327
|
+
[0, 2],
|
|
328
|
+
[0, 2],
|
|
329
|
+
[0, 2],
|
|
330
|
+
[0, 2, 0, 3, 0, 4],
|
|
331
|
+
[0, 2, 0, 3, 0, 4],
|
|
332
|
+
[0, 2, 0, 3],
|
|
333
|
+
[2, 2],
|
|
334
|
+
[0, 2, 0, 3, 0, 4, 0, 5],
|
|
335
|
+
[0, 2, 0, 3],
|
|
336
|
+
[0, 2, 0, 3, 0, 4, 0, 5],
|
|
337
|
+
[0, 2, 0, 3, 0, 4],
|
|
338
|
+
[0, 2, 0, 3, 0, 4],
|
|
339
|
+
[2, 2, 0, 3],
|
|
340
|
+
[0, 2, 0, 3, 0, 4],
|
|
341
|
+
[0, 2, 0, 3, 2, 4, 0, 5],
|
|
342
|
+
[2, 2],
|
|
343
|
+
[0, 2, 0, 3],
|
|
344
|
+
[0, 2, 0, 3],
|
|
345
|
+
[0, 2, 0, 3],
|
|
346
|
+
[2, 2],
|
|
347
|
+
[0, 2, 0, 3],
|
|
348
|
+
[0, 2, 0, 3],
|
|
349
|
+
[2, 2],
|
|
350
|
+
[0, 2, 0, 3],
|
|
351
|
+
[2, 2, 0, 3],
|
|
352
|
+
[0, 2],
|
|
353
|
+
[0, 2, 0, 3],
|
|
354
|
+
[0, 2, 0, 3],
|
|
355
|
+
[0, 2, 0, 3],
|
|
356
|
+
[0, 2],
|
|
357
|
+
[0, 2, 0, 3],
|
|
358
|
+
[0, 2],
|
|
359
|
+
[0, 2],
|
|
360
|
+
[0, 2, 0, 3],
|
|
361
|
+
[0, 2],
|
|
362
|
+
[0, 2, 2, 3, 0, 4],
|
|
363
|
+
[0, 2, 2, 3, 0, 4],
|
|
364
|
+
[0, 2],
|
|
365
|
+
[0, 2, 2, 3, 0, 4],
|
|
366
|
+
[],
|
|
367
|
+
[],
|
|
368
|
+
[],
|
|
369
|
+
[0, 2, 0, 3],
|
|
370
|
+
[0, 2, 0, 3],
|
|
371
|
+
[0, 2, 0, 3],
|
|
372
|
+
[0, 2],
|
|
373
|
+
[0, 2],
|
|
374
|
+
[],
|
|
375
|
+
[],
|
|
376
|
+
[0, 2],
|
|
377
|
+
];
|
|
378
|
+
const TAG_TYPES = [
|
|
379
|
+
"SequenceExpression",
|
|
380
|
+
"ParenthesizedExpression",
|
|
381
|
+
"ArrowFunctionExpression",
|
|
382
|
+
0,
|
|
383
|
+
"BlockStatement",
|
|
384
|
+
"BlockStatement",
|
|
385
|
+
null,
|
|
386
|
+
"BinaryExpression",
|
|
387
|
+
"LogicalExpression",
|
|
388
|
+
"ConditionalExpression",
|
|
389
|
+
"UnaryExpression",
|
|
390
|
+
"UpdateExpression",
|
|
391
|
+
"AssignmentExpression",
|
|
392
|
+
"ArrayExpression",
|
|
393
|
+
"ObjectExpression",
|
|
394
|
+
"SpreadElement",
|
|
395
|
+
"Property",
|
|
396
|
+
"MemberExpression",
|
|
397
|
+
"CallExpression",
|
|
398
|
+
"ChainExpression",
|
|
399
|
+
"TaggedTemplateExpression",
|
|
400
|
+
"NewExpression",
|
|
401
|
+
"AwaitExpression",
|
|
402
|
+
"YieldExpression",
|
|
403
|
+
"MetaProperty",
|
|
404
|
+
"Decorator",
|
|
405
|
+
0,
|
|
406
|
+
"ClassBody",
|
|
407
|
+
0,
|
|
408
|
+
0,
|
|
409
|
+
"StaticBlock",
|
|
410
|
+
"Super",
|
|
411
|
+
"Literal",
|
|
412
|
+
"Literal",
|
|
413
|
+
"Literal",
|
|
414
|
+
"Literal",
|
|
415
|
+
"Literal",
|
|
416
|
+
"ThisExpression",
|
|
417
|
+
"Literal",
|
|
418
|
+
"TemplateLiteral",
|
|
419
|
+
"TemplateElement",
|
|
420
|
+
"Identifier",
|
|
421
|
+
"PrivateIdentifier",
|
|
422
|
+
"Identifier",
|
|
423
|
+
"Identifier",
|
|
424
|
+
"Identifier",
|
|
425
|
+
"ExpressionStatement",
|
|
426
|
+
"IfStatement",
|
|
427
|
+
"SwitchStatement",
|
|
428
|
+
"SwitchCase",
|
|
429
|
+
"ForStatement",
|
|
430
|
+
"ForInStatement",
|
|
431
|
+
"ForOfStatement",
|
|
432
|
+
"WhileStatement",
|
|
433
|
+
"DoWhileStatement",
|
|
434
|
+
"BreakStatement",
|
|
435
|
+
"ContinueStatement",
|
|
436
|
+
"LabeledStatement",
|
|
437
|
+
"WithStatement",
|
|
438
|
+
"ReturnStatement",
|
|
439
|
+
"ThrowStatement",
|
|
440
|
+
"TryStatement",
|
|
441
|
+
"CatchClause",
|
|
442
|
+
"DebuggerStatement",
|
|
443
|
+
"EmptyStatement",
|
|
444
|
+
"VariableDeclaration",
|
|
445
|
+
"VariableDeclarator",
|
|
446
|
+
"ExpressionStatement",
|
|
447
|
+
"AssignmentPattern",
|
|
448
|
+
"RestElement",
|
|
449
|
+
"ArrayPattern",
|
|
450
|
+
"ObjectPattern",
|
|
451
|
+
"Property",
|
|
452
|
+
"Program",
|
|
453
|
+
"ImportExpression",
|
|
454
|
+
"ImportDeclaration",
|
|
455
|
+
"ImportSpecifier",
|
|
456
|
+
"ImportDefaultSpecifier",
|
|
457
|
+
"ImportNamespaceSpecifier",
|
|
458
|
+
"ImportAttribute",
|
|
459
|
+
"ExportNamedDeclaration",
|
|
460
|
+
"ExportDefaultDeclaration",
|
|
461
|
+
"ExportAllDeclaration",
|
|
462
|
+
"ExportSpecifier",
|
|
463
|
+
"TSTypeAnnotation",
|
|
464
|
+
"TSAnyKeyword",
|
|
465
|
+
"TSUnknownKeyword",
|
|
466
|
+
"TSNeverKeyword",
|
|
467
|
+
"TSVoidKeyword",
|
|
468
|
+
"TSNullKeyword",
|
|
469
|
+
"TSUndefinedKeyword",
|
|
470
|
+
"TSStringKeyword",
|
|
471
|
+
"TSNumberKeyword",
|
|
472
|
+
"TSBigIntKeyword",
|
|
473
|
+
"TSBooleanKeyword",
|
|
474
|
+
"TSSymbolKeyword",
|
|
475
|
+
"TSObjectKeyword",
|
|
476
|
+
"TSIntrinsicKeyword",
|
|
477
|
+
"TSThisType",
|
|
478
|
+
"TSTypeReference",
|
|
479
|
+
"TSQualifiedName",
|
|
480
|
+
"TSTypeQuery",
|
|
481
|
+
"TSImportType",
|
|
482
|
+
"TSTypeParameter",
|
|
483
|
+
"TSTypeParameterDeclaration",
|
|
484
|
+
"TSTypeParameterInstantiation",
|
|
485
|
+
"TSLiteralType",
|
|
486
|
+
"TSTemplateLiteralType",
|
|
487
|
+
"TSArrayType",
|
|
488
|
+
"TSIndexedAccessType",
|
|
489
|
+
"TSTupleType",
|
|
490
|
+
"TSNamedTupleMember",
|
|
491
|
+
"TSOptionalType",
|
|
492
|
+
"TSRestType",
|
|
493
|
+
"TSJSDocNullableType",
|
|
494
|
+
"TSJSDocNonNullableType",
|
|
495
|
+
"TSJSDocUnknownType",
|
|
496
|
+
"TSUnionType",
|
|
497
|
+
"TSIntersectionType",
|
|
498
|
+
"TSConditionalType",
|
|
499
|
+
"TSInferType",
|
|
500
|
+
"TSTypeOperator",
|
|
501
|
+
"TSParenthesizedType",
|
|
502
|
+
"TSFunctionType",
|
|
503
|
+
"TSConstructorType",
|
|
504
|
+
"TSTypePredicate",
|
|
505
|
+
"TSTypeLiteral",
|
|
506
|
+
"TSMappedType",
|
|
507
|
+
"TSPropertySignature",
|
|
508
|
+
"TSMethodSignature",
|
|
509
|
+
"TSCallSignatureDeclaration",
|
|
510
|
+
"TSConstructSignatureDeclaration",
|
|
511
|
+
"TSIndexSignature",
|
|
512
|
+
"TSTypeAliasDeclaration",
|
|
513
|
+
"TSInterfaceDeclaration",
|
|
514
|
+
"TSInterfaceBody",
|
|
515
|
+
"TSInterfaceHeritage",
|
|
516
|
+
"TSClassImplements",
|
|
517
|
+
"TSEnumDeclaration",
|
|
518
|
+
"TSEnumBody",
|
|
519
|
+
"TSEnumMember",
|
|
520
|
+
"TSModuleDeclaration",
|
|
521
|
+
"TSModuleBlock",
|
|
522
|
+
"TSModuleDeclaration",
|
|
523
|
+
"TSParameterProperty",
|
|
524
|
+
"Identifier",
|
|
525
|
+
"TSAsExpression",
|
|
526
|
+
"TSSatisfiesExpression",
|
|
527
|
+
"TSTypeAssertion",
|
|
528
|
+
"TSNonNullExpression",
|
|
529
|
+
"TSInstantiationExpression",
|
|
530
|
+
"TSExportAssignment",
|
|
531
|
+
"TSNamespaceExportDeclaration",
|
|
532
|
+
"TSImportEqualsDeclaration",
|
|
533
|
+
"TSExternalModuleReference",
|
|
534
|
+
"JSXElement",
|
|
535
|
+
"JSXOpeningElement",
|
|
536
|
+
"JSXClosingElement",
|
|
537
|
+
"JSXFragment",
|
|
538
|
+
"JSXOpeningFragment",
|
|
539
|
+
"JSXClosingFragment",
|
|
540
|
+
"JSXIdentifier",
|
|
541
|
+
"JSXNamespacedName",
|
|
542
|
+
"JSXMemberExpression",
|
|
543
|
+
"JSXAttribute",
|
|
544
|
+
"JSXSpreadAttribute",
|
|
545
|
+
"JSXExpressionContainer",
|
|
546
|
+
"JSXEmptyExpression",
|
|
547
|
+
"JSXText",
|
|
548
|
+
"JSXSpreadChild",
|
|
549
|
+
];
|
|
550
|
+
const TAG_CHOICES = new Map([
|
|
551
|
+
[3, ["FunctionDeclaration", "FunctionExpression", "TSDeclareFunction", "TSEmptyBodyFunctionExpression"]],
|
|
552
|
+
[26, ["ClassDeclaration", "ClassExpression"]],
|
|
553
|
+
[28, ["MethodDefinition", "TSAbstractMethodDefinition"]],
|
|
554
|
+
[29, ["PropertyDefinition", "AccessorProperty", "TSAbstractPropertyDefinition", "TSAbstractAccessorProperty"]],
|
|
555
|
+
]);
|
|
22
556
|
function buildPosMap(src, byteLen, startByte) {
|
|
23
557
|
const m = new Uint32Array(byteLen - startByte + 1);
|
|
24
558
|
const len = src.length;
|
|
@@ -116,12 +650,12 @@ function decode(buffer, source) {
|
|
|
116
650
|
return _src.slice(ss, pm[e - _firstNa]);
|
|
117
651
|
};
|
|
118
652
|
function nodeArr(s, len) {
|
|
119
|
-
const r =
|
|
653
|
+
const r = Array.from({ length: len });
|
|
120
654
|
for (let j = 0; j < len; j++) r[j] = node(_u32[_extraBase + s + j]);
|
|
121
655
|
return r;
|
|
122
656
|
}
|
|
123
657
|
function nodeArrHoles(s, len) {
|
|
124
|
-
const r =
|
|
658
|
+
const r = Array.from({ length: len });
|
|
125
659
|
for (let j = 0; j < len; j++) {
|
|
126
660
|
const x = _u32[_extraBase + s + j];
|
|
127
661
|
r[j] = x !== NULL ? node(x) : null;
|
|
@@ -139,7 +673,7 @@ function decode(buffer, source) {
|
|
|
139
673
|
return p;
|
|
140
674
|
}
|
|
141
675
|
function _attachedCommentsOf(a, e) {
|
|
142
|
-
const out =
|
|
676
|
+
const out = Array.from({ length: e - a });
|
|
143
677
|
for (let j = a; j < e; j++) {
|
|
144
678
|
const o = _acOff + j * 12;
|
|
145
679
|
const cf = _u8[o + 0];
|
|
@@ -212,31 +746,30 @@ function decode(buffer, source) {
|
|
|
212
746
|
case 4: return { type: "BlockStatement", start, end, body: nodeArr(f1, f0) };
|
|
213
747
|
case 5: return { type: "BlockStatement", start, end, body: nodeArr(f1, f0) };
|
|
214
748
|
case 6: return { params: fnParams(i) };
|
|
215
|
-
case 7: return node(f1);
|
|
216
|
-
case 8: return { type: "
|
|
217
|
-
case 9: return { type: "
|
|
218
|
-
case 10: return {
|
|
219
|
-
case 11: return {
|
|
749
|
+
case 7: return { type: "BinaryExpression", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, operator: BINARY_OPS[flags & 31] };
|
|
750
|
+
case 8: return { type: "LogicalExpression", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, operator: LOGICAL_OPS[flags & 3] };
|
|
751
|
+
case 9: return { type: "ConditionalExpression", start, end, test: f1 !== NULL ? node(f1) : null, consequent: f2 !== NULL ? node(f2) : null, alternate: f3 !== NULL ? node(f3) : null };
|
|
752
|
+
case 10: return {
|
|
220
753
|
type: "UnaryExpression", start, end,
|
|
221
754
|
operator: UNARY_OPS[flags & 7], prefix: true,
|
|
222
755
|
argument: f1 !== NULL ? node(f1) : null,
|
|
223
756
|
};
|
|
224
|
-
case
|
|
225
|
-
case
|
|
226
|
-
case
|
|
227
|
-
case
|
|
228
|
-
case
|
|
229
|
-
case
|
|
230
|
-
case
|
|
231
|
-
case
|
|
232
|
-
case
|
|
233
|
-
case
|
|
234
|
-
case
|
|
235
|
-
case
|
|
236
|
-
case
|
|
237
|
-
case
|
|
238
|
-
case
|
|
239
|
-
case
|
|
757
|
+
case 11: return { type: "UpdateExpression", start, end, argument: f1 !== NULL ? node(f1) : null, operator: UPDATE_OPS[flags & 1], prefix: !!(flags & 2) };
|
|
758
|
+
case 12: return { type: "AssignmentExpression", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, operator: ASSIGNMENT_OPS[flags & 15] };
|
|
759
|
+
case 13: return { type: "ArrayExpression", start, end, elements: nodeArrHoles(f1, f0) };
|
|
760
|
+
case 14: return { type: "ObjectExpression", start, end, properties: nodeArr(f1, f0) };
|
|
761
|
+
case 15: return { type: "SpreadElement", start, end, argument: f1 !== NULL ? node(f1) : null };
|
|
762
|
+
case 16: { const r = { type: "Property", start, end, key: f1 !== NULL ? node(f1) : null, value: f2 !== NULL ? node(f2) : null, kind: PROPERTY_KINDS[flags & 3], method: !!(flags & 4), shorthand: !!(flags & 8), computed: !!(flags & 16) }; if (_isTs) { r.optional = false; } return r; }
|
|
763
|
+
case 17: return { type: "MemberExpression", start, end, object: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null, computed: !!(flags & 1), optional: !!(flags & 2) };
|
|
764
|
+
case 18: { const r = { type: "CallExpression", start, end, callee: f1 !== NULL ? node(f1) : null, arguments: nodeArr(f2, f0), optional: !!(flags & 1) }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
|
|
765
|
+
case 19: return { type: "ChainExpression", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
766
|
+
case 20: { const r = { type: "TaggedTemplateExpression", start, end, tag: f1 !== NULL ? node(f1) : null, quasi: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
|
|
767
|
+
case 21: { const r = { type: "NewExpression", start, end, callee: f1 !== NULL ? node(f1) : null, arguments: nodeArr(f2, f0) }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
|
|
768
|
+
case 22: return { type: "AwaitExpression", start, end, argument: f1 !== NULL ? node(f1) : null };
|
|
769
|
+
case 23: return { type: "YieldExpression", start, end, argument: f1 !== NULL ? node(f1) : null, delegate: !!(flags & 1) };
|
|
770
|
+
case 24: return { type: "MetaProperty", start, end, meta: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null };
|
|
771
|
+
case 25: return { type: "Decorator", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
772
|
+
case 26: {
|
|
240
773
|
const r = {
|
|
241
774
|
type: CLASS_TYPES[flags & 1], start, end,
|
|
242
775
|
decorators: nodeArr(f1, f0),
|
|
@@ -253,8 +786,8 @@ function decode(buffer, source) {
|
|
|
253
786
|
}
|
|
254
787
|
return r;
|
|
255
788
|
}
|
|
256
|
-
case
|
|
257
|
-
case
|
|
789
|
+
case 27: return { type: "ClassBody", start, end, body: nodeArr(f1, f0) };
|
|
790
|
+
case 28: {
|
|
258
791
|
const r = {
|
|
259
792
|
type: "MethodDefinition", start, end,
|
|
260
793
|
decorators: nodeArr(f1, f0),
|
|
@@ -271,7 +804,7 @@ function decode(buffer, source) {
|
|
|
271
804
|
}
|
|
272
805
|
return r;
|
|
273
806
|
}
|
|
274
|
-
case
|
|
807
|
+
case 29: {
|
|
275
808
|
const _acc = !!(flags & 4);
|
|
276
809
|
const r = {
|
|
277
810
|
type: _acc ? "AccessorProperty" : "PropertyDefinition",
|
|
@@ -297,13 +830,13 @@ function decode(buffer, source) {
|
|
|
297
830
|
}
|
|
298
831
|
return r;
|
|
299
832
|
}
|
|
300
|
-
case
|
|
301
|
-
case
|
|
302
|
-
case
|
|
833
|
+
case 30: return { type: "StaticBlock", start, end, body: nodeArr(f1, f0) };
|
|
834
|
+
case 31: return { type: "Super", start, end };
|
|
835
|
+
case 32: return {
|
|
303
836
|
type: "Literal", start, end,
|
|
304
837
|
value: str(f1, f2), raw: _src.slice(start, end),
|
|
305
838
|
};
|
|
306
|
-
case
|
|
839
|
+
case 33: {
|
|
307
840
|
const r = _src.slice(start, end);
|
|
308
841
|
const s = r.indexOf("_") === -1 ? r : r.replace(/_/g, "");
|
|
309
842
|
const v = (flags & 3) === 2 && s[1] !== "o" && s[1] !== "O"
|
|
@@ -315,7 +848,7 @@ function decode(buffer, source) {
|
|
|
315
848
|
raw: r,
|
|
316
849
|
};
|
|
317
850
|
}
|
|
318
|
-
case
|
|
851
|
+
case 34: {
|
|
319
852
|
const r = _src.slice(start, end);
|
|
320
853
|
const d = str(f1, f2).replace(/_/g, "");
|
|
321
854
|
const v = BigInt(d);
|
|
@@ -324,16 +857,16 @@ function decode(buffer, source) {
|
|
|
324
857
|
value: v, raw: r, bigint: v.toString(),
|
|
325
858
|
};
|
|
326
859
|
}
|
|
327
|
-
case
|
|
860
|
+
case 35: {
|
|
328
861
|
const v = !!(flags & 1);
|
|
329
862
|
return {
|
|
330
863
|
type: "Literal", start, end,
|
|
331
864
|
value: v, raw: v ? "true" : "false",
|
|
332
865
|
};
|
|
333
866
|
}
|
|
334
|
-
case
|
|
335
|
-
case
|
|
336
|
-
case
|
|
867
|
+
case 36: return { type: "Literal", start, end, value: null, raw: "null" };
|
|
868
|
+
case 37: return { type: "ThisExpression", start, end };
|
|
869
|
+
case 38: {
|
|
337
870
|
const p = str(f1, f2), fl = str(f3, f4);
|
|
338
871
|
let v = null;
|
|
339
872
|
try { v = new RegExp(p, fl); } catch {}
|
|
@@ -343,8 +876,8 @@ function decode(buffer, source) {
|
|
|
343
876
|
regex: { pattern: p, flags: fl.split("").sort().join("") },
|
|
344
877
|
};
|
|
345
878
|
}
|
|
346
|
-
case
|
|
347
|
-
case
|
|
879
|
+
case 39: return { type: "TemplateLiteral", start, end, quasis: nodeArr(f1, f0), expressions: nodeArr(f2, f3) };
|
|
880
|
+
case 40: {
|
|
348
881
|
const raw = _src.slice(start, end).replace(/\r\n?/g, "\n");
|
|
349
882
|
const tl = !!(flags & 1);
|
|
350
883
|
const s = _isTs ? start - 1 : start;
|
|
@@ -358,39 +891,39 @@ function decode(buffer, source) {
|
|
|
358
891
|
tail: tl,
|
|
359
892
|
};
|
|
360
893
|
}
|
|
361
|
-
case
|
|
362
|
-
case
|
|
363
|
-
case
|
|
894
|
+
case 41: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = []; r.optional = false; r.typeAnnotation = null; } return r; }
|
|
895
|
+
case 42: return { type: "PrivateIdentifier", start, end, name: str(f1, f2) };
|
|
896
|
+
case 43: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = nodeArr(f3, f0); r.typeAnnotation = f4 !== NULL ? node(f4) : null; r.optional = !!(flags & 1); } return r; }
|
|
897
|
+
case 44: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = []; r.optional = false; r.typeAnnotation = null; } return r; }
|
|
364
898
|
case 45: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = []; r.optional = false; r.typeAnnotation = null; } return r; }
|
|
365
|
-
case 46: { const r = { type: "
|
|
366
|
-
case 47:
|
|
367
|
-
case 48: return { type: "
|
|
368
|
-
case 49: return { type: "
|
|
369
|
-
case 50: return { type: "
|
|
370
|
-
case 51: return { type: "
|
|
371
|
-
case 52: return { type: "
|
|
372
|
-
case 53: return { type: "
|
|
373
|
-
case 54: return { type: "
|
|
374
|
-
case 55: return { type: "
|
|
375
|
-
case 56: return { type: "
|
|
376
|
-
case 57: return { type: "
|
|
377
|
-
case 58: return { type: "
|
|
378
|
-
case 59: return { type: "
|
|
379
|
-
case 60: return { type: "
|
|
380
|
-
case 61: return { type: "
|
|
381
|
-
case 62: return { type: "
|
|
382
|
-
case 63: return { type: "
|
|
383
|
-
case 64: return { type: "
|
|
384
|
-
case 65:
|
|
385
|
-
case 66: { const r = { type: "
|
|
386
|
-
case 67:
|
|
387
|
-
case 68: return {
|
|
899
|
+
case 46: { const r = { type: "ExpressionStatement", start, end, expression: f1 !== NULL ? node(f1) : null }; if (_isTs) { r.directive = null; } return r; }
|
|
900
|
+
case 47: return { type: "IfStatement", start, end, test: f1 !== NULL ? node(f1) : null, consequent: f2 !== NULL ? node(f2) : null, alternate: f3 !== NULL ? node(f3) : null };
|
|
901
|
+
case 48: return { type: "SwitchStatement", start, end, discriminant: f1 !== NULL ? node(f1) : null, cases: nodeArr(f2, f0) };
|
|
902
|
+
case 49: return { type: "SwitchCase", start, end, test: f1 !== NULL ? node(f1) : null, consequent: nodeArr(f2, f0) };
|
|
903
|
+
case 50: return { type: "ForStatement", start, end, init: f1 !== NULL ? node(f1) : null, test: f2 !== NULL ? node(f2) : null, update: f3 !== NULL ? node(f3) : null, body: f4 !== NULL ? node(f4) : null };
|
|
904
|
+
case 51: return { type: "ForInStatement", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, body: f3 !== NULL ? node(f3) : null };
|
|
905
|
+
case 52: return { type: "ForOfStatement", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, body: f3 !== NULL ? node(f3) : null, await: !!(flags & 1) };
|
|
906
|
+
case 53: return { type: "WhileStatement", start, end, test: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
|
|
907
|
+
case 54: return { type: "DoWhileStatement", start, end, body: f1 !== NULL ? node(f1) : null, test: f2 !== NULL ? node(f2) : null };
|
|
908
|
+
case 55: return { type: "BreakStatement", start, end, label: f1 !== NULL ? node(f1) : null };
|
|
909
|
+
case 56: return { type: "ContinueStatement", start, end, label: f1 !== NULL ? node(f1) : null };
|
|
910
|
+
case 57: return { type: "LabeledStatement", start, end, label: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
|
|
911
|
+
case 58: return { type: "WithStatement", start, end, object: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
|
|
912
|
+
case 59: return { type: "ReturnStatement", start, end, argument: f1 !== NULL ? node(f1) : null };
|
|
913
|
+
case 60: return { type: "ThrowStatement", start, end, argument: f1 !== NULL ? node(f1) : null };
|
|
914
|
+
case 61: return { type: "TryStatement", start, end, block: f1 !== NULL ? node(f1) : null, handler: f2 !== NULL ? node(f2) : null, finalizer: f3 !== NULL ? node(f3) : null };
|
|
915
|
+
case 62: return { type: "CatchClause", start, end, param: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
|
|
916
|
+
case 63: return { type: "DebuggerStatement", start, end };
|
|
917
|
+
case 64: return { type: "EmptyStatement", start, end };
|
|
918
|
+
case 65: { const r = { type: "VariableDeclaration", start, end, kind: VAR_KINDS[flags & 7], declarations: nodeArr(f1, f0) }; if (_isTs) { r.declare = !!(flags & 8); } return r; }
|
|
919
|
+
case 66: { const r = { type: "VariableDeclarator", start, end, id: f1 !== NULL ? node(f1) : null, init: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.definite = !!(flags & 1); } return r; }
|
|
920
|
+
case 67: return {
|
|
388
921
|
type: "ExpressionStatement", start, end,
|
|
389
922
|
expression: node(f1), directive: str(f2, f3),
|
|
390
923
|
};
|
|
391
|
-
case
|
|
392
|
-
case
|
|
393
|
-
case
|
|
924
|
+
case 68: { const r = { type: "AssignmentPattern", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.decorators = nodeArr(f3, f0); r.typeAnnotation = f4 !== NULL ? node(f4) : null; r.optional = !!(flags & 1); } return r; }
|
|
925
|
+
case 69: { const r = { type: "RestElement", start, end, argument: f1 !== NULL ? node(f1) : null }; if (_isTs) { r.decorators = nodeArr(f2, f0); r.typeAnnotation = f3 !== NULL ? node(f3) : null; r.optional = !!(flags & 1); r.value = null; } return r; }
|
|
926
|
+
case 70: {
|
|
394
927
|
const el = nodeArrHoles(f1, f0);
|
|
395
928
|
if (f2 !== NULL) el.push(node(f2));
|
|
396
929
|
const r = { type: "ArrayPattern", start, end, elements: el };
|
|
@@ -401,7 +934,7 @@ function decode(buffer, source) {
|
|
|
401
934
|
}
|
|
402
935
|
return r;
|
|
403
936
|
}
|
|
404
|
-
case
|
|
937
|
+
case 71: {
|
|
405
938
|
const pr = nodeArr(f1, f0);
|
|
406
939
|
if (f2 !== NULL) pr.push(node(f2));
|
|
407
940
|
const r = { type: "ObjectPattern", start, end, properties: pr };
|
|
@@ -412,7 +945,7 @@ function decode(buffer, source) {
|
|
|
412
945
|
}
|
|
413
946
|
return r;
|
|
414
947
|
}
|
|
415
|
-
case
|
|
948
|
+
case 72: {
|
|
416
949
|
const r = {
|
|
417
950
|
type: "Property", start, end,
|
|
418
951
|
kind: "init",
|
|
@@ -421,7 +954,7 @@ function decode(buffer, source) {
|
|
|
421
954
|
shorthand: !!(flags & 1),
|
|
422
955
|
computed: !!(flags & 2),
|
|
423
956
|
}; if (_isTs) { r.optional = false; } return r; }
|
|
424
|
-
case
|
|
957
|
+
case 73: return {
|
|
425
958
|
type: "Program", start, end,
|
|
426
959
|
sourceType: (flags & 1) ? "module" : "script",
|
|
427
960
|
hashbang: (flags & 2) ? {
|
|
@@ -431,71 +964,71 @@ function decode(buffer, source) {
|
|
|
431
964
|
} : null,
|
|
432
965
|
body: nodeArr(f1, f0),
|
|
433
966
|
};
|
|
434
|
-
case
|
|
435
|
-
case
|
|
436
|
-
case
|
|
437
|
-
case
|
|
438
|
-
case
|
|
439
|
-
case
|
|
440
|
-
case
|
|
441
|
-
case
|
|
442
|
-
case
|
|
443
|
-
case
|
|
444
|
-
case
|
|
445
|
-
case
|
|
446
|
-
case
|
|
447
|
-
case
|
|
448
|
-
case
|
|
449
|
-
case
|
|
450
|
-
case
|
|
451
|
-
case
|
|
452
|
-
case
|
|
453
|
-
case
|
|
454
|
-
case
|
|
455
|
-
case
|
|
456
|
-
case
|
|
457
|
-
case
|
|
458
|
-
case
|
|
459
|
-
case
|
|
460
|
-
case
|
|
461
|
-
case
|
|
462
|
-
case
|
|
463
|
-
case
|
|
464
|
-
case
|
|
465
|
-
case
|
|
466
|
-
case
|
|
467
|
-
case
|
|
468
|
-
case
|
|
469
|
-
case
|
|
470
|
-
case
|
|
471
|
-
case
|
|
472
|
-
case
|
|
473
|
-
case
|
|
474
|
-
case
|
|
475
|
-
case
|
|
476
|
-
case
|
|
477
|
-
case
|
|
478
|
-
case
|
|
479
|
-
case
|
|
480
|
-
case
|
|
481
|
-
case
|
|
482
|
-
case
|
|
483
|
-
case
|
|
967
|
+
case 74: return { type: "ImportExpression", start, end, source: f1 !== NULL ? node(f1) : null, options: f2 !== NULL ? node(f2) : null, phase: (flags & 1) ? ["source", "defer"][(flags >> 1) & 1] : null };
|
|
968
|
+
case 75: { const r = { type: "ImportDeclaration", start, end, specifiers: nodeArr(f1, f0), source: f2 !== NULL ? node(f2) : null, attributes: nodeArr(f3, f4), phase: (flags & 1) ? ["source", "defer"][(flags >> 1) & 1] : null }; if (_isTs) { r.importKind = IMPORT_EXPORT_KINDS[(flags >> 2) & 1]; } return r; }
|
|
969
|
+
case 76: { const r = { type: "ImportSpecifier", start, end, imported: f1 !== NULL ? node(f1) : null, local: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.importKind = IMPORT_EXPORT_KINDS[flags & 1]; } return r; }
|
|
970
|
+
case 77: return { type: "ImportDefaultSpecifier", start, end, local: f1 !== NULL ? node(f1) : null };
|
|
971
|
+
case 78: return { type: "ImportNamespaceSpecifier", start, end, local: f1 !== NULL ? node(f1) : null };
|
|
972
|
+
case 79: return { type: "ImportAttribute", start, end, key: f1 !== NULL ? node(f1) : null, value: f2 !== NULL ? node(f2) : null };
|
|
973
|
+
case 80: { const r = { type: "ExportNamedDeclaration", start, end, declaration: f1 !== NULL ? node(f1) : null, specifiers: nodeArr(f2, f0), source: f3 !== NULL ? node(f3) : null, attributes: nodeArr(f4, f5) }; if (_isTs) { r.exportKind = IMPORT_EXPORT_KINDS[flags & 1]; } return r; }
|
|
974
|
+
case 81: { const r = { type: "ExportDefaultDeclaration", start, end, declaration: f1 !== NULL ? node(f1) : null }; if (_isTs) { r.exportKind = "value"; } return r; }
|
|
975
|
+
case 82: { const r = { type: "ExportAllDeclaration", start, end, exported: f1 !== NULL ? node(f1) : null, source: f2 !== NULL ? node(f2) : null, attributes: nodeArr(f3, f0) }; if (_isTs) { r.exportKind = IMPORT_EXPORT_KINDS[flags & 1]; } return r; }
|
|
976
|
+
case 83: { const r = { type: "ExportSpecifier", start, end, local: f1 !== NULL ? node(f1) : null, exported: f2 !== NULL ? node(f2) : null }; if (_isTs) { r.exportKind = IMPORT_EXPORT_KINDS[flags & 1]; } return r; }
|
|
977
|
+
case 84: return { type: "TSTypeAnnotation", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
|
|
978
|
+
case 85: return { type: "TSAnyKeyword", start, end };
|
|
979
|
+
case 86: return { type: "TSUnknownKeyword", start, end };
|
|
980
|
+
case 87: return { type: "TSNeverKeyword", start, end };
|
|
981
|
+
case 88: return { type: "TSVoidKeyword", start, end };
|
|
982
|
+
case 89: return { type: "TSNullKeyword", start, end };
|
|
983
|
+
case 90: return { type: "TSUndefinedKeyword", start, end };
|
|
984
|
+
case 91: return { type: "TSStringKeyword", start, end };
|
|
985
|
+
case 92: return { type: "TSNumberKeyword", start, end };
|
|
986
|
+
case 93: return { type: "TSBigIntKeyword", start, end };
|
|
987
|
+
case 94: return { type: "TSBooleanKeyword", start, end };
|
|
988
|
+
case 95: return { type: "TSSymbolKeyword", start, end };
|
|
989
|
+
case 96: return { type: "TSObjectKeyword", start, end };
|
|
990
|
+
case 97: return { type: "TSIntrinsicKeyword", start, end };
|
|
991
|
+
case 98: return { type: "TSThisType", start, end };
|
|
992
|
+
case 99: return { type: "TSTypeReference", start, end, typeName: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
|
|
993
|
+
case 100: return { type: "TSQualifiedName", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null };
|
|
994
|
+
case 101: return { type: "TSTypeQuery", start, end, exprName: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
|
|
995
|
+
case 102: return { type: "TSImportType", start, end, source: f1 !== NULL ? node(f1) : null, options: f2 !== NULL ? node(f2) : null, qualifier: f3 !== NULL ? node(f3) : null, typeArguments: f4 !== NULL ? node(f4) : null };
|
|
996
|
+
case 103: return { type: "TSTypeParameter", start, end, name: f1 !== NULL ? node(f1) : null, constraint: f2 !== NULL ? node(f2) : null, default: f3 !== NULL ? node(f3) : null, in: !!(flags & 1), out: !!(flags & 2), const: !!(flags & 4) };
|
|
997
|
+
case 104: return { type: "TSTypeParameterDeclaration", start, end, params: nodeArr(f1, f0) };
|
|
998
|
+
case 105: return { type: "TSTypeParameterInstantiation", start, end, params: nodeArr(f1, f0) };
|
|
999
|
+
case 106: return { type: "TSLiteralType", start, end, literal: f1 !== NULL ? node(f1) : null };
|
|
1000
|
+
case 107: return { type: "TSTemplateLiteralType", start, end, quasis: nodeArr(f1, f0), types: nodeArr(f2, f3) };
|
|
1001
|
+
case 108: return { type: "TSArrayType", start, end, elementType: f1 !== NULL ? node(f1) : null };
|
|
1002
|
+
case 109: return { type: "TSIndexedAccessType", start, end, objectType: f1 !== NULL ? node(f1) : null, indexType: f2 !== NULL ? node(f2) : null };
|
|
1003
|
+
case 110: return { type: "TSTupleType", start, end, elementTypes: nodeArr(f1, f0) };
|
|
1004
|
+
case 111: return { type: "TSNamedTupleMember", start, end, label: f1 !== NULL ? node(f1) : null, elementType: f2 !== NULL ? node(f2) : null, optional: !!(flags & 1) };
|
|
1005
|
+
case 112: return { type: "TSOptionalType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
|
|
1006
|
+
case 113: return { type: "TSRestType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
|
|
1007
|
+
case 114: return { type: "TSJSDocNullableType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null, postfix: !!(flags & 1) };
|
|
1008
|
+
case 115: return { type: "TSJSDocNonNullableType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null, postfix: !!(flags & 1) };
|
|
1009
|
+
case 116: return { type: "TSJSDocUnknownType", start, end };
|
|
1010
|
+
case 117: return { type: "TSUnionType", start, end, types: nodeArr(f1, f0) };
|
|
1011
|
+
case 118: return { type: "TSIntersectionType", start, end, types: nodeArr(f1, f0) };
|
|
1012
|
+
case 119: return { type: "TSConditionalType", start, end, checkType: f1 !== NULL ? node(f1) : null, extendsType: f2 !== NULL ? node(f2) : null, trueType: f3 !== NULL ? node(f3) : null, falseType: f4 !== NULL ? node(f4) : null };
|
|
1013
|
+
case 120: return { type: "TSInferType", start, end, typeParameter: f1 !== NULL ? node(f1) : null };
|
|
1014
|
+
case 121: return { type: "TSTypeOperator", start, end, operator: TS_TYPE_OPERATORS[flags & 3], typeAnnotation: f1 !== NULL ? node(f1) : null };
|
|
1015
|
+
case 122: return { type: "TSParenthesizedType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
|
|
1016
|
+
case 123: return {
|
|
484
1017
|
type: "TSFunctionType", start, end,
|
|
485
1018
|
typeParameters: f1 !== NULL ? node(f1) : null,
|
|
486
1019
|
params: f2 !== NULL ? fnParams(f2) : [],
|
|
487
1020
|
returnType: f3 !== NULL ? node(f3) : null,
|
|
488
1021
|
};
|
|
489
|
-
case
|
|
1022
|
+
case 124: return {
|
|
490
1023
|
type: "TSConstructorType", start, end,
|
|
491
1024
|
abstract: !!(flags & 1),
|
|
492
1025
|
typeParameters: f1 !== NULL ? node(f1) : null,
|
|
493
1026
|
params: f2 !== NULL ? fnParams(f2) : [],
|
|
494
1027
|
returnType: f3 !== NULL ? node(f3) : null,
|
|
495
1028
|
};
|
|
496
|
-
case
|
|
497
|
-
case
|
|
498
|
-
case
|
|
1029
|
+
case 125: return { type: "TSTypePredicate", start, end, parameterName: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null, asserts: !!(flags & 1) };
|
|
1030
|
+
case 126: return { type: "TSTypeLiteral", start, end, members: nodeArr(f1, f0) };
|
|
1031
|
+
case 127: return {
|
|
499
1032
|
type: "TSMappedType", start, end,
|
|
500
1033
|
key: node(f1),
|
|
501
1034
|
constraint: node(f2),
|
|
@@ -504,8 +1037,8 @@ function decode(buffer, source) {
|
|
|
504
1037
|
optional: TS_MAPPED_OPTIONAL[(flags >> 0) & 3],
|
|
505
1038
|
readonly: TS_MAPPED_READONLY[(flags >> 2) & 3],
|
|
506
1039
|
};
|
|
507
|
-
case
|
|
508
|
-
case
|
|
1040
|
+
case 128: { const r = { type: "TSPropertySignature", start, end, key: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null, computed: !!(flags & 1), optional: !!(flags & 2), readonly: !!(flags & 4) }; if (_isTs) { r.accessibility = null; r.static = false; } return r; }
|
|
1041
|
+
case 129: return {
|
|
509
1042
|
type: "TSMethodSignature", start, end,
|
|
510
1043
|
key: node(f1),
|
|
511
1044
|
computed: !!(flags & 4),
|
|
@@ -516,28 +1049,28 @@ function decode(buffer, source) {
|
|
|
516
1049
|
returnType: f4 !== NULL ? node(f4) : null,
|
|
517
1050
|
accessibility: null, readonly: false, static: false,
|
|
518
1051
|
};
|
|
519
|
-
case
|
|
1052
|
+
case 130: return {
|
|
520
1053
|
type: "TSCallSignatureDeclaration", start, end,
|
|
521
1054
|
typeParameters: f1 !== NULL ? node(f1) : null,
|
|
522
1055
|
params: f2 !== NULL ? fnParams(f2) : [],
|
|
523
1056
|
returnType: f3 !== NULL ? node(f3) : null,
|
|
524
1057
|
};
|
|
525
|
-
case
|
|
1058
|
+
case 131: return {
|
|
526
1059
|
type: "TSConstructSignatureDeclaration", start, end,
|
|
527
1060
|
typeParameters: f1 !== NULL ? node(f1) : null,
|
|
528
1061
|
params: f2 !== NULL ? fnParams(f2) : [],
|
|
529
1062
|
returnType: f3 !== NULL ? node(f3) : null,
|
|
530
1063
|
};
|
|
531
|
-
case
|
|
532
|
-
case
|
|
533
|
-
case
|
|
534
|
-
case
|
|
535
|
-
case
|
|
536
|
-
case
|
|
537
|
-
case
|
|
538
|
-
case
|
|
539
|
-
case
|
|
540
|
-
case
|
|
1064
|
+
case 132: { const r = { type: "TSIndexSignature", start, end, parameters: nodeArr(f1, f0), typeAnnotation: f2 !== NULL ? node(f2) : null, readonly: !!(flags & 1) }; if (_isTs) { r.static = !!(flags & 2); r.accessibility = null; } return r; }
|
|
1065
|
+
case 133: return { type: "TSTypeAliasDeclaration", start, end, id: f1 !== NULL ? node(f1) : null, typeParameters: f2 !== NULL ? node(f2) : null, typeAnnotation: f3 !== NULL ? node(f3) : null, declare: !!(flags & 1) };
|
|
1066
|
+
case 134: return { type: "TSInterfaceDeclaration", start, end, id: f1 !== NULL ? node(f1) : null, typeParameters: f2 !== NULL ? node(f2) : null, extends: nodeArr(f3, f0), body: f4 !== NULL ? node(f4) : null, declare: !!(flags & 1) };
|
|
1067
|
+
case 135: return { type: "TSInterfaceBody", start, end, body: nodeArr(f1, f0) };
|
|
1068
|
+
case 136: return { type: "TSInterfaceHeritage", start, end, expression: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
|
|
1069
|
+
case 137: return { type: "TSClassImplements", start, end, expression: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
|
|
1070
|
+
case 138: return { type: "TSEnumDeclaration", start, end, id: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null, const: !!(flags & 1), declare: !!(flags & 2) };
|
|
1071
|
+
case 139: return { type: "TSEnumBody", start, end, members: nodeArr(f1, f0) };
|
|
1072
|
+
case 140: return { type: "TSEnumMember", start, end, id: f1 !== NULL ? node(f1) : null, initializer: f2 !== NULL ? node(f2) : null, computed: !!(flags & 1) };
|
|
1073
|
+
case 141: {
|
|
541
1074
|
const r = {
|
|
542
1075
|
type: "TSModuleDeclaration", start, end,
|
|
543
1076
|
id: node(f1),
|
|
@@ -548,55 +1081,58 @@ function decode(buffer, source) {
|
|
|
548
1081
|
if (f2 !== NULL) r.body = node(f2);
|
|
549
1082
|
return r;
|
|
550
1083
|
}
|
|
551
|
-
case
|
|
552
|
-
case
|
|
1084
|
+
case 142: return { type: "TSModuleBlock", start, end, body: nodeArr(f1, f0) };
|
|
1085
|
+
case 143: return {
|
|
553
1086
|
type: "TSModuleDeclaration", start, end,
|
|
554
1087
|
id: node(f1), body: node(f2),
|
|
555
1088
|
kind: "global",
|
|
556
1089
|
declare: !!(flags & 1),
|
|
557
1090
|
global: true,
|
|
558
1091
|
};
|
|
559
|
-
case
|
|
560
|
-
case
|
|
1092
|
+
case 144: { const r = { type: "TSParameterProperty", start, end, decorators: nodeArr(f1, f0), parameter: f2 !== NULL ? node(f2) : null, override: !!(flags & 1), readonly: !!(flags & 2), accessibility: ACCESSIBILITY[(flags >> 2) & 3] }; if (_isTs) { r.static = false; } return r; }
|
|
1093
|
+
case 145: return {
|
|
561
1094
|
type: "Identifier", start, end,
|
|
562
1095
|
decorators: [],
|
|
563
1096
|
name: "this", optional: false,
|
|
564
1097
|
typeAnnotation: f1 !== NULL ? node(f1) : null,
|
|
565
1098
|
};
|
|
566
|
-
case
|
|
567
|
-
case
|
|
568
|
-
case
|
|
569
|
-
case
|
|
570
|
-
case
|
|
571
|
-
case
|
|
572
|
-
case
|
|
573
|
-
case
|
|
574
|
-
case
|
|
575
|
-
case
|
|
576
|
-
case
|
|
577
|
-
case
|
|
578
|
-
case
|
|
579
|
-
case
|
|
580
|
-
case
|
|
581
|
-
case
|
|
582
|
-
case
|
|
583
|
-
case
|
|
584
|
-
case
|
|
585
|
-
case
|
|
586
|
-
case
|
|
587
|
-
case
|
|
588
|
-
case
|
|
1099
|
+
case 146: return { type: "TSAsExpression", start, end, expression: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null };
|
|
1100
|
+
case 147: return { type: "TSSatisfiesExpression", start, end, expression: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null };
|
|
1101
|
+
case 148: return { type: "TSTypeAssertion", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null, expression: f2 !== NULL ? node(f2) : null };
|
|
1102
|
+
case 149: return { type: "TSNonNullExpression", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
1103
|
+
case 150: return { type: "TSInstantiationExpression", start, end, expression: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
|
|
1104
|
+
case 151: return { type: "TSExportAssignment", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
1105
|
+
case 152: return { type: "TSNamespaceExportDeclaration", start, end, id: f1 !== NULL ? node(f1) : null };
|
|
1106
|
+
case 153: return { type: "TSImportEqualsDeclaration", start, end, id: f1 !== NULL ? node(f1) : null, moduleReference: f2 !== NULL ? node(f2) : null, importKind: IMPORT_EXPORT_KINDS[flags & 1] };
|
|
1107
|
+
case 154: return { type: "TSExternalModuleReference", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
1108
|
+
case 155: return { type: "JSXElement", start, end, openingElement: f1 !== NULL ? node(f1) : null, children: nodeArr(f2, f0), closingElement: f3 !== NULL ? node(f3) : null };
|
|
1109
|
+
case 156: { const r = { type: "JSXOpeningElement", start, end, name: f1 !== NULL ? node(f1) : null, attributes: nodeArr(f2, f0), selfClosing: !!(flags & 1) }; if (_isTs) { r.typeArguments = f3 !== NULL ? node(f3) : null; } return r; }
|
|
1110
|
+
case 157: return { type: "JSXClosingElement", start, end, name: f1 !== NULL ? node(f1) : null };
|
|
1111
|
+
case 158: return { type: "JSXFragment", start, end, openingFragment: f1 !== NULL ? node(f1) : null, children: nodeArr(f2, f0), closingFragment: f3 !== NULL ? node(f3) : null };
|
|
1112
|
+
case 159: return { type: "JSXOpeningFragment", start, end };
|
|
1113
|
+
case 160: return { type: "JSXClosingFragment", start, end };
|
|
1114
|
+
case 161: return { type: "JSXIdentifier", start, end, name: str(f1, f2) };
|
|
1115
|
+
case 162: return { type: "JSXNamespacedName", start, end, namespace: f1 !== NULL ? node(f1) : null, name: f2 !== NULL ? node(f2) : null };
|
|
1116
|
+
case 163: return { type: "JSXMemberExpression", start, end, object: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null };
|
|
1117
|
+
case 164: return { type: "JSXAttribute", start, end, name: f1 !== NULL ? node(f1) : null, value: f2 !== NULL ? node(f2) : null };
|
|
1118
|
+
case 165: return { type: "JSXSpreadAttribute", start, end, argument: f1 !== NULL ? node(f1) : null };
|
|
1119
|
+
case 166: return { type: "JSXExpressionContainer", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
1120
|
+
case 167: return { type: "JSXEmptyExpression", start, end };
|
|
1121
|
+
case 168: {
|
|
589
1122
|
const t = str(f1, f2);
|
|
590
1123
|
return { type: "JSXText", start, end, value: t, raw: t };
|
|
591
1124
|
}
|
|
592
|
-
case
|
|
1125
|
+
case 169: return { type: "JSXSpreadChild", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
593
1126
|
}
|
|
594
1127
|
}
|
|
595
1128
|
const node = _attached ? nodeWithComments : _decode;
|
|
1129
|
+
const _nodesU32 = _nodesOff >> 2;
|
|
1130
|
+
function startOf(i) { return _p(_u32[_nodesU32 + i * 12 + 10]); }
|
|
1131
|
+
function endOf(i) { return _p(_u32[_nodesU32 + i * 12 + 11]); }
|
|
596
1132
|
const lsOff = _cOff + commentCount * 20;
|
|
597
1133
|
const dOff = lsOff + lineStartsCount * 4;
|
|
598
1134
|
function _decodeComments() {
|
|
599
|
-
const out =
|
|
1135
|
+
const out = Array.from({ length: commentCount });
|
|
600
1136
|
for (let j = 0; j < commentCount; j++) {
|
|
601
1137
|
const o = _cOff + j * 20;
|
|
602
1138
|
const cf = _u8[o + 0];
|
|
@@ -614,7 +1150,7 @@ function decode(buffer, source) {
|
|
|
614
1150
|
return out;
|
|
615
1151
|
}
|
|
616
1152
|
function _decodeLineStarts() {
|
|
617
|
-
const out =
|
|
1153
|
+
const out = Array.from({ length: lineStartsCount });
|
|
618
1154
|
if (_firstNa >= _srcLen) {
|
|
619
1155
|
for (let j = 0; j < lineStartsCount; j++) {
|
|
620
1156
|
out[j] = dv.getUint32(lsOff + j * 4, true);
|
|
@@ -628,7 +1164,7 @@ function decode(buffer, source) {
|
|
|
628
1164
|
return out;
|
|
629
1165
|
}
|
|
630
1166
|
function _decodeDiagnostics() {
|
|
631
|
-
const out =
|
|
1167
|
+
const out = Array.from({ length: diagCount });
|
|
632
1168
|
let dp = dOff;
|
|
633
1169
|
for (let j = 0; j < diagCount; j++) {
|
|
634
1170
|
const sev = SEVERITY[_u8[dp]]; dp++;
|
|
@@ -643,7 +1179,7 @@ function decode(buffer, source) {
|
|
|
643
1179
|
help = _td.decode(_u8.subarray(dp, dp + hl)); dp += hl;
|
|
644
1180
|
}
|
|
645
1181
|
const lc = dv.getUint32(dp, true); dp += 4;
|
|
646
|
-
const labels =
|
|
1182
|
+
const labels = Array.from({ length: lc });
|
|
647
1183
|
for (let k = 0; k < lc; k++) {
|
|
648
1184
|
const ls = _p(dv.getUint32(dp, true)); dp += 4;
|
|
649
1185
|
const le = _p(dv.getUint32(dp, true)); dp += 4;
|
|
@@ -659,6 +1195,104 @@ function decode(buffer, source) {
|
|
|
659
1195
|
}
|
|
660
1196
|
return out;
|
|
661
1197
|
}
|
|
1198
|
+
function _scanType(tag, flags) {
|
|
1199
|
+
switch (tag) {
|
|
1200
|
+
case 3: return FUNCTION_TYPES[flags & 3];
|
|
1201
|
+
case 26: return CLASS_TYPES[flags & 1];
|
|
1202
|
+
case 28:
|
|
1203
|
+
return _isTs && (flags & 64)
|
|
1204
|
+
? "TSAbstractMethodDefinition"
|
|
1205
|
+
: "MethodDefinition";
|
|
1206
|
+
default: {
|
|
1207
|
+
const acc = (flags & 4) !== 0;
|
|
1208
|
+
if (_isTs && (flags & 256)) {
|
|
1209
|
+
return acc ? "TSAbstractAccessorProperty" : "TSAbstractPropertyDefinition";
|
|
1210
|
+
}
|
|
1211
|
+
return acc ? "AccessorProperty" : "PropertyDefinition";
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
function scan(visitors) {
|
|
1216
|
+
const handlers = new Map();
|
|
1217
|
+
let every = null;
|
|
1218
|
+
for (const k of Object.keys(visitors)) {
|
|
1219
|
+
const v = visitors[k];
|
|
1220
|
+
if (typeof v !== "function") continue;
|
|
1221
|
+
if (k === "enter") every = v;
|
|
1222
|
+
else handlers.set(k, v);
|
|
1223
|
+
}
|
|
1224
|
+
const wanted = new Array(TAG_TYPES.length).fill(null);
|
|
1225
|
+
for (let t = 0; t < TAG_TYPES.length; t++) {
|
|
1226
|
+
const tt = TAG_TYPES[t];
|
|
1227
|
+
if (tt === null) continue;
|
|
1228
|
+
if (tt === 0) {
|
|
1229
|
+
for (const c of TAG_CHOICES.get(t)) {
|
|
1230
|
+
if (handlers.has(c)) { wanted[t] = 0; break; }
|
|
1231
|
+
}
|
|
1232
|
+
} else {
|
|
1233
|
+
const h = handlers.get(tt);
|
|
1234
|
+
if (h !== undefined) wanted[t] = h;
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
let stopFlag = false, skipFlag = false;
|
|
1238
|
+
let curIndex = 0, curO = 0, curTag = 0;
|
|
1239
|
+
const cursor = {
|
|
1240
|
+
get index() { return curIndex; },
|
|
1241
|
+
get type() {
|
|
1242
|
+
const t = TAG_TYPES[curTag];
|
|
1243
|
+
return t !== 0 ? t : _scanType(curTag, _u8[curO + 2] | (_u8[curO + 3] << 8));
|
|
1244
|
+
},
|
|
1245
|
+
get start() { return startOf(curIndex); },
|
|
1246
|
+
get end() { return endOf(curIndex); },
|
|
1247
|
+
node() { return node(curIndex); },
|
|
1248
|
+
skip() { skipFlag = true; },
|
|
1249
|
+
stop() { stopFlag = true; },
|
|
1250
|
+
};
|
|
1251
|
+
(function visit(i) {
|
|
1252
|
+
const o = _nodesOff + i * 48;
|
|
1253
|
+
const tag = _u8[o];
|
|
1254
|
+
let h = wanted[tag];
|
|
1255
|
+
if (h !== null || every !== null) {
|
|
1256
|
+
curIndex = i; curO = o; curTag = tag;
|
|
1257
|
+
if (h === 0) {
|
|
1258
|
+
h = handlers.get(_scanType(tag, _u8[o + 2] | (_u8[o + 3] << 8))) ?? null;
|
|
1259
|
+
}
|
|
1260
|
+
if (every !== null && TAG_TYPES[tag] !== null) {
|
|
1261
|
+
every(cursor);
|
|
1262
|
+
if (stopFlag) return;
|
|
1263
|
+
}
|
|
1264
|
+
if (h !== null) {
|
|
1265
|
+
h(cursor);
|
|
1266
|
+
if (stopFlag) return;
|
|
1267
|
+
}
|
|
1268
|
+
if (skipFlag) { skipFlag = false; return; }
|
|
1269
|
+
}
|
|
1270
|
+
const ops = SCAN_CHILDREN[tag];
|
|
1271
|
+
const b = o >> 2;
|
|
1272
|
+
for (let p = 0; p < ops.length; p += 2) {
|
|
1273
|
+
const slot = ops[p + 1];
|
|
1274
|
+
if (ops[p] === 0) {
|
|
1275
|
+
const c = _u32[b + slot];
|
|
1276
|
+
if (c !== NULL) {
|
|
1277
|
+
visit(c);
|
|
1278
|
+
if (stopFlag) return;
|
|
1279
|
+
}
|
|
1280
|
+
} else {
|
|
1281
|
+
const s = _u32[b + slot];
|
|
1282
|
+
const len = ops[p] === 1
|
|
1283
|
+
? _u32[b + slot + 1]
|
|
1284
|
+
: _u8[o + 4] | (_u8[o + 5] << 8);
|
|
1285
|
+
for (let j = 0; j < len; j++) {
|
|
1286
|
+
const c = _u32[_extraBase + s + j];
|
|
1287
|
+
if (c !== NULL) {
|
|
1288
|
+
visit(c);
|
|
1289
|
+
if (stopFlag) return;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
})(progIdx);
|
|
1295
|
+
}
|
|
662
1296
|
let _program, _lineStarts, _diagnostics, _comments;
|
|
663
1297
|
function _getLineStarts() {
|
|
664
1298
|
if (_lineStarts === undefined) _lineStarts = _decodeLineStarts();
|
|
@@ -688,18 +1322,7 @@ function decode(buffer, source) {
|
|
|
688
1322
|
}
|
|
689
1323
|
return { line: lo, column: offset - ls[lo - 1] };
|
|
690
1324
|
},
|
|
691
|
-
|
|
692
|
-
const ls = _getLineStarts();
|
|
693
|
-
let i = hintLine - 1;
|
|
694
|
-
if (i < 0) i = 0;
|
|
695
|
-
if (i >= ls.length) i = ls.length - 1;
|
|
696
|
-
if (ls[i] <= offset) {
|
|
697
|
-
while (i + 1 < ls.length && ls[i + 1] <= offset) i++;
|
|
698
|
-
} else {
|
|
699
|
-
while (i > 0 && ls[i] > offset) i--;
|
|
700
|
-
}
|
|
701
|
-
return { line: i + 1, column: offset - ls[i] };
|
|
702
|
-
},
|
|
1325
|
+
scan,
|
|
703
1326
|
};
|
|
704
1327
|
}
|
|
705
|
-
export { decode };
|
|
1328
|
+
export { decode, CHILD_KEYS };
|