yuku-analyzer 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 +164 -0
- package/analyzer.js +290 -0
- package/binding.js +63 -0
- package/decode.js +1462 -0
- package/engine.js +198 -0
- package/index.d.ts +578 -0
- package/index.js +2 -0
- package/module.js +611 -0
- package/package.json +54 -0
- package/walk.js +43 -0
package/decode.js
ADDED
|
@@ -0,0 +1,1462 @@
|
|
|
1
|
+
// generated by tools/estree/decoder.zig, do not edit
|
|
2
|
+
const NULL = -1;
|
|
3
|
+
const _td = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
4
|
+
const BINARY_OPS = ["==", "!=", "===", "!==", "<", "<=", ">", ">=", "+", "-", "*", "/", "%", "**", "|", "^", "&", "<<", ">>", ">>>", "in", "instanceof"];
|
|
5
|
+
const LOGICAL_OPS = ["&&", "||", "??"];
|
|
6
|
+
const UNARY_OPS = ["-", "+", "!", "~", "typeof", "void", "delete"];
|
|
7
|
+
const UPDATE_OPS = ["++", "--"];
|
|
8
|
+
const ASSIGNMENT_OPS = ["=", "+=", "-=", "*=", "/=", "%=", "**=", "<<=", ">>=", ">>>=", "|=", "^=", "&=", "||=", "&&=", "??="];
|
|
9
|
+
const VAR_KINDS = ["var", "let", "const", "using", "await using"];
|
|
10
|
+
const PROPERTY_KINDS = ["init", "get", "set"];
|
|
11
|
+
const METHOD_KINDS = ["constructor", "method", "get", "set"];
|
|
12
|
+
const FUNCTION_TYPES = ["FunctionDeclaration", "FunctionExpression", "TSDeclareFunction", "TSEmptyBodyFunctionExpression"];
|
|
13
|
+
const CLASS_TYPES = ["ClassDeclaration", "ClassExpression"];
|
|
14
|
+
const SEVERITY = ["error", "warning", "hint", "info"];
|
|
15
|
+
const IMPORT_EXPORT_KINDS = ["value", "type"];
|
|
16
|
+
const ACCESSIBILITY = [null, "public", "private", "protected"];
|
|
17
|
+
const TS_TYPE_OPERATORS = ["keyof", "unique", "readonly"];
|
|
18
|
+
const TS_METHOD_SIGNATURE_KINDS = ["method", "get", "set"];
|
|
19
|
+
const TS_MODULE_KINDS = ["namespace", "module"];
|
|
20
|
+
const TS_MAPPED_OPTIONAL = [false, true, "+", "-"];
|
|
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 SCOPE_KINDS = ["global", "module", "function", "block", "class", "staticBlock", "expressionName", "tsModule"];
|
|
207
|
+
const NAME_KINDS = ["named", "star", "none", "equals", "global"];
|
|
208
|
+
const IMPORT_PHASES = ["source", "defer"];
|
|
209
|
+
const SymbolFlags = Object.freeze({
|
|
210
|
+
FunctionScopedVariable: 1 << 0,
|
|
211
|
+
BlockScopedVariable: 1 << 1,
|
|
212
|
+
Function: 1 << 2,
|
|
213
|
+
Class: 1 << 3,
|
|
214
|
+
RegularEnum: 1 << 4,
|
|
215
|
+
ConstEnum: 1 << 5,
|
|
216
|
+
ValueModule: 1 << 6,
|
|
217
|
+
Interface: 1 << 7,
|
|
218
|
+
TypeAlias: 1 << 8,
|
|
219
|
+
TypeParameter: 1 << 9,
|
|
220
|
+
NamespaceModule: 1 << 10,
|
|
221
|
+
ValueImport: 1 << 11,
|
|
222
|
+
TypeImport: 1 << 12,
|
|
223
|
+
Const: 1 << 13,
|
|
224
|
+
Ambient: 1 << 14,
|
|
225
|
+
Parameter: 1 << 15,
|
|
226
|
+
CatchVariable: 1 << 16,
|
|
227
|
+
Exported: 1 << 17,
|
|
228
|
+
Default: 1 << 18,
|
|
229
|
+
Variable: 3,
|
|
230
|
+
Import: 6144,
|
|
231
|
+
ValueSpace: 127,
|
|
232
|
+
TypeSpace: 952,
|
|
233
|
+
});
|
|
234
|
+
const SCAN_CHILDREN = [
|
|
235
|
+
[2, 2],
|
|
236
|
+
[0, 2],
|
|
237
|
+
[0, 2, 0, 3, 0, 4, 0, 5],
|
|
238
|
+
[0, 2, 0, 3, 0, 4, 0, 5, 0, 6],
|
|
239
|
+
[2, 2],
|
|
240
|
+
[2, 2],
|
|
241
|
+
[2, 2, 0, 3],
|
|
242
|
+
[0, 2, 0, 3],
|
|
243
|
+
[0, 2, 0, 3],
|
|
244
|
+
[0, 2, 0, 3, 0, 4],
|
|
245
|
+
[0, 2],
|
|
246
|
+
[0, 2],
|
|
247
|
+
[0, 2, 0, 3],
|
|
248
|
+
[2, 2],
|
|
249
|
+
[2, 2],
|
|
250
|
+
[0, 2],
|
|
251
|
+
[0, 2, 0, 3],
|
|
252
|
+
[0, 2, 0, 3],
|
|
253
|
+
[0, 2, 2, 3, 0, 4],
|
|
254
|
+
[0, 2],
|
|
255
|
+
[0, 2, 0, 3, 0, 4],
|
|
256
|
+
[0, 2, 2, 3, 0, 4],
|
|
257
|
+
[0, 2],
|
|
258
|
+
[0, 2],
|
|
259
|
+
[0, 2, 0, 3],
|
|
260
|
+
[0, 2],
|
|
261
|
+
[2, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 1, 8],
|
|
262
|
+
[2, 2],
|
|
263
|
+
[2, 2, 0, 3, 0, 4],
|
|
264
|
+
[2, 2, 0, 3, 0, 4, 0, 5],
|
|
265
|
+
[2, 2],
|
|
266
|
+
[],
|
|
267
|
+
[],
|
|
268
|
+
[],
|
|
269
|
+
[],
|
|
270
|
+
[],
|
|
271
|
+
[],
|
|
272
|
+
[],
|
|
273
|
+
[],
|
|
274
|
+
[2, 2, 1, 3],
|
|
275
|
+
[],
|
|
276
|
+
[],
|
|
277
|
+
[],
|
|
278
|
+
[2, 4, 0, 5],
|
|
279
|
+
[],
|
|
280
|
+
[],
|
|
281
|
+
[0, 2],
|
|
282
|
+
[0, 2, 0, 3, 0, 4],
|
|
283
|
+
[0, 2, 2, 3],
|
|
284
|
+
[0, 2, 2, 3],
|
|
285
|
+
[0, 2, 0, 3, 0, 4, 0, 5],
|
|
286
|
+
[0, 2, 0, 3, 0, 4],
|
|
287
|
+
[0, 2, 0, 3, 0, 4],
|
|
288
|
+
[0, 2, 0, 3],
|
|
289
|
+
[0, 2, 0, 3],
|
|
290
|
+
[0, 2],
|
|
291
|
+
[0, 2],
|
|
292
|
+
[0, 2, 0, 3],
|
|
293
|
+
[0, 2, 0, 3],
|
|
294
|
+
[0, 2],
|
|
295
|
+
[0, 2],
|
|
296
|
+
[0, 2, 0, 3, 0, 4],
|
|
297
|
+
[0, 2, 0, 3],
|
|
298
|
+
[],
|
|
299
|
+
[],
|
|
300
|
+
[2, 2],
|
|
301
|
+
[0, 2, 0, 3],
|
|
302
|
+
[0, 2],
|
|
303
|
+
[0, 2, 0, 3, 2, 4, 0, 5],
|
|
304
|
+
[0, 2, 2, 3, 0, 4],
|
|
305
|
+
[2, 2, 0, 3, 1, 4, 0, 6],
|
|
306
|
+
[2, 2, 0, 3, 1, 4, 0, 6],
|
|
307
|
+
[0, 2, 0, 3],
|
|
308
|
+
[2, 2],
|
|
309
|
+
[0, 2, 0, 3],
|
|
310
|
+
[2, 2, 0, 3, 1, 4],
|
|
311
|
+
[0, 2, 0, 3],
|
|
312
|
+
[0, 2],
|
|
313
|
+
[0, 2],
|
|
314
|
+
[0, 2, 0, 3],
|
|
315
|
+
[0, 2, 2, 3, 0, 4, 1, 5],
|
|
316
|
+
[0, 2],
|
|
317
|
+
[0, 2, 0, 3, 2, 4],
|
|
318
|
+
[0, 2, 0, 3],
|
|
319
|
+
[0, 2],
|
|
320
|
+
[],
|
|
321
|
+
[],
|
|
322
|
+
[],
|
|
323
|
+
[],
|
|
324
|
+
[],
|
|
325
|
+
[],
|
|
326
|
+
[],
|
|
327
|
+
[],
|
|
328
|
+
[],
|
|
329
|
+
[],
|
|
330
|
+
[],
|
|
331
|
+
[],
|
|
332
|
+
[],
|
|
333
|
+
[],
|
|
334
|
+
[0, 2, 0, 3],
|
|
335
|
+
[0, 2, 0, 3],
|
|
336
|
+
[0, 2, 0, 3],
|
|
337
|
+
[0, 2, 0, 3, 0, 4, 0, 5],
|
|
338
|
+
[0, 2, 0, 3, 0, 4],
|
|
339
|
+
[2, 2],
|
|
340
|
+
[2, 2],
|
|
341
|
+
[0, 2],
|
|
342
|
+
[2, 2, 1, 3],
|
|
343
|
+
[0, 2],
|
|
344
|
+
[0, 2, 0, 3],
|
|
345
|
+
[2, 2],
|
|
346
|
+
[0, 2, 0, 3],
|
|
347
|
+
[0, 2],
|
|
348
|
+
[0, 2],
|
|
349
|
+
[0, 2],
|
|
350
|
+
[0, 2],
|
|
351
|
+
[],
|
|
352
|
+
[2, 2],
|
|
353
|
+
[2, 2],
|
|
354
|
+
[0, 2, 0, 3, 0, 4, 0, 5],
|
|
355
|
+
[0, 2],
|
|
356
|
+
[0, 2],
|
|
357
|
+
[0, 2],
|
|
358
|
+
[0, 2, 0, 3, 0, 4],
|
|
359
|
+
[0, 2, 0, 3, 0, 4],
|
|
360
|
+
[0, 2, 0, 3],
|
|
361
|
+
[2, 2],
|
|
362
|
+
[0, 2, 0, 3, 0, 4, 0, 5],
|
|
363
|
+
[0, 2, 0, 3],
|
|
364
|
+
[0, 2, 0, 3, 0, 4, 0, 5],
|
|
365
|
+
[0, 2, 0, 3, 0, 4],
|
|
366
|
+
[0, 2, 0, 3, 0, 4],
|
|
367
|
+
[2, 2, 0, 3],
|
|
368
|
+
[0, 2, 0, 3, 0, 4],
|
|
369
|
+
[0, 2, 0, 3, 2, 4, 0, 5],
|
|
370
|
+
[2, 2],
|
|
371
|
+
[0, 2, 0, 3],
|
|
372
|
+
[0, 2, 0, 3],
|
|
373
|
+
[0, 2, 0, 3],
|
|
374
|
+
[2, 2],
|
|
375
|
+
[0, 2, 0, 3],
|
|
376
|
+
[0, 2, 0, 3],
|
|
377
|
+
[2, 2],
|
|
378
|
+
[0, 2, 0, 3],
|
|
379
|
+
[2, 2, 0, 3],
|
|
380
|
+
[0, 2],
|
|
381
|
+
[0, 2, 0, 3],
|
|
382
|
+
[0, 2, 0, 3],
|
|
383
|
+
[0, 2, 0, 3],
|
|
384
|
+
[0, 2],
|
|
385
|
+
[0, 2, 0, 3],
|
|
386
|
+
[0, 2],
|
|
387
|
+
[0, 2],
|
|
388
|
+
[0, 2, 0, 3],
|
|
389
|
+
[0, 2],
|
|
390
|
+
[0, 2, 2, 3, 0, 4],
|
|
391
|
+
[0, 2, 2, 3, 0, 4],
|
|
392
|
+
[0, 2],
|
|
393
|
+
[0, 2, 2, 3, 0, 4],
|
|
394
|
+
[],
|
|
395
|
+
[],
|
|
396
|
+
[],
|
|
397
|
+
[0, 2, 0, 3],
|
|
398
|
+
[0, 2, 0, 3],
|
|
399
|
+
[0, 2, 0, 3],
|
|
400
|
+
[0, 2],
|
|
401
|
+
[0, 2],
|
|
402
|
+
[],
|
|
403
|
+
[],
|
|
404
|
+
[0, 2],
|
|
405
|
+
];
|
|
406
|
+
const TAG_TYPES = [
|
|
407
|
+
"SequenceExpression",
|
|
408
|
+
"ParenthesizedExpression",
|
|
409
|
+
"ArrowFunctionExpression",
|
|
410
|
+
0,
|
|
411
|
+
"BlockStatement",
|
|
412
|
+
"BlockStatement",
|
|
413
|
+
null,
|
|
414
|
+
"BinaryExpression",
|
|
415
|
+
"LogicalExpression",
|
|
416
|
+
"ConditionalExpression",
|
|
417
|
+
"UnaryExpression",
|
|
418
|
+
"UpdateExpression",
|
|
419
|
+
"AssignmentExpression",
|
|
420
|
+
"ArrayExpression",
|
|
421
|
+
"ObjectExpression",
|
|
422
|
+
"SpreadElement",
|
|
423
|
+
"Property",
|
|
424
|
+
"MemberExpression",
|
|
425
|
+
"CallExpression",
|
|
426
|
+
"ChainExpression",
|
|
427
|
+
"TaggedTemplateExpression",
|
|
428
|
+
"NewExpression",
|
|
429
|
+
"AwaitExpression",
|
|
430
|
+
"YieldExpression",
|
|
431
|
+
"MetaProperty",
|
|
432
|
+
"Decorator",
|
|
433
|
+
0,
|
|
434
|
+
"ClassBody",
|
|
435
|
+
0,
|
|
436
|
+
0,
|
|
437
|
+
"StaticBlock",
|
|
438
|
+
"Super",
|
|
439
|
+
"Literal",
|
|
440
|
+
"Literal",
|
|
441
|
+
"Literal",
|
|
442
|
+
"Literal",
|
|
443
|
+
"Literal",
|
|
444
|
+
"ThisExpression",
|
|
445
|
+
"Literal",
|
|
446
|
+
"TemplateLiteral",
|
|
447
|
+
"TemplateElement",
|
|
448
|
+
"Identifier",
|
|
449
|
+
"PrivateIdentifier",
|
|
450
|
+
"Identifier",
|
|
451
|
+
"Identifier",
|
|
452
|
+
"Identifier",
|
|
453
|
+
"ExpressionStatement",
|
|
454
|
+
"IfStatement",
|
|
455
|
+
"SwitchStatement",
|
|
456
|
+
"SwitchCase",
|
|
457
|
+
"ForStatement",
|
|
458
|
+
"ForInStatement",
|
|
459
|
+
"ForOfStatement",
|
|
460
|
+
"WhileStatement",
|
|
461
|
+
"DoWhileStatement",
|
|
462
|
+
"BreakStatement",
|
|
463
|
+
"ContinueStatement",
|
|
464
|
+
"LabeledStatement",
|
|
465
|
+
"WithStatement",
|
|
466
|
+
"ReturnStatement",
|
|
467
|
+
"ThrowStatement",
|
|
468
|
+
"TryStatement",
|
|
469
|
+
"CatchClause",
|
|
470
|
+
"DebuggerStatement",
|
|
471
|
+
"EmptyStatement",
|
|
472
|
+
"VariableDeclaration",
|
|
473
|
+
"VariableDeclarator",
|
|
474
|
+
"ExpressionStatement",
|
|
475
|
+
"AssignmentPattern",
|
|
476
|
+
"RestElement",
|
|
477
|
+
"ArrayPattern",
|
|
478
|
+
"ObjectPattern",
|
|
479
|
+
"Property",
|
|
480
|
+
"Program",
|
|
481
|
+
"ImportExpression",
|
|
482
|
+
"ImportDeclaration",
|
|
483
|
+
"ImportSpecifier",
|
|
484
|
+
"ImportDefaultSpecifier",
|
|
485
|
+
"ImportNamespaceSpecifier",
|
|
486
|
+
"ImportAttribute",
|
|
487
|
+
"ExportNamedDeclaration",
|
|
488
|
+
"ExportDefaultDeclaration",
|
|
489
|
+
"ExportAllDeclaration",
|
|
490
|
+
"ExportSpecifier",
|
|
491
|
+
"TSTypeAnnotation",
|
|
492
|
+
"TSAnyKeyword",
|
|
493
|
+
"TSUnknownKeyword",
|
|
494
|
+
"TSNeverKeyword",
|
|
495
|
+
"TSVoidKeyword",
|
|
496
|
+
"TSNullKeyword",
|
|
497
|
+
"TSUndefinedKeyword",
|
|
498
|
+
"TSStringKeyword",
|
|
499
|
+
"TSNumberKeyword",
|
|
500
|
+
"TSBigIntKeyword",
|
|
501
|
+
"TSBooleanKeyword",
|
|
502
|
+
"TSSymbolKeyword",
|
|
503
|
+
"TSObjectKeyword",
|
|
504
|
+
"TSIntrinsicKeyword",
|
|
505
|
+
"TSThisType",
|
|
506
|
+
"TSTypeReference",
|
|
507
|
+
"TSQualifiedName",
|
|
508
|
+
"TSTypeQuery",
|
|
509
|
+
"TSImportType",
|
|
510
|
+
"TSTypeParameter",
|
|
511
|
+
"TSTypeParameterDeclaration",
|
|
512
|
+
"TSTypeParameterInstantiation",
|
|
513
|
+
"TSLiteralType",
|
|
514
|
+
"TSTemplateLiteralType",
|
|
515
|
+
"TSArrayType",
|
|
516
|
+
"TSIndexedAccessType",
|
|
517
|
+
"TSTupleType",
|
|
518
|
+
"TSNamedTupleMember",
|
|
519
|
+
"TSOptionalType",
|
|
520
|
+
"TSRestType",
|
|
521
|
+
"TSJSDocNullableType",
|
|
522
|
+
"TSJSDocNonNullableType",
|
|
523
|
+
"TSJSDocUnknownType",
|
|
524
|
+
"TSUnionType",
|
|
525
|
+
"TSIntersectionType",
|
|
526
|
+
"TSConditionalType",
|
|
527
|
+
"TSInferType",
|
|
528
|
+
"TSTypeOperator",
|
|
529
|
+
"TSParenthesizedType",
|
|
530
|
+
"TSFunctionType",
|
|
531
|
+
"TSConstructorType",
|
|
532
|
+
"TSTypePredicate",
|
|
533
|
+
"TSTypeLiteral",
|
|
534
|
+
"TSMappedType",
|
|
535
|
+
"TSPropertySignature",
|
|
536
|
+
"TSMethodSignature",
|
|
537
|
+
"TSCallSignatureDeclaration",
|
|
538
|
+
"TSConstructSignatureDeclaration",
|
|
539
|
+
"TSIndexSignature",
|
|
540
|
+
"TSTypeAliasDeclaration",
|
|
541
|
+
"TSInterfaceDeclaration",
|
|
542
|
+
"TSInterfaceBody",
|
|
543
|
+
"TSInterfaceHeritage",
|
|
544
|
+
"TSClassImplements",
|
|
545
|
+
"TSEnumDeclaration",
|
|
546
|
+
"TSEnumBody",
|
|
547
|
+
"TSEnumMember",
|
|
548
|
+
"TSModuleDeclaration",
|
|
549
|
+
"TSModuleBlock",
|
|
550
|
+
"TSModuleDeclaration",
|
|
551
|
+
"TSParameterProperty",
|
|
552
|
+
"Identifier",
|
|
553
|
+
"TSAsExpression",
|
|
554
|
+
"TSSatisfiesExpression",
|
|
555
|
+
"TSTypeAssertion",
|
|
556
|
+
"TSNonNullExpression",
|
|
557
|
+
"TSInstantiationExpression",
|
|
558
|
+
"TSExportAssignment",
|
|
559
|
+
"TSNamespaceExportDeclaration",
|
|
560
|
+
"TSImportEqualsDeclaration",
|
|
561
|
+
"TSExternalModuleReference",
|
|
562
|
+
"JSXElement",
|
|
563
|
+
"JSXOpeningElement",
|
|
564
|
+
"JSXClosingElement",
|
|
565
|
+
"JSXFragment",
|
|
566
|
+
"JSXOpeningFragment",
|
|
567
|
+
"JSXClosingFragment",
|
|
568
|
+
"JSXIdentifier",
|
|
569
|
+
"JSXNamespacedName",
|
|
570
|
+
"JSXMemberExpression",
|
|
571
|
+
"JSXAttribute",
|
|
572
|
+
"JSXSpreadAttribute",
|
|
573
|
+
"JSXExpressionContainer",
|
|
574
|
+
"JSXEmptyExpression",
|
|
575
|
+
"JSXText",
|
|
576
|
+
"JSXSpreadChild",
|
|
577
|
+
];
|
|
578
|
+
const TAG_CHOICES = new Map([
|
|
579
|
+
[3, ["FunctionDeclaration", "FunctionExpression", "TSDeclareFunction", "TSEmptyBodyFunctionExpression"]],
|
|
580
|
+
[26, ["ClassDeclaration", "ClassExpression"]],
|
|
581
|
+
[28, ["MethodDefinition", "TSAbstractMethodDefinition"]],
|
|
582
|
+
[29, ["PropertyDefinition", "AccessorProperty", "TSAbstractPropertyDefinition", "TSAbstractAccessorProperty"]],
|
|
583
|
+
]);
|
|
584
|
+
function buildPosMap(src, byteLen, startByte) {
|
|
585
|
+
const m = new Uint32Array(byteLen - startByte + 1);
|
|
586
|
+
const len = src.length;
|
|
587
|
+
let bp = 0, u16p = startByte, i = startByte;
|
|
588
|
+
while (i < len) {
|
|
589
|
+
if (i + 16 <= len) {
|
|
590
|
+
let allAscii = true;
|
|
591
|
+
for (let k = 0; k < 16; k++) {
|
|
592
|
+
if (src.charCodeAt(i + k) >= 0x80) { allAscii = false; break; }
|
|
593
|
+
}
|
|
594
|
+
if (allAscii) {
|
|
595
|
+
for (let k = 0; k < 16; k++) m[bp + k] = u16p + k;
|
|
596
|
+
bp += 16; u16p += 16; i += 16;
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
const cu = src.charCodeAt(i);
|
|
601
|
+
m[bp] = u16p;
|
|
602
|
+
if (cu < 0x80) { bp++; u16p++; i++; }
|
|
603
|
+
else if (cu < 0x800) { m[bp + 1] = u16p + 1; bp += 2; u16p++; i++; }
|
|
604
|
+
else if (cu < 0xD800 || cu >= 0xE000) {
|
|
605
|
+
m[bp + 1] = u16p + 1; m[bp + 2] = u16p + 1;
|
|
606
|
+
bp += 3; u16p++; i++;
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
m[bp + 1] = u16p + 1; m[bp + 2] = u16p + 2; m[bp + 3] = u16p + 2;
|
|
610
|
+
bp += 4; u16p += 2; i += 2;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
m[byteLen - startByte] = u16p;
|
|
614
|
+
return m;
|
|
615
|
+
}
|
|
616
|
+
function decode(buffer, source) {
|
|
617
|
+
const _u8 = new Uint8Array(buffer);
|
|
618
|
+
const aLen = (buffer.byteLength >> 2) << 2;
|
|
619
|
+
const _u32 = new Int32Array(buffer, 0, aLen >> 2);
|
|
620
|
+
const _src = source;
|
|
621
|
+
const _srcLen = _u32[3];
|
|
622
|
+
const nodeCount = _u32[0],
|
|
623
|
+
extraCount = _u32[1],
|
|
624
|
+
spLen = _u32[2];
|
|
625
|
+
const commentCount = _u32[4],
|
|
626
|
+
lineStartsCount = _u32[6],
|
|
627
|
+
diagCount = _u32[7],
|
|
628
|
+
progIdx = _u32[8];
|
|
629
|
+
const attachedCommentCount = _u32[5];
|
|
630
|
+
const _flags = _u32[9];
|
|
631
|
+
const _isTs = !!(_flags & 1);
|
|
632
|
+
const _attached = !!(_flags & 2);
|
|
633
|
+
const _firstNa = _u32[10];
|
|
634
|
+
const _nodesOff = 44;
|
|
635
|
+
const eOff = _nodesOff + nodeCount * 48;
|
|
636
|
+
const _extraBase = eOff >> 2;
|
|
637
|
+
const _spOff = eOff + extraCount * 4;
|
|
638
|
+
const dv = new DataView(buffer);
|
|
639
|
+
const _aoOff = _spOff + spLen;
|
|
640
|
+
const _acOff = _attached ? _aoOff + (nodeCount + 1) * 4 : _aoOff;
|
|
641
|
+
const _cOff = _acOff + attachedCommentCount * 12;
|
|
642
|
+
function _poolDecode(s, e) {
|
|
643
|
+
const a = _spOff + s - _srcLen, b = _spOff + e - _srcLen;
|
|
644
|
+
let hasEd = false;
|
|
645
|
+
for (let i = a; i < b; i++) if (_u8[i] === 0xED) { hasEd = true; break; }
|
|
646
|
+
if (!hasEd) return _td.decode(_u8.subarray(a, b));
|
|
647
|
+
let r = "";
|
|
648
|
+
for (let i = a; i < b; ) {
|
|
649
|
+
const c = _u8[i];
|
|
650
|
+
if (c < 0x80) { r += String.fromCharCode(c); i++; }
|
|
651
|
+
else if (c < 0xE0) {
|
|
652
|
+
r += String.fromCharCode(((c & 0x1F) << 6) | (_u8[i+1] & 0x3F));
|
|
653
|
+
i += 2;
|
|
654
|
+
}
|
|
655
|
+
else if (c < 0xF0) {
|
|
656
|
+
r += String.fromCharCode(
|
|
657
|
+
((c & 0x0F) << 12) | ((_u8[i+1] & 0x3F) << 6) | (_u8[i+2] & 0x3F)
|
|
658
|
+
);
|
|
659
|
+
i += 3;
|
|
660
|
+
}
|
|
661
|
+
else {
|
|
662
|
+
r += String.fromCodePoint(
|
|
663
|
+
((c & 0x07) << 18) | ((_u8[i+1] & 0x3F) << 12) |
|
|
664
|
+
((_u8[i+2] & 0x3F) << 6) | (_u8[i+3] & 0x3F)
|
|
665
|
+
);
|
|
666
|
+
i += 4;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
return r;
|
|
670
|
+
}
|
|
671
|
+
const pm = _firstNa < _srcLen ? buildPosMap(_src, _srcLen, _firstNa) : null;
|
|
672
|
+
const _p = v => v <= _firstNa ? v : pm[v - _firstNa];
|
|
673
|
+
const str = (s, e) => {
|
|
674
|
+
if (s === e) return "";
|
|
675
|
+
if (s >= _srcLen) return _poolDecode(s, e);
|
|
676
|
+
if (e <= _firstNa) return _src.slice(s, e);
|
|
677
|
+
const ss = s < _firstNa ? s : pm[s - _firstNa];
|
|
678
|
+
return _src.slice(ss, pm[e - _firstNa]);
|
|
679
|
+
};
|
|
680
|
+
function nodeArr(s, len) {
|
|
681
|
+
const r = Array.from({ length: len });
|
|
682
|
+
for (let j = 0; j < len; j++) r[j] = node(_u32[_extraBase + s + j]);
|
|
683
|
+
return r;
|
|
684
|
+
}
|
|
685
|
+
function nodeArrHoles(s, len) {
|
|
686
|
+
const r = Array.from({ length: len });
|
|
687
|
+
for (let j = 0; j < len; j++) {
|
|
688
|
+
const x = _u32[_extraBase + s + j];
|
|
689
|
+
r[j] = x !== NULL ? node(x) : null;
|
|
690
|
+
}
|
|
691
|
+
return r;
|
|
692
|
+
}
|
|
693
|
+
function fnParams(idx) {
|
|
694
|
+
const po = _nodesOff + idx * 48;
|
|
695
|
+
const len = _u8[po + 4] | (_u8[po + 5] << 8);
|
|
696
|
+
const pb = po >> 2;
|
|
697
|
+
const iStart = _u32[pb + 2], rest = _u32[pb + 3];
|
|
698
|
+
const p = [];
|
|
699
|
+
for (let j = 0; j < len; j++) p.push(node(_u32[_extraBase + iStart + j]));
|
|
700
|
+
if (rest !== NULL) p.push(node(rest));
|
|
701
|
+
return p;
|
|
702
|
+
}
|
|
703
|
+
function _attachedCommentsOf(a, e) {
|
|
704
|
+
const out = Array.from({ length: e - a });
|
|
705
|
+
for (let j = a; j < e; j++) {
|
|
706
|
+
const o = _acOff + j * 12;
|
|
707
|
+
const cf = _u8[o + 0];
|
|
708
|
+
const vs = dv.getUint32(o + 4, true),
|
|
709
|
+
ve = dv.getUint32(o + 8, true);
|
|
710
|
+
out[j - a] = {
|
|
711
|
+
type: (cf & 1) ? "Block" : "Line",
|
|
712
|
+
position: ["before", "after", "inside"][(cf >> 1) & 3],
|
|
713
|
+
sameLine: (cf & 8) !== 0,
|
|
714
|
+
value: str(vs, ve),
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
return out;
|
|
718
|
+
}
|
|
719
|
+
function nodeWithComments(i) {
|
|
720
|
+
const r = _decode(i);
|
|
721
|
+
if (r && r.type !== undefined && r.comments === undefined) {
|
|
722
|
+
const off = _aoOff + i * 4;
|
|
723
|
+
const a = dv.getUint32(off, true), e = dv.getUint32(off + 4, true);
|
|
724
|
+
if (a !== e) r.comments = _attachedCommentsOf(a, e);
|
|
725
|
+
}
|
|
726
|
+
return r;
|
|
727
|
+
}
|
|
728
|
+
function _decode(i) {
|
|
729
|
+
const o = _nodesOff + i * 48;
|
|
730
|
+
const tag = _u8[o];
|
|
731
|
+
const flags = _u8[o + 2] | (_u8[o + 3] << 8);
|
|
732
|
+
const f0 = _u8[o + 4] | (_u8[o + 5] << 8);
|
|
733
|
+
const b = o >> 2;
|
|
734
|
+
const f1 = _u32[b + 2], f2 = _u32[b + 3],
|
|
735
|
+
f3 = _u32[b + 4], f4 = _u32[b + 5],
|
|
736
|
+
f5 = _u32[b + 6], f6 = _u32[b + 7],
|
|
737
|
+
f7 = _u32[b + 8], f8 = _u32[b + 9];
|
|
738
|
+
const _ss = _u32[b + 10], _se = _u32[b + 11];
|
|
739
|
+
const start = _ss <= _firstNa ? _ss : pm[_ss - _firstNa];
|
|
740
|
+
const end = _se <= _firstNa ? _se : pm[_se - _firstNa];
|
|
741
|
+
switch (tag) {
|
|
742
|
+
case 0: return { type: "SequenceExpression", start, end, expressions: nodeArr(f1, f0) };
|
|
743
|
+
case 1: return { type: "ParenthesizedExpression", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
744
|
+
case 2: {
|
|
745
|
+
const r = {
|
|
746
|
+
type: "ArrowFunctionExpression", start, end,
|
|
747
|
+
id: null, generator: false, async: !!(flags & 2),
|
|
748
|
+
params: f1 !== NULL ? fnParams(f1) : [],
|
|
749
|
+
body: node(f2), expression: !!(flags & 1),
|
|
750
|
+
};
|
|
751
|
+
if (_isTs) {
|
|
752
|
+
r.typeParameters = f3 !== NULL ? node(f3) : null;
|
|
753
|
+
r.returnType = f4 !== NULL ? node(f4) : null;
|
|
754
|
+
}
|
|
755
|
+
return r;
|
|
756
|
+
}
|
|
757
|
+
case 3: {
|
|
758
|
+
const ft = flags & 3;
|
|
759
|
+
const r = {
|
|
760
|
+
type: FUNCTION_TYPES[ft], start, end,
|
|
761
|
+
id: f1 !== NULL ? node(f1) : null,
|
|
762
|
+
generator: !!(flags & 4), async: !!(flags & 8),
|
|
763
|
+
params: f2 !== NULL ? fnParams(f2) : [],
|
|
764
|
+
body: f3 !== NULL ? node(f3) : null,
|
|
765
|
+
expression: false,
|
|
766
|
+
};
|
|
767
|
+
if (_isTs) {
|
|
768
|
+
r.typeParameters = f4 !== NULL ? node(f4) : null;
|
|
769
|
+
r.returnType = f5 !== NULL ? node(f5) : null;
|
|
770
|
+
r.declare = !!(flags & 16);
|
|
771
|
+
}
|
|
772
|
+
return r;
|
|
773
|
+
}
|
|
774
|
+
case 4: return { type: "BlockStatement", start, end, body: nodeArr(f1, f0) };
|
|
775
|
+
case 5: return { type: "BlockStatement", start, end, body: nodeArr(f1, f0) };
|
|
776
|
+
case 6: return { params: fnParams(i) };
|
|
777
|
+
case 7: return { type: "BinaryExpression", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, operator: BINARY_OPS[flags & 31] };
|
|
778
|
+
case 8: return { type: "LogicalExpression", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, operator: LOGICAL_OPS[flags & 3] };
|
|
779
|
+
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 };
|
|
780
|
+
case 10: return {
|
|
781
|
+
type: "UnaryExpression", start, end,
|
|
782
|
+
operator: UNARY_OPS[flags & 7], prefix: true,
|
|
783
|
+
argument: f1 !== NULL ? node(f1) : null,
|
|
784
|
+
};
|
|
785
|
+
case 11: return { type: "UpdateExpression", start, end, argument: f1 !== NULL ? node(f1) : null, operator: UPDATE_OPS[flags & 1], prefix: !!(flags & 2) };
|
|
786
|
+
case 12: return { type: "AssignmentExpression", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null, operator: ASSIGNMENT_OPS[flags & 15] };
|
|
787
|
+
case 13: return { type: "ArrayExpression", start, end, elements: nodeArrHoles(f1, f0) };
|
|
788
|
+
case 14: return { type: "ObjectExpression", start, end, properties: nodeArr(f1, f0) };
|
|
789
|
+
case 15: return { type: "SpreadElement", start, end, argument: f1 !== NULL ? node(f1) : null };
|
|
790
|
+
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; }
|
|
791
|
+
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) };
|
|
792
|
+
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; }
|
|
793
|
+
case 19: return { type: "ChainExpression", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
794
|
+
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; }
|
|
795
|
+
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; }
|
|
796
|
+
case 22: return { type: "AwaitExpression", start, end, argument: f1 !== NULL ? node(f1) : null };
|
|
797
|
+
case 23: return { type: "YieldExpression", start, end, argument: f1 !== NULL ? node(f1) : null, delegate: !!(flags & 1) };
|
|
798
|
+
case 24: return { type: "MetaProperty", start, end, meta: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null };
|
|
799
|
+
case 25: return { type: "Decorator", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
800
|
+
case 26: {
|
|
801
|
+
const r = {
|
|
802
|
+
type: CLASS_TYPES[flags & 1], start, end,
|
|
803
|
+
decorators: nodeArr(f1, f0),
|
|
804
|
+
id: f2 !== NULL ? node(f2) : null,
|
|
805
|
+
superClass: f3 !== NULL ? node(f3) : null,
|
|
806
|
+
body: node(f4),
|
|
807
|
+
};
|
|
808
|
+
if (_isTs) {
|
|
809
|
+
r.typeParameters = f5 !== NULL ? node(f5) : null;
|
|
810
|
+
r.superTypeArguments = f6 !== NULL ? node(f6) : null;
|
|
811
|
+
r.implements = nodeArr(f7, f8);
|
|
812
|
+
r.abstract = !!(flags & 2);
|
|
813
|
+
r.declare = !!(flags & 4);
|
|
814
|
+
}
|
|
815
|
+
return r;
|
|
816
|
+
}
|
|
817
|
+
case 27: return { type: "ClassBody", start, end, body: nodeArr(f1, f0) };
|
|
818
|
+
case 28: {
|
|
819
|
+
const r = {
|
|
820
|
+
type: "MethodDefinition", start, end,
|
|
821
|
+
decorators: nodeArr(f1, f0),
|
|
822
|
+
key: node(f2), value: node(f3),
|
|
823
|
+
kind: METHOD_KINDS[flags & 3],
|
|
824
|
+
computed: !!(flags & 4), static: !!(flags & 8),
|
|
825
|
+
};
|
|
826
|
+
if (_isTs) {
|
|
827
|
+
r.override = !!(flags & 16);
|
|
828
|
+
r.optional = !!(flags & 32);
|
|
829
|
+
const _abs = !!(flags & 64);
|
|
830
|
+
r.accessibility = ACCESSIBILITY[(flags >> 7) & 3];
|
|
831
|
+
if (_abs) r.type = "TSAbstractMethodDefinition";
|
|
832
|
+
}
|
|
833
|
+
return r;
|
|
834
|
+
}
|
|
835
|
+
case 29: {
|
|
836
|
+
const _acc = !!(flags & 4);
|
|
837
|
+
const r = {
|
|
838
|
+
type: _acc ? "AccessorProperty" : "PropertyDefinition",
|
|
839
|
+
start, end,
|
|
840
|
+
decorators: nodeArr(f1, f0),
|
|
841
|
+
key: node(f2),
|
|
842
|
+
value: f3 !== NULL ? node(f3) : null,
|
|
843
|
+
computed: !!(flags & 1), static: !!(flags & 2),
|
|
844
|
+
};
|
|
845
|
+
if (_isTs) {
|
|
846
|
+
r.typeAnnotation = f4 !== NULL ? node(f4) : null;
|
|
847
|
+
r.declare = !!(flags & 8);
|
|
848
|
+
r.override = !!(flags & 16);
|
|
849
|
+
r.optional = !!(flags & 32);
|
|
850
|
+
r.definite = !!(flags & 64);
|
|
851
|
+
r.readonly = !!(flags & 128);
|
|
852
|
+
const _abs = !!(flags & 256);
|
|
853
|
+
r.accessibility = ACCESSIBILITY[(flags >> 9) & 3];
|
|
854
|
+
if (_abs)
|
|
855
|
+
r.type = _acc
|
|
856
|
+
? "TSAbstractAccessorProperty"
|
|
857
|
+
: "TSAbstractPropertyDefinition";
|
|
858
|
+
}
|
|
859
|
+
return r;
|
|
860
|
+
}
|
|
861
|
+
case 30: return { type: "StaticBlock", start, end, body: nodeArr(f1, f0) };
|
|
862
|
+
case 31: return { type: "Super", start, end };
|
|
863
|
+
case 32: return {
|
|
864
|
+
type: "Literal", start, end,
|
|
865
|
+
value: str(f1, f2), raw: _src.slice(start, end),
|
|
866
|
+
};
|
|
867
|
+
case 33: {
|
|
868
|
+
const r = _src.slice(start, end);
|
|
869
|
+
const s = r.indexOf("_") === -1 ? r : r.replace(/_/g, "");
|
|
870
|
+
const v = (flags & 3) === 2 && s[1] !== "o" && s[1] !== "O"
|
|
871
|
+
? parseInt(s.slice(1), 8)
|
|
872
|
+
: +s;
|
|
873
|
+
return {
|
|
874
|
+
type: "Literal", start, end,
|
|
875
|
+
value: v === v && isFinite(v) ? v : null,
|
|
876
|
+
raw: r,
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
case 34: {
|
|
880
|
+
const r = _src.slice(start, end);
|
|
881
|
+
const d = str(f1, f2).replace(/_/g, "");
|
|
882
|
+
const v = BigInt(d);
|
|
883
|
+
return {
|
|
884
|
+
type: "Literal", start, end,
|
|
885
|
+
value: v, raw: r, bigint: v.toString(),
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
case 35: {
|
|
889
|
+
const v = !!(flags & 1);
|
|
890
|
+
return {
|
|
891
|
+
type: "Literal", start, end,
|
|
892
|
+
value: v, raw: v ? "true" : "false",
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
case 36: return { type: "Literal", start, end, value: null, raw: "null" };
|
|
896
|
+
case 37: return { type: "ThisExpression", start, end };
|
|
897
|
+
case 38: {
|
|
898
|
+
const p = str(f1, f2), fl = str(f3, f4);
|
|
899
|
+
let v = null;
|
|
900
|
+
try { v = new RegExp(p, fl); } catch {}
|
|
901
|
+
return {
|
|
902
|
+
type: "Literal", start, end,
|
|
903
|
+
value: v, raw: "/" + p + "/" + fl,
|
|
904
|
+
regex: { pattern: p, flags: fl.split("").sort().join("") },
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
case 39: return { type: "TemplateLiteral", start, end, quasis: nodeArr(f1, f0), expressions: nodeArr(f2, f3) };
|
|
908
|
+
case 40: {
|
|
909
|
+
const raw = _src.slice(start, end).replace(/\r\n?/g, "\n");
|
|
910
|
+
const tl = !!(flags & 1);
|
|
911
|
+
const s = _isTs ? start - 1 : start;
|
|
912
|
+
const e = _isTs ? (tl ? end + 1 : end + 2) : end;
|
|
913
|
+
return {
|
|
914
|
+
type: "TemplateElement", start: s, end: e,
|
|
915
|
+
value: {
|
|
916
|
+
raw,
|
|
917
|
+
cooked: (flags & 2) ? null : str(f1, f2),
|
|
918
|
+
},
|
|
919
|
+
tail: tl,
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
case 41: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = []; r.optional = false; r.typeAnnotation = null; } return r; }
|
|
923
|
+
case 42: return { type: "PrivateIdentifier", start, end, name: str(f1, f2) };
|
|
924
|
+
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; }
|
|
925
|
+
case 44: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = []; r.optional = false; r.typeAnnotation = null; } return r; }
|
|
926
|
+
case 45: { const r = { type: "Identifier", start, end, name: str(f1, f2) }; if (_isTs) { r.decorators = []; r.optional = false; r.typeAnnotation = null; } return r; }
|
|
927
|
+
case 46: { const r = { type: "ExpressionStatement", start, end, expression: f1 !== NULL ? node(f1) : null }; if (_isTs) { r.directive = null; } return r; }
|
|
928
|
+
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 };
|
|
929
|
+
case 48: return { type: "SwitchStatement", start, end, discriminant: f1 !== NULL ? node(f1) : null, cases: nodeArr(f2, f0) };
|
|
930
|
+
case 49: return { type: "SwitchCase", start, end, test: f1 !== NULL ? node(f1) : null, consequent: nodeArr(f2, f0) };
|
|
931
|
+
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 };
|
|
932
|
+
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 };
|
|
933
|
+
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) };
|
|
934
|
+
case 53: return { type: "WhileStatement", start, end, test: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
|
|
935
|
+
case 54: return { type: "DoWhileStatement", start, end, body: f1 !== NULL ? node(f1) : null, test: f2 !== NULL ? node(f2) : null };
|
|
936
|
+
case 55: return { type: "BreakStatement", start, end, label: f1 !== NULL ? node(f1) : null };
|
|
937
|
+
case 56: return { type: "ContinueStatement", start, end, label: f1 !== NULL ? node(f1) : null };
|
|
938
|
+
case 57: return { type: "LabeledStatement", start, end, label: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
|
|
939
|
+
case 58: return { type: "WithStatement", start, end, object: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
|
|
940
|
+
case 59: return { type: "ReturnStatement", start, end, argument: f1 !== NULL ? node(f1) : null };
|
|
941
|
+
case 60: return { type: "ThrowStatement", start, end, argument: f1 !== NULL ? node(f1) : null };
|
|
942
|
+
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 };
|
|
943
|
+
case 62: return { type: "CatchClause", start, end, param: f1 !== NULL ? node(f1) : null, body: f2 !== NULL ? node(f2) : null };
|
|
944
|
+
case 63: return { type: "DebuggerStatement", start, end };
|
|
945
|
+
case 64: return { type: "EmptyStatement", start, end };
|
|
946
|
+
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; }
|
|
947
|
+
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; }
|
|
948
|
+
case 67: return {
|
|
949
|
+
type: "ExpressionStatement", start, end,
|
|
950
|
+
expression: node(f1), directive: str(f2, f3),
|
|
951
|
+
};
|
|
952
|
+
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; }
|
|
953
|
+
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; }
|
|
954
|
+
case 70: {
|
|
955
|
+
const el = nodeArrHoles(f1, f0);
|
|
956
|
+
if (f2 !== NULL) el.push(node(f2));
|
|
957
|
+
const r = { type: "ArrayPattern", start, end, elements: el };
|
|
958
|
+
if (_isTs) {
|
|
959
|
+
r.decorators = nodeArr(f3, f4);
|
|
960
|
+
r.optional = !!(flags & 1);
|
|
961
|
+
r.typeAnnotation = f5 !== NULL ? node(f5) : null;
|
|
962
|
+
}
|
|
963
|
+
return r;
|
|
964
|
+
}
|
|
965
|
+
case 71: {
|
|
966
|
+
const pr = nodeArr(f1, f0);
|
|
967
|
+
if (f2 !== NULL) pr.push(node(f2));
|
|
968
|
+
const r = { type: "ObjectPattern", start, end, properties: pr };
|
|
969
|
+
if (_isTs) {
|
|
970
|
+
r.decorators = nodeArr(f3, f4);
|
|
971
|
+
r.optional = !!(flags & 1);
|
|
972
|
+
r.typeAnnotation = f5 !== NULL ? node(f5) : null;
|
|
973
|
+
}
|
|
974
|
+
return r;
|
|
975
|
+
}
|
|
976
|
+
case 72: {
|
|
977
|
+
const r = {
|
|
978
|
+
type: "Property", start, end,
|
|
979
|
+
kind: "init",
|
|
980
|
+
key: node(f1), value: node(f2),
|
|
981
|
+
method: false,
|
|
982
|
+
shorthand: !!(flags & 1),
|
|
983
|
+
computed: !!(flags & 2),
|
|
984
|
+
}; if (_isTs) { r.optional = false; } return r; }
|
|
985
|
+
case 73: return {
|
|
986
|
+
type: "Program", start, end,
|
|
987
|
+
sourceType: (flags & 1) ? "module" : "script",
|
|
988
|
+
hashbang: (flags & 2) ? {
|
|
989
|
+
type: "Hashbang",
|
|
990
|
+
start: _p(f2 - 2), end: _p(f3),
|
|
991
|
+
value: str(f2, f3),
|
|
992
|
+
} : null,
|
|
993
|
+
body: nodeArr(f1, f0),
|
|
994
|
+
};
|
|
995
|
+
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 };
|
|
996
|
+
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; }
|
|
997
|
+
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; }
|
|
998
|
+
case 77: return { type: "ImportDefaultSpecifier", start, end, local: f1 !== NULL ? node(f1) : null };
|
|
999
|
+
case 78: return { type: "ImportNamespaceSpecifier", start, end, local: f1 !== NULL ? node(f1) : null };
|
|
1000
|
+
case 79: return { type: "ImportAttribute", start, end, key: f1 !== NULL ? node(f1) : null, value: f2 !== NULL ? node(f2) : null };
|
|
1001
|
+
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; }
|
|
1002
|
+
case 81: { const r = { type: "ExportDefaultDeclaration", start, end, declaration: f1 !== NULL ? node(f1) : null }; if (_isTs) { r.exportKind = "value"; } return r; }
|
|
1003
|
+
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; }
|
|
1004
|
+
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; }
|
|
1005
|
+
case 84: return { type: "TSTypeAnnotation", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
|
|
1006
|
+
case 85: return { type: "TSAnyKeyword", start, end };
|
|
1007
|
+
case 86: return { type: "TSUnknownKeyword", start, end };
|
|
1008
|
+
case 87: return { type: "TSNeverKeyword", start, end };
|
|
1009
|
+
case 88: return { type: "TSVoidKeyword", start, end };
|
|
1010
|
+
case 89: return { type: "TSNullKeyword", start, end };
|
|
1011
|
+
case 90: return { type: "TSUndefinedKeyword", start, end };
|
|
1012
|
+
case 91: return { type: "TSStringKeyword", start, end };
|
|
1013
|
+
case 92: return { type: "TSNumberKeyword", start, end };
|
|
1014
|
+
case 93: return { type: "TSBigIntKeyword", start, end };
|
|
1015
|
+
case 94: return { type: "TSBooleanKeyword", start, end };
|
|
1016
|
+
case 95: return { type: "TSSymbolKeyword", start, end };
|
|
1017
|
+
case 96: return { type: "TSObjectKeyword", start, end };
|
|
1018
|
+
case 97: return { type: "TSIntrinsicKeyword", start, end };
|
|
1019
|
+
case 98: return { type: "TSThisType", start, end };
|
|
1020
|
+
case 99: return { type: "TSTypeReference", start, end, typeName: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
|
|
1021
|
+
case 100: return { type: "TSQualifiedName", start, end, left: f1 !== NULL ? node(f1) : null, right: f2 !== NULL ? node(f2) : null };
|
|
1022
|
+
case 101: return { type: "TSTypeQuery", start, end, exprName: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
|
|
1023
|
+
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 };
|
|
1024
|
+
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) };
|
|
1025
|
+
case 104: return { type: "TSTypeParameterDeclaration", start, end, params: nodeArr(f1, f0) };
|
|
1026
|
+
case 105: return { type: "TSTypeParameterInstantiation", start, end, params: nodeArr(f1, f0) };
|
|
1027
|
+
case 106: return { type: "TSLiteralType", start, end, literal: f1 !== NULL ? node(f1) : null };
|
|
1028
|
+
case 107: return { type: "TSTemplateLiteralType", start, end, quasis: nodeArr(f1, f0), types: nodeArr(f2, f3) };
|
|
1029
|
+
case 108: return { type: "TSArrayType", start, end, elementType: f1 !== NULL ? node(f1) : null };
|
|
1030
|
+
case 109: return { type: "TSIndexedAccessType", start, end, objectType: f1 !== NULL ? node(f1) : null, indexType: f2 !== NULL ? node(f2) : null };
|
|
1031
|
+
case 110: return { type: "TSTupleType", start, end, elementTypes: nodeArr(f1, f0) };
|
|
1032
|
+
case 111: return { type: "TSNamedTupleMember", start, end, label: f1 !== NULL ? node(f1) : null, elementType: f2 !== NULL ? node(f2) : null, optional: !!(flags & 1) };
|
|
1033
|
+
case 112: return { type: "TSOptionalType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
|
|
1034
|
+
case 113: return { type: "TSRestType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
|
|
1035
|
+
case 114: return { type: "TSJSDocNullableType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null, postfix: !!(flags & 1) };
|
|
1036
|
+
case 115: return { type: "TSJSDocNonNullableType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null, postfix: !!(flags & 1) };
|
|
1037
|
+
case 116: return { type: "TSJSDocUnknownType", start, end };
|
|
1038
|
+
case 117: return { type: "TSUnionType", start, end, types: nodeArr(f1, f0) };
|
|
1039
|
+
case 118: return { type: "TSIntersectionType", start, end, types: nodeArr(f1, f0) };
|
|
1040
|
+
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 };
|
|
1041
|
+
case 120: return { type: "TSInferType", start, end, typeParameter: f1 !== NULL ? node(f1) : null };
|
|
1042
|
+
case 121: return { type: "TSTypeOperator", start, end, operator: TS_TYPE_OPERATORS[flags & 3], typeAnnotation: f1 !== NULL ? node(f1) : null };
|
|
1043
|
+
case 122: return { type: "TSParenthesizedType", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null };
|
|
1044
|
+
case 123: return {
|
|
1045
|
+
type: "TSFunctionType", start, end,
|
|
1046
|
+
typeParameters: f1 !== NULL ? node(f1) : null,
|
|
1047
|
+
params: f2 !== NULL ? fnParams(f2) : [],
|
|
1048
|
+
returnType: f3 !== NULL ? node(f3) : null,
|
|
1049
|
+
};
|
|
1050
|
+
case 124: return {
|
|
1051
|
+
type: "TSConstructorType", start, end,
|
|
1052
|
+
abstract: !!(flags & 1),
|
|
1053
|
+
typeParameters: f1 !== NULL ? node(f1) : null,
|
|
1054
|
+
params: f2 !== NULL ? fnParams(f2) : [],
|
|
1055
|
+
returnType: f3 !== NULL ? node(f3) : null,
|
|
1056
|
+
};
|
|
1057
|
+
case 125: return { type: "TSTypePredicate", start, end, parameterName: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null, asserts: !!(flags & 1) };
|
|
1058
|
+
case 126: return { type: "TSTypeLiteral", start, end, members: nodeArr(f1, f0) };
|
|
1059
|
+
case 127: return {
|
|
1060
|
+
type: "TSMappedType", start, end,
|
|
1061
|
+
key: node(f1),
|
|
1062
|
+
constraint: node(f2),
|
|
1063
|
+
nameType: f3 !== NULL ? node(f3) : null,
|
|
1064
|
+
typeAnnotation: f4 !== NULL ? node(f4) : null,
|
|
1065
|
+
optional: TS_MAPPED_OPTIONAL[(flags >> 0) & 3],
|
|
1066
|
+
readonly: TS_MAPPED_READONLY[(flags >> 2) & 3],
|
|
1067
|
+
};
|
|
1068
|
+
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; }
|
|
1069
|
+
case 129: return {
|
|
1070
|
+
type: "TSMethodSignature", start, end,
|
|
1071
|
+
key: node(f1),
|
|
1072
|
+
computed: !!(flags & 4),
|
|
1073
|
+
optional: !!(flags & 8),
|
|
1074
|
+
kind: TS_METHOD_SIGNATURE_KINDS[(flags >> 0) & 3],
|
|
1075
|
+
typeParameters: f2 !== NULL ? node(f2) : null,
|
|
1076
|
+
params: f3 !== NULL ? fnParams(f3) : [],
|
|
1077
|
+
returnType: f4 !== NULL ? node(f4) : null,
|
|
1078
|
+
accessibility: null, readonly: false, static: false,
|
|
1079
|
+
};
|
|
1080
|
+
case 130: return {
|
|
1081
|
+
type: "TSCallSignatureDeclaration", start, end,
|
|
1082
|
+
typeParameters: f1 !== NULL ? node(f1) : null,
|
|
1083
|
+
params: f2 !== NULL ? fnParams(f2) : [],
|
|
1084
|
+
returnType: f3 !== NULL ? node(f3) : null,
|
|
1085
|
+
};
|
|
1086
|
+
case 131: return {
|
|
1087
|
+
type: "TSConstructSignatureDeclaration", start, end,
|
|
1088
|
+
typeParameters: f1 !== NULL ? node(f1) : null,
|
|
1089
|
+
params: f2 !== NULL ? fnParams(f2) : [],
|
|
1090
|
+
returnType: f3 !== NULL ? node(f3) : null,
|
|
1091
|
+
};
|
|
1092
|
+
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; }
|
|
1093
|
+
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) };
|
|
1094
|
+
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) };
|
|
1095
|
+
case 135: return { type: "TSInterfaceBody", start, end, body: nodeArr(f1, f0) };
|
|
1096
|
+
case 136: return { type: "TSInterfaceHeritage", start, end, expression: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
|
|
1097
|
+
case 137: return { type: "TSClassImplements", start, end, expression: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
|
|
1098
|
+
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) };
|
|
1099
|
+
case 139: return { type: "TSEnumBody", start, end, members: nodeArr(f1, f0) };
|
|
1100
|
+
case 140: return { type: "TSEnumMember", start, end, id: f1 !== NULL ? node(f1) : null, initializer: f2 !== NULL ? node(f2) : null, computed: !!(flags & 1) };
|
|
1101
|
+
case 141: {
|
|
1102
|
+
const r = {
|
|
1103
|
+
type: "TSModuleDeclaration", start, end,
|
|
1104
|
+
id: node(f1),
|
|
1105
|
+
kind: TS_MODULE_KINDS[(flags >> 0) & 1],
|
|
1106
|
+
declare: !!(flags & 2),
|
|
1107
|
+
global: false,
|
|
1108
|
+
};
|
|
1109
|
+
if (f2 !== NULL) r.body = node(f2);
|
|
1110
|
+
return r;
|
|
1111
|
+
}
|
|
1112
|
+
case 142: return { type: "TSModuleBlock", start, end, body: nodeArr(f1, f0) };
|
|
1113
|
+
case 143: return {
|
|
1114
|
+
type: "TSModuleDeclaration", start, end,
|
|
1115
|
+
id: node(f1), body: node(f2),
|
|
1116
|
+
kind: "global",
|
|
1117
|
+
declare: !!(flags & 1),
|
|
1118
|
+
global: true,
|
|
1119
|
+
};
|
|
1120
|
+
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; }
|
|
1121
|
+
case 145: return {
|
|
1122
|
+
type: "Identifier", start, end,
|
|
1123
|
+
decorators: [],
|
|
1124
|
+
name: "this", optional: false,
|
|
1125
|
+
typeAnnotation: f1 !== NULL ? node(f1) : null,
|
|
1126
|
+
};
|
|
1127
|
+
case 146: return { type: "TSAsExpression", start, end, expression: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null };
|
|
1128
|
+
case 147: return { type: "TSSatisfiesExpression", start, end, expression: f1 !== NULL ? node(f1) : null, typeAnnotation: f2 !== NULL ? node(f2) : null };
|
|
1129
|
+
case 148: return { type: "TSTypeAssertion", start, end, typeAnnotation: f1 !== NULL ? node(f1) : null, expression: f2 !== NULL ? node(f2) : null };
|
|
1130
|
+
case 149: return { type: "TSNonNullExpression", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
1131
|
+
case 150: return { type: "TSInstantiationExpression", start, end, expression: f1 !== NULL ? node(f1) : null, typeArguments: f2 !== NULL ? node(f2) : null };
|
|
1132
|
+
case 151: return { type: "TSExportAssignment", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
1133
|
+
case 152: return { type: "TSNamespaceExportDeclaration", start, end, id: f1 !== NULL ? node(f1) : null };
|
|
1134
|
+
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] };
|
|
1135
|
+
case 154: return { type: "TSExternalModuleReference", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
1136
|
+
case 155: return { type: "JSXElement", start, end, openingElement: f1 !== NULL ? node(f1) : null, children: nodeArr(f2, f0), closingElement: f3 !== NULL ? node(f3) : null };
|
|
1137
|
+
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; }
|
|
1138
|
+
case 157: return { type: "JSXClosingElement", start, end, name: f1 !== NULL ? node(f1) : null };
|
|
1139
|
+
case 158: return { type: "JSXFragment", start, end, openingFragment: f1 !== NULL ? node(f1) : null, children: nodeArr(f2, f0), closingFragment: f3 !== NULL ? node(f3) : null };
|
|
1140
|
+
case 159: return { type: "JSXOpeningFragment", start, end };
|
|
1141
|
+
case 160: return { type: "JSXClosingFragment", start, end };
|
|
1142
|
+
case 161: return { type: "JSXIdentifier", start, end, name: str(f1, f2) };
|
|
1143
|
+
case 162: return { type: "JSXNamespacedName", start, end, namespace: f1 !== NULL ? node(f1) : null, name: f2 !== NULL ? node(f2) : null };
|
|
1144
|
+
case 163: return { type: "JSXMemberExpression", start, end, object: f1 !== NULL ? node(f1) : null, property: f2 !== NULL ? node(f2) : null };
|
|
1145
|
+
case 164: return { type: "JSXAttribute", start, end, name: f1 !== NULL ? node(f1) : null, value: f2 !== NULL ? node(f2) : null };
|
|
1146
|
+
case 165: return { type: "JSXSpreadAttribute", start, end, argument: f1 !== NULL ? node(f1) : null };
|
|
1147
|
+
case 166: return { type: "JSXExpressionContainer", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
1148
|
+
case 167: return { type: "JSXEmptyExpression", start, end };
|
|
1149
|
+
case 168: {
|
|
1150
|
+
const t = str(f1, f2);
|
|
1151
|
+
return { type: "JSXText", start, end, value: t, raw: t };
|
|
1152
|
+
}
|
|
1153
|
+
case 169: return { type: "JSXSpreadChild", start, end, expression: f1 !== NULL ? node(f1) : null };
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
const _inner = _attached ? nodeWithComments : _decode;
|
|
1157
|
+
const _nodes = Array.from({ length: nodeCount });
|
|
1158
|
+
const _nodeIndexes = new WeakMap();
|
|
1159
|
+
function node(i) {
|
|
1160
|
+
const m = _nodes[i];
|
|
1161
|
+
if (m !== undefined) return m;
|
|
1162
|
+
const r = _inner(i);
|
|
1163
|
+
_nodes[i] = r;
|
|
1164
|
+
if (r !== null && typeof r === "object") _nodeIndexes.set(r, i);
|
|
1165
|
+
return r;
|
|
1166
|
+
}
|
|
1167
|
+
const _nodesU32 = _nodesOff >> 2;
|
|
1168
|
+
function startOf(i) { return _p(_u32[_nodesU32 + i * 12 + 10]); }
|
|
1169
|
+
function endOf(i) { return _p(_u32[_nodesU32 + i * 12 + 11]); }
|
|
1170
|
+
const lsOff = _cOff + commentCount * 20;
|
|
1171
|
+
const dOff = lsOff + lineStartsCount * 4;
|
|
1172
|
+
function _decodeComments() {
|
|
1173
|
+
const out = Array.from({ length: commentCount });
|
|
1174
|
+
for (let j = 0; j < commentCount; j++) {
|
|
1175
|
+
const o = _cOff + j * 20;
|
|
1176
|
+
const cf = _u8[o + 0];
|
|
1177
|
+
const vs = dv.getUint32(o + 4, true),
|
|
1178
|
+
ve = dv.getUint32(o + 8, true);
|
|
1179
|
+
const ss = dv.getUint32(o + 12, true),
|
|
1180
|
+
se = dv.getUint32(o + 16, true);
|
|
1181
|
+
out[j] = {
|
|
1182
|
+
type: (cf & 1) ? "Block" : "Line",
|
|
1183
|
+
value: str(vs, ve),
|
|
1184
|
+
start: _p(ss),
|
|
1185
|
+
end: _p(se),
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1188
|
+
return out;
|
|
1189
|
+
}
|
|
1190
|
+
function _decodeLineStarts() {
|
|
1191
|
+
const out = Array.from({ length: lineStartsCount });
|
|
1192
|
+
if (_firstNa >= _srcLen) {
|
|
1193
|
+
for (let j = 0; j < lineStartsCount; j++) {
|
|
1194
|
+
out[j] = dv.getUint32(lsOff + j * 4, true);
|
|
1195
|
+
}
|
|
1196
|
+
return out;
|
|
1197
|
+
}
|
|
1198
|
+
for (let j = 0; j < lineStartsCount; j++) {
|
|
1199
|
+
const v = dv.getUint32(lsOff + j * 4, true);
|
|
1200
|
+
out[j] = v < _firstNa ? v : (v >= _srcLen ? pm[pm.length - 1] : pm[v - _firstNa]);
|
|
1201
|
+
}
|
|
1202
|
+
return out;
|
|
1203
|
+
}
|
|
1204
|
+
function _decodeDiagnostics() {
|
|
1205
|
+
const out = Array.from({ length: diagCount });
|
|
1206
|
+
let dp = dOff;
|
|
1207
|
+
for (let j = 0; j < diagCount; j++) {
|
|
1208
|
+
const sev = SEVERITY[_u8[dp]]; dp++;
|
|
1209
|
+
const ds = _p(dv.getUint32(dp, true)); dp += 4;
|
|
1210
|
+
const de = _p(dv.getUint32(dp, true)); dp += 4;
|
|
1211
|
+
const ml = dv.getUint32(dp, true); dp += 4;
|
|
1212
|
+
const msg = _td.decode(_u8.subarray(dp, dp + ml)); dp += ml;
|
|
1213
|
+
const hh = _u8[dp]; dp++;
|
|
1214
|
+
let help = null;
|
|
1215
|
+
if (hh) {
|
|
1216
|
+
const hl = dv.getUint32(dp, true); dp += 4;
|
|
1217
|
+
help = _td.decode(_u8.subarray(dp, dp + hl)); dp += hl;
|
|
1218
|
+
}
|
|
1219
|
+
const lc = dv.getUint32(dp, true); dp += 4;
|
|
1220
|
+
const labels = Array.from({ length: lc });
|
|
1221
|
+
for (let k = 0; k < lc; k++) {
|
|
1222
|
+
const ls = _p(dv.getUint32(dp, true)); dp += 4;
|
|
1223
|
+
const le = _p(dv.getUint32(dp, true)); dp += 4;
|
|
1224
|
+
const lml = dv.getUint32(dp, true); dp += 4;
|
|
1225
|
+
labels[k] = {
|
|
1226
|
+
start: ls,
|
|
1227
|
+
end: le,
|
|
1228
|
+
message: _td.decode(_u8.subarray(dp, dp + lml)),
|
|
1229
|
+
};
|
|
1230
|
+
dp += lml;
|
|
1231
|
+
}
|
|
1232
|
+
out[j] = { severity: sev, message: msg, start: ds, end: de, help, labels };
|
|
1233
|
+
}
|
|
1234
|
+
return out;
|
|
1235
|
+
}
|
|
1236
|
+
function _scanType(tag, flags) {
|
|
1237
|
+
switch (tag) {
|
|
1238
|
+
case 3: return FUNCTION_TYPES[flags & 3];
|
|
1239
|
+
case 26: return CLASS_TYPES[flags & 1];
|
|
1240
|
+
case 28:
|
|
1241
|
+
return _isTs && (flags & 64)
|
|
1242
|
+
? "TSAbstractMethodDefinition"
|
|
1243
|
+
: "MethodDefinition";
|
|
1244
|
+
default: {
|
|
1245
|
+
const acc = (flags & 4) !== 0;
|
|
1246
|
+
if (_isTs && (flags & 256)) {
|
|
1247
|
+
return acc ? "TSAbstractAccessorProperty" : "TSAbstractPropertyDefinition";
|
|
1248
|
+
}
|
|
1249
|
+
return acc ? "AccessorProperty" : "PropertyDefinition";
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
function scan(visitors) {
|
|
1254
|
+
const handlers = new Map();
|
|
1255
|
+
let every = null;
|
|
1256
|
+
for (const k of Object.keys(visitors)) {
|
|
1257
|
+
const v = visitors[k];
|
|
1258
|
+
if (typeof v !== "function") continue;
|
|
1259
|
+
if (k === "enter") every = v;
|
|
1260
|
+
else handlers.set(k, v);
|
|
1261
|
+
}
|
|
1262
|
+
const wanted = new Array(TAG_TYPES.length).fill(null);
|
|
1263
|
+
for (let t = 0; t < TAG_TYPES.length; t++) {
|
|
1264
|
+
const tt = TAG_TYPES[t];
|
|
1265
|
+
if (tt === null) continue;
|
|
1266
|
+
if (tt === 0) {
|
|
1267
|
+
for (const c of TAG_CHOICES.get(t)) {
|
|
1268
|
+
if (handlers.has(c)) { wanted[t] = 0; break; }
|
|
1269
|
+
}
|
|
1270
|
+
} else {
|
|
1271
|
+
const h = handlers.get(tt);
|
|
1272
|
+
if (h !== undefined) wanted[t] = h;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
let stopFlag = false, skipFlag = false;
|
|
1276
|
+
let curIndex = 0, curO = 0, curTag = 0;
|
|
1277
|
+
const cursor = {
|
|
1278
|
+
get index() { return curIndex; },
|
|
1279
|
+
get type() {
|
|
1280
|
+
const t = TAG_TYPES[curTag];
|
|
1281
|
+
return t !== 0 ? t : _scanType(curTag, _u8[curO + 2] | (_u8[curO + 3] << 8));
|
|
1282
|
+
},
|
|
1283
|
+
get start() { return startOf(curIndex); },
|
|
1284
|
+
get end() { return endOf(curIndex); },
|
|
1285
|
+
node() { return node(curIndex); },
|
|
1286
|
+
skip() { skipFlag = true; },
|
|
1287
|
+
stop() { stopFlag = true; },
|
|
1288
|
+
};
|
|
1289
|
+
(function visit(i) {
|
|
1290
|
+
const o = _nodesOff + i * 48;
|
|
1291
|
+
const tag = _u8[o];
|
|
1292
|
+
let h = wanted[tag];
|
|
1293
|
+
if (h !== null || every !== null) {
|
|
1294
|
+
curIndex = i; curO = o; curTag = tag;
|
|
1295
|
+
if (h === 0) {
|
|
1296
|
+
h = handlers.get(_scanType(tag, _u8[o + 2] | (_u8[o + 3] << 8))) ?? null;
|
|
1297
|
+
}
|
|
1298
|
+
if (every !== null && TAG_TYPES[tag] !== null) {
|
|
1299
|
+
every(cursor);
|
|
1300
|
+
if (stopFlag) return;
|
|
1301
|
+
}
|
|
1302
|
+
if (h !== null) {
|
|
1303
|
+
h(cursor);
|
|
1304
|
+
if (stopFlag) return;
|
|
1305
|
+
}
|
|
1306
|
+
if (skipFlag) { skipFlag = false; return; }
|
|
1307
|
+
}
|
|
1308
|
+
const ops = SCAN_CHILDREN[tag];
|
|
1309
|
+
const b = o >> 2;
|
|
1310
|
+
for (let p = 0; p < ops.length; p += 2) {
|
|
1311
|
+
const slot = ops[p + 1];
|
|
1312
|
+
if (ops[p] === 0) {
|
|
1313
|
+
const c = _u32[b + slot];
|
|
1314
|
+
if (c !== NULL) {
|
|
1315
|
+
visit(c);
|
|
1316
|
+
if (stopFlag) return;
|
|
1317
|
+
}
|
|
1318
|
+
} else {
|
|
1319
|
+
const s = _u32[b + slot];
|
|
1320
|
+
const len = ops[p] === 1
|
|
1321
|
+
? _u32[b + slot + 1]
|
|
1322
|
+
: _u8[o + 4] | (_u8[o + 5] << 8);
|
|
1323
|
+
for (let j = 0; j < len; j++) {
|
|
1324
|
+
const c = _u32[_extraBase + s + j];
|
|
1325
|
+
if (c !== NULL) {
|
|
1326
|
+
visit(c);
|
|
1327
|
+
if (stopFlag) return;
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
})(progIdx);
|
|
1333
|
+
}
|
|
1334
|
+
let _semView;
|
|
1335
|
+
function _semantic() {
|
|
1336
|
+
if (_semView !== undefined) return _semView;
|
|
1337
|
+
if (!(_flags & 8)) return (_semView = null);
|
|
1338
|
+
let dp = dOff;
|
|
1339
|
+
for (let j = 0; j < diagCount; j++) {
|
|
1340
|
+
dp += 9;
|
|
1341
|
+
const ml = dv.getUint32(dp, true); dp += 4 + ml;
|
|
1342
|
+
if (_u8[dp++]) { const hl = dv.getUint32(dp, true); dp += 4 + hl; }
|
|
1343
|
+
const lc = dv.getUint32(dp, true); dp += 4;
|
|
1344
|
+
for (let k = 0; k < lc; k++) {
|
|
1345
|
+
dp += 8;
|
|
1346
|
+
const lml = dv.getUint32(dp, true); dp += 4 + lml;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
let o = ((dp + 3) & ~3) >> 2;
|
|
1350
|
+
const scopeCount = _u32[o], symbolCount = _u32[o + 1],
|
|
1351
|
+
referenceCount = _u32[o + 2], declNodeCount = _u32[o + 3],
|
|
1352
|
+
importCount = _u32[o + 4], exportCount = _u32[o + 5];
|
|
1353
|
+
o += 8;
|
|
1354
|
+
const scopes = _u32.subarray(o, o + scopeCount * 4);
|
|
1355
|
+
o += scopeCount * 4;
|
|
1356
|
+
const symbols = _u32.subarray(o, o + symbolCount * 6);
|
|
1357
|
+
o += symbolCount * 6;
|
|
1358
|
+
const declNodes = _u32.subarray(o, o + declNodeCount);
|
|
1359
|
+
o += declNodeCount;
|
|
1360
|
+
const references = _u32.subarray(o, o + referenceCount * 6);
|
|
1361
|
+
o += referenceCount * 6;
|
|
1362
|
+
const imports = _u32.subarray(o, o + importCount * 8);
|
|
1363
|
+
o += importCount * 8;
|
|
1364
|
+
const exports = _u32.subarray(o, o + exportCount * 10);
|
|
1365
|
+
o += exportCount * 10;
|
|
1366
|
+
const _id = (v) => v === NULL ? null : v;
|
|
1367
|
+
return (_semView = {
|
|
1368
|
+
scope: {
|
|
1369
|
+
count: scopeCount,
|
|
1370
|
+
kind: (i) => SCOPE_KINDS[scopes[i * 4 + 3] & 255],
|
|
1371
|
+
strict: (i) => ((scopes[i * 4 + 3] >> 8) & 1) !== 0,
|
|
1372
|
+
node: (i) => node(scopes[i * 4 + 0]),
|
|
1373
|
+
nodeIndex: (i) => scopes[i * 4 + 0],
|
|
1374
|
+
parentId: (i) => _id(scopes[i * 4 + 1]),
|
|
1375
|
+
hoistTargetId: (i) => scopes[i * 4 + 2],
|
|
1376
|
+
start: (i) => startOf(scopes[i * 4 + 0]),
|
|
1377
|
+
end: (i) => endOf(scopes[i * 4 + 0]),
|
|
1378
|
+
},
|
|
1379
|
+
symbol: {
|
|
1380
|
+
count: symbolCount,
|
|
1381
|
+
name: (i) => str(symbols[i * 6 + 0], symbols[i * 6 + 1]),
|
|
1382
|
+
flags: (i) => symbols[i * 6 + 2],
|
|
1383
|
+
scopeId: (i) => symbols[i * 6 + 3],
|
|
1384
|
+
declCount: (i) => symbols[i * 6 + 5],
|
|
1385
|
+
declNode: (i, j) => node(declNodes[symbols[i * 6 + 4] + j]),
|
|
1386
|
+
declNodeIndex: (i, j) => declNodes[symbols[i * 6 + 4] + j],
|
|
1387
|
+
},
|
|
1388
|
+
reference: {
|
|
1389
|
+
count: referenceCount,
|
|
1390
|
+
name: (i) => str(references[i * 6 + 0], references[i * 6 + 1]),
|
|
1391
|
+
scopeId: (i) => references[i * 6 + 2],
|
|
1392
|
+
node: (i) => node(references[i * 6 + 3]),
|
|
1393
|
+
nodeIndex: (i) => references[i * 6 + 3],
|
|
1394
|
+
kind: (i) => IMPORT_EXPORT_KINDS[(references[i * 6 + 4] >> 0) & 1],
|
|
1395
|
+
isWrite: (i) => ((references[i * 6 + 4] >> 1) & 1) !== 0,
|
|
1396
|
+
symbolId: (i) => _id(references[i * 6 + 5]),
|
|
1397
|
+
start: (i) => startOf(references[i * 6 + 3]),
|
|
1398
|
+
end: (i) => endOf(references[i * 6 + 3]),
|
|
1399
|
+
},
|
|
1400
|
+
import: {
|
|
1401
|
+
count: importCount,
|
|
1402
|
+
symbolId: (i) => _id(imports[i * 8 + 0]),
|
|
1403
|
+
nameKind: (i) => NAME_KINDS[imports[i * 8 + 1] & 7],
|
|
1404
|
+
name: (i) => str(imports[i * 8 + 2], imports[i * 8 + 3]),
|
|
1405
|
+
specifier: (i) => str(imports[i * 8 + 4], imports[i * 8 + 5]),
|
|
1406
|
+
typeOnly: (i) => ((imports[i * 8 + 1] >> 3) & 1) !== 0,
|
|
1407
|
+
phase: (i) =>
|
|
1408
|
+
(imports[i * 8 + 1] >> 4) & 1
|
|
1409
|
+
? IMPORT_PHASES[(imports[i * 8 + 1] >> 5) & 1]
|
|
1410
|
+
: null,
|
|
1411
|
+
node: (i) => node(imports[i * 8 + 6]),
|
|
1412
|
+
},
|
|
1413
|
+
export: {
|
|
1414
|
+
count: exportCount,
|
|
1415
|
+
nameKind: (i) => NAME_KINDS[exports[i * 10 + 0] & 7],
|
|
1416
|
+
fromKind: (i) => NAME_KINDS[(exports[i * 10 + 0] >> 3) & 7],
|
|
1417
|
+
typeOnly: (i) => ((exports[i * 10 + 0] >> 6) & 1) !== 0,
|
|
1418
|
+
name: (i) => str(exports[i * 10 + 1], exports[i * 10 + 2]),
|
|
1419
|
+
fromName: (i) => str(exports[i * 10 + 4], exports[i * 10 + 5]),
|
|
1420
|
+
specifier: (i) => str(exports[i * 10 + 6], exports[i * 10 + 7]),
|
|
1421
|
+
symbolId: (i) => _id(exports[i * 10 + 3]),
|
|
1422
|
+
node: (i) => node(exports[i * 10 + 8]),
|
|
1423
|
+
},
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
let _program, _lineStarts, _diagnostics, _comments;
|
|
1427
|
+
function _getLineStarts() {
|
|
1428
|
+
if (_lineStarts === undefined) _lineStarts = _decodeLineStarts();
|
|
1429
|
+
return _lineStarts;
|
|
1430
|
+
}
|
|
1431
|
+
return {
|
|
1432
|
+
get program() {
|
|
1433
|
+
return _program !== undefined ? _program : (_program = node(progIdx));
|
|
1434
|
+
},
|
|
1435
|
+
get comments() {
|
|
1436
|
+
return _comments !== undefined
|
|
1437
|
+
? _comments
|
|
1438
|
+
: (_comments = _decodeComments());
|
|
1439
|
+
},
|
|
1440
|
+
get diagnostics() {
|
|
1441
|
+
return _diagnostics !== undefined
|
|
1442
|
+
? _diagnostics
|
|
1443
|
+
: (_diagnostics = _decodeDiagnostics());
|
|
1444
|
+
},
|
|
1445
|
+
get lineStarts() { return _getLineStarts(); },
|
|
1446
|
+
locOf(offset) {
|
|
1447
|
+
const ls = _getLineStarts();
|
|
1448
|
+
let lo = 0, hi = ls.length;
|
|
1449
|
+
while (lo < hi) {
|
|
1450
|
+
const mid = (lo + hi) >>> 1;
|
|
1451
|
+
if (ls[mid] <= offset) lo = mid + 1; else hi = mid;
|
|
1452
|
+
}
|
|
1453
|
+
return { line: lo, column: offset - ls[lo - 1] };
|
|
1454
|
+
},
|
|
1455
|
+
scan,
|
|
1456
|
+
nodeOf: node,
|
|
1457
|
+
indexOf: (n) => _nodeIndexes.get(n),
|
|
1458
|
+
startOf, endOf, str,
|
|
1459
|
+
get semantic() { return _semantic(); },
|
|
1460
|
+
};
|
|
1461
|
+
}
|
|
1462
|
+
export { decode, SymbolFlags, CHILD_KEYS };
|