@babel/traverse 7.17.9 → 7.23.4
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 -1
- package/lib/cache.js +27 -9
- package/lib/cache.js.map +1 -0
- package/lib/context.js +9 -31
- package/lib/context.js.map +1 -0
- package/lib/hub.js +2 -6
- package/lib/hub.js.map +1 -0
- package/lib/index.js +18 -35
- package/lib/index.js.map +1 -0
- package/lib/path/ancestry.js +3 -42
- package/lib/path/ancestry.js.map +1 -0
- package/lib/path/comments.js +23 -11
- package/lib/path/comments.js.map +1 -0
- package/lib/path/context.js +24 -65
- package/lib/path/context.js.map +1 -0
- package/lib/path/conversion.js +37 -100
- package/lib/path/conversion.js.map +1 -0
- package/lib/path/evaluation.js +69 -123
- package/lib/path/evaluation.js.map +1 -0
- package/lib/path/family.js +5 -76
- package/lib/path/family.js.map +1 -0
- package/lib/path/index.js +28 -96
- package/lib/path/index.js.map +1 -0
- package/lib/path/inference/index.js +26 -33
- package/lib/path/inference/index.js.map +1 -0
- package/lib/path/inference/inferer-reference.js +6 -61
- package/lib/path/inference/inferer-reference.js.map +1 -0
- package/lib/path/inference/inferers.js +32 -86
- package/lib/path/inference/inferers.js.map +1 -0
- package/lib/path/inference/util.js +30 -0
- package/lib/path/inference/util.js.map +1 -0
- package/lib/path/introspection.js +55 -107
- package/lib/path/introspection.js.map +1 -0
- package/lib/path/lib/hoister.js +2 -37
- package/lib/path/lib/hoister.js.map +1 -0
- package/lib/path/lib/removal-hooks.js +4 -5
- package/lib/path/lib/removal-hooks.js.map +1 -0
- package/lib/path/lib/virtual-types-validator.js +161 -0
- package/lib/path/lib/virtual-types-validator.js.map +1 -0
- package/lib/path/lib/virtual-types.js +20 -224
- package/lib/path/lib/virtual-types.js.map +1 -0
- package/lib/path/modification.js +17 -61
- package/lib/path/modification.js.map +1 -0
- package/lib/path/removal.js +9 -22
- package/lib/path/removal.js.map +1 -0
- package/lib/path/replacement.js +80 -76
- package/lib/path/replacement.js.map +1 -0
- package/lib/scope/binding.js +20 -12
- package/lib/scope/binding.js.map +1 -0
- package/lib/scope/index.js +117 -247
- package/lib/scope/index.js.map +1 -0
- package/lib/scope/lib/renamer.js +41 -74
- package/lib/scope/lib/renamer.js.map +1 -0
- package/lib/traverse-node.js +10 -11
- package/lib/traverse-node.js.map +1 -0
- package/lib/types.js +1 -3
- package/lib/types.js.map +1 -0
- package/lib/visitors.js +62 -83
- package/lib/visitors.js.map +1 -0
- package/package.json +13 -11
- package/lib/path/generated/asserts.js +0 -5
- package/lib/path/generated/validators.js +0 -5
- package/lib/path/generated/virtual-types.js +0 -3
- package/scripts/generators/asserts.js +0 -25
- package/scripts/generators/validators.js +0 -42
- package/scripts/generators/virtual-types.js +0 -24
- package/scripts/package.json +0 -1
package/lib/path/family.js
CHANGED
@@ -17,11 +17,8 @@ exports.getOuterBindingIdentifierPaths = getOuterBindingIdentifierPaths;
|
|
17
17
|
exports.getOuterBindingIdentifiers = getOuterBindingIdentifiers;
|
18
18
|
exports.getPrevSibling = getPrevSibling;
|
19
19
|
exports.getSibling = getSibling;
|
20
|
-
|
21
|
-
var _index = require("./index");
|
22
|
-
|
20
|
+
var _index = require("./index.js");
|
23
21
|
var _t = require("@babel/types");
|
24
|
-
|
25
22
|
const {
|
26
23
|
getBindingIdentifiers: _getBindingIdentifiers,
|
27
24
|
getOuterBindingIdentifiers: _getOuterBindingIdentifiers,
|
@@ -31,77 +28,60 @@ const {
|
|
31
28
|
} = _t;
|
32
29
|
const NORMAL_COMPLETION = 0;
|
33
30
|
const BREAK_COMPLETION = 1;
|
34
|
-
|
35
31
|
function NormalCompletion(path) {
|
36
32
|
return {
|
37
33
|
type: NORMAL_COMPLETION,
|
38
34
|
path
|
39
35
|
};
|
40
36
|
}
|
41
|
-
|
42
37
|
function BreakCompletion(path) {
|
43
38
|
return {
|
44
39
|
type: BREAK_COMPLETION,
|
45
40
|
path
|
46
41
|
};
|
47
42
|
}
|
48
|
-
|
49
43
|
function getOpposite() {
|
50
44
|
if (this.key === "left") {
|
51
45
|
return this.getSibling("right");
|
52
46
|
} else if (this.key === "right") {
|
53
47
|
return this.getSibling("left");
|
54
48
|
}
|
55
|
-
|
56
49
|
return null;
|
57
50
|
}
|
58
|
-
|
59
51
|
function addCompletionRecords(path, records, context) {
|
60
52
|
if (path) {
|
61
53
|
records.push(..._getCompletionRecords(path, context));
|
62
54
|
}
|
63
|
-
|
64
55
|
return records;
|
65
56
|
}
|
66
|
-
|
67
57
|
function completionRecordForSwitch(cases, records, context) {
|
68
58
|
let lastNormalCompletions = [];
|
69
|
-
|
70
59
|
for (let i = 0; i < cases.length; i++) {
|
71
60
|
const casePath = cases[i];
|
72
|
-
|
73
61
|
const caseCompletions = _getCompletionRecords(casePath, context);
|
74
|
-
|
75
62
|
const normalCompletions = [];
|
76
63
|
const breakCompletions = [];
|
77
|
-
|
78
64
|
for (const c of caseCompletions) {
|
79
65
|
if (c.type === NORMAL_COMPLETION) {
|
80
66
|
normalCompletions.push(c);
|
81
67
|
}
|
82
|
-
|
83
68
|
if (c.type === BREAK_COMPLETION) {
|
84
69
|
breakCompletions.push(c);
|
85
70
|
}
|
86
71
|
}
|
87
|
-
|
88
72
|
if (normalCompletions.length) {
|
89
73
|
lastNormalCompletions = normalCompletions;
|
90
74
|
}
|
91
|
-
|
92
75
|
records.push(...breakCompletions);
|
93
76
|
}
|
94
|
-
|
95
77
|
records.push(...lastNormalCompletions);
|
96
78
|
return records;
|
97
79
|
}
|
98
|
-
|
99
80
|
function normalCompletionToBreak(completions) {
|
100
81
|
completions.forEach(c => {
|
101
82
|
c.type = BREAK_COMPLETION;
|
102
83
|
});
|
103
84
|
}
|
104
|
-
|
105
85
|
function replaceBreakStatementInBreakCompletion(completions, reachable) {
|
106
86
|
completions.forEach(c => {
|
107
87
|
if (c.path.isBreakStatement({
|
@@ -115,63 +95,49 @@ function replaceBreakStatementInBreakCompletion(completions, reachable) {
|
|
115
95
|
}
|
116
96
|
});
|
117
97
|
}
|
118
|
-
|
119
98
|
function getStatementListCompletion(paths, context) {
|
120
99
|
const completions = [];
|
121
|
-
|
122
100
|
if (context.canHaveBreak) {
|
123
101
|
let lastNormalCompletions = [];
|
124
|
-
|
125
102
|
for (let i = 0; i < paths.length; i++) {
|
126
103
|
const path = paths[i];
|
127
104
|
const newContext = Object.assign({}, context, {
|
128
105
|
inCaseClause: false
|
129
106
|
});
|
130
|
-
|
131
107
|
if (path.isBlockStatement() && (context.inCaseClause || context.shouldPopulateBreak)) {
|
132
108
|
newContext.shouldPopulateBreak = true;
|
133
109
|
} else {
|
134
110
|
newContext.shouldPopulateBreak = false;
|
135
111
|
}
|
136
|
-
|
137
112
|
const statementCompletions = _getCompletionRecords(path, newContext);
|
138
|
-
|
139
113
|
if (statementCompletions.length > 0 && statementCompletions.every(c => c.type === BREAK_COMPLETION)) {
|
140
114
|
if (lastNormalCompletions.length > 0 && statementCompletions.every(c => c.path.isBreakStatement({
|
141
115
|
label: null
|
142
116
|
}))) {
|
143
117
|
normalCompletionToBreak(lastNormalCompletions);
|
144
118
|
completions.push(...lastNormalCompletions);
|
145
|
-
|
146
119
|
if (lastNormalCompletions.some(c => c.path.isDeclaration())) {
|
147
120
|
completions.push(...statementCompletions);
|
148
121
|
replaceBreakStatementInBreakCompletion(statementCompletions, true);
|
149
122
|
}
|
150
|
-
|
151
123
|
replaceBreakStatementInBreakCompletion(statementCompletions, false);
|
152
124
|
} else {
|
153
125
|
completions.push(...statementCompletions);
|
154
|
-
|
155
126
|
if (!context.shouldPopulateBreak) {
|
156
127
|
replaceBreakStatementInBreakCompletion(statementCompletions, true);
|
157
128
|
}
|
158
129
|
}
|
159
|
-
|
160
130
|
break;
|
161
131
|
}
|
162
|
-
|
163
132
|
if (i === paths.length - 1) {
|
164
133
|
completions.push(...statementCompletions);
|
165
134
|
} else {
|
166
135
|
lastNormalCompletions = [];
|
167
|
-
|
168
136
|
for (let i = 0; i < statementCompletions.length; i++) {
|
169
137
|
const c = statementCompletions[i];
|
170
|
-
|
171
138
|
if (c.type === BREAK_COMPLETION) {
|
172
139
|
completions.push(c);
|
173
140
|
}
|
174
|
-
|
175
141
|
if (c.type === NORMAL_COMPLETION) {
|
176
142
|
lastNormalCompletions.push(c);
|
177
143
|
}
|
@@ -181,20 +147,16 @@ function getStatementListCompletion(paths, context) {
|
|
181
147
|
} else if (paths.length) {
|
182
148
|
for (let i = paths.length - 1; i >= 0; i--) {
|
183
149
|
const pathCompletions = _getCompletionRecords(paths[i], context);
|
184
|
-
|
185
150
|
if (pathCompletions.length > 1 || pathCompletions.length === 1 && !pathCompletions[0].path.isVariableDeclaration()) {
|
186
151
|
completions.push(...pathCompletions);
|
187
152
|
break;
|
188
153
|
}
|
189
154
|
}
|
190
155
|
}
|
191
|
-
|
192
156
|
return completions;
|
193
157
|
}
|
194
|
-
|
195
158
|
function _getCompletionRecords(path, context) {
|
196
159
|
let records = [];
|
197
|
-
|
198
160
|
if (path.isIfStatement()) {
|
199
161
|
records = addCompletionRecords(path.get("consequent"), records, context);
|
200
162
|
records = addCompletionRecords(path.get("alternate"), records, context);
|
@@ -222,20 +184,16 @@ function _getCompletionRecords(path, context) {
|
|
222
184
|
} else {
|
223
185
|
records.push(NormalCompletion(path));
|
224
186
|
}
|
225
|
-
|
226
187
|
return records;
|
227
188
|
}
|
228
|
-
|
229
189
|
function getCompletionRecords() {
|
230
190
|
const records = _getCompletionRecords(this, {
|
231
191
|
canHaveBreak: false,
|
232
192
|
shouldPopulateBreak: false,
|
233
193
|
inCaseClause: false
|
234
194
|
});
|
235
|
-
|
236
195
|
return records.map(r => r.path);
|
237
196
|
}
|
238
|
-
|
239
197
|
function getSibling(key) {
|
240
198
|
return _index.default.get({
|
241
199
|
parentPath: this.parentPath,
|
@@ -245,56 +203,44 @@ function getSibling(key) {
|
|
245
203
|
key: key
|
246
204
|
}).setContext(this.context);
|
247
205
|
}
|
248
|
-
|
249
206
|
function getPrevSibling() {
|
250
207
|
return this.getSibling(this.key - 1);
|
251
208
|
}
|
252
|
-
|
253
209
|
function getNextSibling() {
|
254
210
|
return this.getSibling(this.key + 1);
|
255
211
|
}
|
256
|
-
|
257
212
|
function getAllNextSiblings() {
|
258
213
|
let _key = this.key;
|
259
214
|
let sibling = this.getSibling(++_key);
|
260
215
|
const siblings = [];
|
261
|
-
|
262
216
|
while (sibling.node) {
|
263
217
|
siblings.push(sibling);
|
264
218
|
sibling = this.getSibling(++_key);
|
265
219
|
}
|
266
|
-
|
267
220
|
return siblings;
|
268
221
|
}
|
269
|
-
|
270
222
|
function getAllPrevSiblings() {
|
271
223
|
let _key = this.key;
|
272
224
|
let sibling = this.getSibling(--_key);
|
273
225
|
const siblings = [];
|
274
|
-
|
275
226
|
while (sibling.node) {
|
276
227
|
siblings.push(sibling);
|
277
228
|
sibling = this.getSibling(--_key);
|
278
229
|
}
|
279
|
-
|
280
230
|
return siblings;
|
281
231
|
}
|
282
|
-
|
283
232
|
function get(key, context = true) {
|
284
233
|
if (context === true) context = this.context;
|
285
234
|
const parts = key.split(".");
|
286
|
-
|
287
235
|
if (parts.length === 1) {
|
288
236
|
return this._getKey(key, context);
|
289
237
|
} else {
|
290
238
|
return this._getPattern(parts, context);
|
291
239
|
}
|
292
240
|
}
|
293
|
-
|
294
241
|
function _getKey(key, context) {
|
295
242
|
const node = this.node;
|
296
243
|
const container = node[key];
|
297
|
-
|
298
244
|
if (Array.isArray(container)) {
|
299
245
|
return container.map((_, i) => {
|
300
246
|
return _index.default.get({
|
@@ -314,10 +260,8 @@ function _getKey(key, context) {
|
|
314
260
|
}).setContext(context);
|
315
261
|
}
|
316
262
|
}
|
317
|
-
|
318
263
|
function _getPattern(parts, context) {
|
319
264
|
let path = this;
|
320
|
-
|
321
265
|
for (const part of parts) {
|
322
266
|
if (part === ".") {
|
323
267
|
path = path.parentPath;
|
@@ -329,67 +273,52 @@ function _getPattern(parts, context) {
|
|
329
273
|
}
|
330
274
|
}
|
331
275
|
}
|
332
|
-
|
333
276
|
return path;
|
334
277
|
}
|
335
|
-
|
336
278
|
function getBindingIdentifiers(duplicates) {
|
337
279
|
return _getBindingIdentifiers(this.node, duplicates);
|
338
280
|
}
|
339
|
-
|
340
281
|
function getOuterBindingIdentifiers(duplicates) {
|
341
282
|
return _getOuterBindingIdentifiers(this.node, duplicates);
|
342
283
|
}
|
343
|
-
|
344
284
|
function getBindingIdentifierPaths(duplicates = false, outerOnly = false) {
|
345
285
|
const path = this;
|
346
286
|
const search = [path];
|
347
287
|
const ids = Object.create(null);
|
348
|
-
|
349
288
|
while (search.length) {
|
350
289
|
const id = search.shift();
|
351
290
|
if (!id) continue;
|
352
291
|
if (!id.node) continue;
|
353
292
|
const keys = _getBindingIdentifiers.keys[id.node.type];
|
354
|
-
|
355
293
|
if (id.isIdentifier()) {
|
356
294
|
if (duplicates) {
|
357
295
|
const _ids = ids[id.node.name] = ids[id.node.name] || [];
|
358
|
-
|
359
296
|
_ids.push(id);
|
360
297
|
} else {
|
361
298
|
ids[id.node.name] = id;
|
362
299
|
}
|
363
|
-
|
364
300
|
continue;
|
365
301
|
}
|
366
|
-
|
367
302
|
if (id.isExportDeclaration()) {
|
368
303
|
const declaration = id.get("declaration");
|
369
|
-
|
370
304
|
if (isDeclaration(declaration)) {
|
371
305
|
search.push(declaration);
|
372
306
|
}
|
373
|
-
|
374
307
|
continue;
|
375
308
|
}
|
376
|
-
|
377
309
|
if (outerOnly) {
|
378
310
|
if (id.isFunctionDeclaration()) {
|
379
311
|
search.push(id.get("id"));
|
380
312
|
continue;
|
381
313
|
}
|
382
|
-
|
383
314
|
if (id.isFunctionExpression()) {
|
384
315
|
continue;
|
385
316
|
}
|
386
317
|
}
|
387
|
-
|
388
318
|
if (keys) {
|
389
319
|
for (let i = 0; i < keys.length; i++) {
|
390
320
|
const key = keys[i];
|
391
321
|
const child = id.get(key);
|
392
|
-
|
393
322
|
if (Array.isArray(child)) {
|
394
323
|
search.push(...child);
|
395
324
|
} else if (child.node) {
|
@@ -398,10 +327,10 @@ function getBindingIdentifierPaths(duplicates = false, outerOnly = false) {
|
|
398
327
|
}
|
399
328
|
}
|
400
329
|
}
|
401
|
-
|
402
330
|
return ids;
|
403
331
|
}
|
404
|
-
|
405
|
-
function getOuterBindingIdentifierPaths(duplicates) {
|
332
|
+
function getOuterBindingIdentifierPaths(duplicates = false) {
|
406
333
|
return this.getBindingIdentifierPaths(duplicates, true);
|
407
|
-
}
|
334
|
+
}
|
335
|
+
|
336
|
+
//# sourceMappingURL=family.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_index","require","_t","getBindingIdentifiers","_getBindingIdentifiers","getOuterBindingIdentifiers","_getOuterBindingIdentifiers","isDeclaration","numericLiteral","unaryExpression","NORMAL_COMPLETION","BREAK_COMPLETION","NormalCompletion","path","type","BreakCompletion","getOpposite","key","getSibling","addCompletionRecords","records","context","push","_getCompletionRecords","completionRecordForSwitch","cases","lastNormalCompletions","i","length","casePath","caseCompletions","normalCompletions","breakCompletions","c","normalCompletionToBreak","completions","forEach","replaceBreakStatementInBreakCompletion","reachable","isBreakStatement","label","replaceWith","remove","getStatementListCompletion","paths","canHaveBreak","newContext","Object","assign","inCaseClause","isBlockStatement","shouldPopulateBreak","statementCompletions","every","some","pathCompletions","isVariableDeclaration","isIfStatement","get","isDoExpression","isFor","isWhile","isLabeledStatement","isProgram","isFunction","isTryStatement","isCatchClause","isSwitchStatement","isSwitchCase","getCompletionRecords","map","r","NodePath","parentPath","parent","container","listKey","setContext","getPrevSibling","getNextSibling","getAllNextSiblings","_key","sibling","siblings","node","getAllPrevSiblings","parts","split","_getKey","_getPattern","Array","isArray","_","part","duplicates","getBindingIdentifierPaths","outerOnly","search","ids","create","id","shift","keys","isIdentifier","_ids","name","isExportDeclaration","declaration","isFunctionDeclaration","isFunctionExpression","child","getOuterBindingIdentifierPaths"],"sources":["../../src/path/family.ts"],"sourcesContent":["// This file contains methods responsible for dealing with/retrieving children or siblings.\n\nimport type TraversalContext from \"../context.ts\";\nimport NodePath from \"./index.ts\";\nimport {\n getBindingIdentifiers as _getBindingIdentifiers,\n getOuterBindingIdentifiers as _getOuterBindingIdentifiers,\n isDeclaration,\n numericLiteral,\n unaryExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nconst NORMAL_COMPLETION = 0 as const;\nconst BREAK_COMPLETION = 1 as const;\n\ntype Completion = {\n path: NodePath;\n type: 0 | 1;\n};\n\ntype CompletionContext = {\n // whether the current context allows `break` statement. When it allows, we have\n // to search all the statements for potential `break`\n canHaveBreak: boolean;\n // whether the statement is an immediate descendant of a switch case clause\n inCaseClause: boolean;\n // whether the `break` statement record should be populated to upper level\n // when a `break` statement is an immediate descendant of a block statement, e.g.\n // `{ break }`, it can influence the control flow in the upper levels.\n shouldPopulateBreak: boolean;\n};\n\nfunction NormalCompletion(path: NodePath) {\n return { type: NORMAL_COMPLETION, path };\n}\n\nfunction BreakCompletion(path: NodePath) {\n return { type: BREAK_COMPLETION, path };\n}\n\nexport function getOpposite(this: NodePath): NodePath | null {\n if (this.key === \"left\") {\n return this.getSibling(\"right\");\n } else if (this.key === \"right\") {\n return this.getSibling(\"left\");\n }\n return null;\n}\n\nfunction addCompletionRecords(\n path: NodePath | null | undefined,\n records: Completion[],\n context: CompletionContext,\n): Completion[] {\n if (path) {\n records.push(..._getCompletionRecords(path, context));\n }\n return records;\n}\n\nfunction completionRecordForSwitch(\n cases: NodePath<t.SwitchCase>[],\n records: Completion[],\n context: CompletionContext,\n): Completion[] {\n // https://tc39.es/ecma262/#sec-runtime-semantics-caseblockevaluation\n let lastNormalCompletions: Completion[] = [];\n for (let i = 0; i < cases.length; i++) {\n const casePath = cases[i];\n const caseCompletions = _getCompletionRecords(casePath, context);\n const normalCompletions = [];\n const breakCompletions = [];\n for (const c of caseCompletions) {\n if (c.type === NORMAL_COMPLETION) {\n normalCompletions.push(c);\n }\n if (c.type === BREAK_COMPLETION) {\n breakCompletions.push(c);\n }\n }\n if (normalCompletions.length) {\n lastNormalCompletions = normalCompletions;\n }\n records.push(...breakCompletions);\n }\n records.push(...lastNormalCompletions);\n return records;\n}\n\nfunction normalCompletionToBreak(completions: Completion[]) {\n completions.forEach(c => {\n c.type = BREAK_COMPLETION;\n });\n}\n\n/**\n * Determine how we should handle the break statement for break completions\n *\n * @param {Completion[]} completions\n * @param {boolean} reachable Whether the break statement is reachable after\n we mark the normal completions _before_ the given break completions as the final\n completions. For example,\n `{ 0 }; break;` is transformed to `{ return 0 }; break;`, the `break` here is unreachable\n and thus can be removed without consequences. We may in the future reserve them instead since\n we do not consistently remove unreachable statements _after_ break\n `{ var x = 0 }; break;` is transformed to `{ var x = 0 }; return void 0;`, the `break` is reachable\n because we can not wrap variable declaration under a return statement\n */\nfunction replaceBreakStatementInBreakCompletion(\n completions: Completion[],\n reachable: boolean,\n) {\n completions.forEach(c => {\n if (c.path.isBreakStatement({ label: null })) {\n if (reachable) {\n c.path.replaceWith(unaryExpression(\"void\", numericLiteral(0)));\n } else {\n c.path.remove();\n }\n }\n });\n}\n\nfunction getStatementListCompletion(\n paths: NodePath[],\n context: CompletionContext,\n): Completion[] {\n const completions = [];\n if (context.canHaveBreak) {\n let lastNormalCompletions = [];\n for (let i = 0; i < paths.length; i++) {\n const path = paths[i];\n const newContext = { ...context, inCaseClause: false };\n if (\n path.isBlockStatement() &&\n (context.inCaseClause || // case test: { break }\n context.shouldPopulateBreak) // case test: { { break } }\n ) {\n newContext.shouldPopulateBreak = true;\n } else {\n newContext.shouldPopulateBreak = false;\n }\n const statementCompletions = _getCompletionRecords(path, newContext);\n if (\n statementCompletions.length > 0 &&\n // we can stop search `paths` when we have seen a `path` that is\n // effectively a `break` statement. Examples are\n // - `break`\n // - `if (true) { 1; break } else { 2; break }`\n // - `{ break }```\n // In other words, the paths after this `path` are unreachable\n statementCompletions.every(c => c.type === BREAK_COMPLETION)\n ) {\n if (\n lastNormalCompletions.length > 0 &&\n statementCompletions.every(c =>\n c.path.isBreakStatement({ label: null }),\n )\n ) {\n // when a break completion has a path as BreakStatement, it must be `{ break }`\n // whose completion value we can not determine, otherwise it would have been\n // replaced by `replaceBreakStatementInBreakCompletion`\n // When we have seen normal completions from the last statement\n // it is safe to stop populating break and mark normal completions as break\n normalCompletionToBreak(lastNormalCompletions);\n completions.push(...lastNormalCompletions);\n // Declarations have empty completion record, however they can not be nested\n // directly in return statement, i.e. `return (var a = 1)` is invalid.\n if (lastNormalCompletions.some(c => c.path.isDeclaration())) {\n completions.push(...statementCompletions);\n replaceBreakStatementInBreakCompletion(\n statementCompletions,\n /* reachable */ true,\n );\n }\n replaceBreakStatementInBreakCompletion(\n statementCompletions,\n /* reachable */ false,\n );\n } else {\n completions.push(...statementCompletions);\n if (!context.shouldPopulateBreak) {\n replaceBreakStatementInBreakCompletion(\n statementCompletions,\n /* reachable */ true,\n );\n }\n }\n break;\n }\n if (i === paths.length - 1) {\n completions.push(...statementCompletions);\n } else {\n lastNormalCompletions = [];\n for (let i = 0; i < statementCompletions.length; i++) {\n const c = statementCompletions[i];\n if (c.type === BREAK_COMPLETION) {\n completions.push(c);\n }\n if (c.type === NORMAL_COMPLETION) {\n lastNormalCompletions.push(c);\n }\n }\n }\n }\n } else if (paths.length) {\n // When we are in a context where `break` must not exist, we can skip linear\n // search on statement lists and assume that the last\n // non-variable-declaration statement determines the completion.\n for (let i = paths.length - 1; i >= 0; i--) {\n const pathCompletions = _getCompletionRecords(paths[i], context);\n if (\n pathCompletions.length > 1 ||\n (pathCompletions.length === 1 &&\n !pathCompletions[0].path.isVariableDeclaration())\n ) {\n completions.push(...pathCompletions);\n break;\n }\n }\n }\n return completions;\n}\n\nfunction _getCompletionRecords(\n path: NodePath,\n context: CompletionContext,\n): Completion[] {\n let records: Completion[] = [];\n if (path.isIfStatement()) {\n records = addCompletionRecords(path.get(\"consequent\"), records, context);\n records = addCompletionRecords(path.get(\"alternate\"), records, context);\n } else if (\n path.isDoExpression() ||\n path.isFor() ||\n path.isWhile() ||\n path.isLabeledStatement()\n ) {\n // @ts-expect-error(flow->ts): todo\n return addCompletionRecords(path.get(\"body\"), records, context);\n } else if (path.isProgram() || path.isBlockStatement()) {\n // @ts-expect-error(flow->ts): todo\n return getStatementListCompletion(path.get(\"body\"), context);\n } else if (path.isFunction()) {\n return _getCompletionRecords(path.get(\"body\"), context);\n } else if (path.isTryStatement()) {\n records = addCompletionRecords(path.get(\"block\"), records, context);\n records = addCompletionRecords(path.get(\"handler\"), records, context);\n } else if (path.isCatchClause()) {\n return addCompletionRecords(path.get(\"body\"), records, context);\n } else if (path.isSwitchStatement()) {\n return completionRecordForSwitch(path.get(\"cases\"), records, context);\n } else if (path.isSwitchCase()) {\n return getStatementListCompletion(path.get(\"consequent\"), {\n canHaveBreak: true,\n shouldPopulateBreak: false,\n inCaseClause: true,\n });\n } else if (path.isBreakStatement()) {\n records.push(BreakCompletion(path));\n } else {\n records.push(NormalCompletion(path));\n }\n\n return records;\n}\n\n/**\n * Retrieve the completion records of a given path.\n * Note: to ensure proper support on `break` statement, this method\n * will manipulate the AST around the break statement. Do not call the method\n * twice for the same path.\n *\n * @export\n * @param {NodePath} this\n * @returns {NodePath[]} Completion records\n */\nexport function getCompletionRecords(this: NodePath): NodePath[] {\n const records = _getCompletionRecords(this, {\n canHaveBreak: false,\n shouldPopulateBreak: false,\n inCaseClause: false,\n });\n return records.map(r => r.path);\n}\n\nexport function getSibling(this: NodePath, key: string | number): NodePath {\n return NodePath.get({\n parentPath: this.parentPath,\n parent: this.parent,\n container: this.container,\n listKey: this.listKey,\n key: key,\n }).setContext(this.context);\n}\n\nexport function getPrevSibling(this: NodePath): NodePath {\n // @ts-expect-error todo(flow->ts) this.key could be a string\n return this.getSibling(this.key - 1);\n}\n\nexport function getNextSibling(this: NodePath): NodePath {\n // @ts-expect-error todo(flow->ts) this.key could be a string\n return this.getSibling(this.key + 1);\n}\n\nexport function getAllNextSiblings(this: NodePath): NodePath[] {\n // @ts-expect-error todo(flow->ts) this.key could be a string\n let _key: number = this.key;\n let sibling = this.getSibling(++_key);\n const siblings = [];\n while (sibling.node) {\n siblings.push(sibling);\n sibling = this.getSibling(++_key);\n }\n return siblings;\n}\n\nexport function getAllPrevSiblings(this: NodePath): NodePath[] {\n // @ts-expect-error todo(flow->ts) this.key could be a string\n let _key: number = this.key;\n let sibling = this.getSibling(--_key);\n const siblings = [];\n while (sibling.node) {\n siblings.push(sibling);\n sibling = this.getSibling(--_key);\n }\n return siblings;\n}\n\n// convert \"1\" to 1 (string index to number index)\ntype MaybeToIndex<T extends string> = T extends `${bigint}` ? number : T;\n\ntype Pattern<Obj extends string, Prop extends string> = `${Obj}.${Prop}`;\n\n// split \"body.body.1\" to [\"body\", \"body\", 1]\ntype Split<P extends string> = P extends Pattern<infer O, infer U>\n ? [MaybeToIndex<O>, ...Split<U>]\n : [MaybeToIndex<P>];\n\n// get all K with Node[K] is t.Node | t.Node[]\ntype NodeKeyOf<Node extends t.Node | t.Node[]> = keyof Pick<\n Node,\n {\n [Key in keyof Node]-?: Node[Key] extends t.Node | t.Node[] ? Key : never;\n }[keyof Node]\n>;\n\n// traverse the Node with tuple path [\"body\", \"body\", 1]\n// Path should be created with Split\ntype Trav<\n Node extends t.Node | t.Node[],\n Path extends unknown[],\n> = Path extends [infer K, ...infer R]\n ? K extends NodeKeyOf<Node>\n ? R extends []\n ? Node[K]\n : // @ts-expect-error ignore since TS is not smart enough\n Trav<Node[K], R>\n : never\n : never;\n\ntype ToNodePath<T> = T extends Array<t.Node | null | undefined>\n ? Array<NodePath<T[number]>>\n : T extends t.Node | null | undefined\n ? NodePath<T>\n : never;\n\nfunction get<T extends t.Node, K extends keyof T>(\n this: NodePath<T>,\n key: K,\n context?: boolean | TraversalContext,\n): T[K] extends Array<t.Node | null | undefined>\n ? Array<NodePath<T[K][number]>>\n : T[K] extends t.Node | null | undefined\n ? NodePath<T[K]>\n : never;\n\nfunction get<T extends t.Node, K extends string>(\n this: NodePath<T>,\n key: K,\n context?: boolean | TraversalContext,\n): ToNodePath<Trav<T, Split<K>>>;\n\nfunction get<T extends t.Node>(\n this: NodePath<T>,\n key: string,\n context?: true | TraversalContext,\n): NodePath | NodePath[];\n\nfunction get<T extends t.Node>(\n this: NodePath<T>,\n key: string,\n context: true | TraversalContext = true,\n): NodePath | NodePath[] {\n if (context === true) context = this.context;\n const parts = key.split(\".\");\n if (parts.length === 1) {\n // \"foo\"\n // @ts-expect-error key may not index T\n return this._getKey(key, context);\n } else {\n // \"foo.bar\"\n return this._getPattern(parts, context);\n }\n}\n\nexport { get };\n\nexport function _getKey<T extends t.Node>(\n this: NodePath<T>,\n key: keyof T & string,\n context?: TraversalContext,\n): NodePath | NodePath[] {\n const node = this.node;\n const container = node[key];\n\n if (Array.isArray(container)) {\n // requested a container so give them all the paths\n return container.map((_, i) => {\n return NodePath.get({\n listKey: key,\n parentPath: this,\n parent: node,\n container: container,\n key: i,\n }).setContext(context);\n });\n } else {\n return NodePath.get({\n parentPath: this,\n parent: node,\n container: node,\n key: key,\n }).setContext(context);\n }\n}\n\nexport function _getPattern(\n this: NodePath,\n parts: string[],\n context?: TraversalContext,\n): NodePath | NodePath[] {\n let path: NodePath | NodePath[] = this;\n for (const part of parts) {\n if (part === \".\") {\n // @ts-expect-error todo(flow-ts): Can path be an array here?\n path = path.parentPath;\n } else {\n if (Array.isArray(path)) {\n // @ts-expect-error part may not index path\n path = path[part];\n } else {\n path = path.get(part, context);\n }\n }\n }\n return path;\n}\n\nfunction getBindingIdentifiers(\n duplicates: true,\n): Record<string, t.Identifier[]>;\nfunction getBindingIdentifiers(\n duplicates?: false,\n): Record<string, t.Identifier>;\nfunction getBindingIdentifiers(\n duplicates: boolean,\n): Record<string, t.Identifier[] | t.Identifier>;\n\nfunction getBindingIdentifiers(\n this: NodePath,\n duplicates?: boolean,\n): Record<string, t.Identifier[] | t.Identifier> {\n return _getBindingIdentifiers(this.node, duplicates);\n}\n\nexport { getBindingIdentifiers };\n\nfunction getOuterBindingIdentifiers(\n duplicates: true,\n): Record<string, t.Identifier[]>;\nfunction getOuterBindingIdentifiers(\n duplicates?: false,\n): Record<string, t.Identifier>;\nfunction getOuterBindingIdentifiers(\n duplicates: boolean,\n): Record<string, t.Identifier[] | t.Identifier>;\n\nfunction getOuterBindingIdentifiers(\n this: NodePath,\n duplicates?: boolean,\n): Record<string, t.Identifier[] | t.Identifier> {\n return _getOuterBindingIdentifiers(this.node, duplicates);\n}\n\nexport { getOuterBindingIdentifiers };\n\nfunction getBindingIdentifierPaths(\n duplicates: true,\n outerOnly?: boolean,\n): Record<string, NodePath<t.Identifier>[]>;\nfunction getBindingIdentifierPaths(\n duplicates: false,\n outerOnly?: boolean,\n): Record<string, NodePath<t.Identifier>>;\nfunction getBindingIdentifierPaths(\n duplicates?: boolean,\n outerOnly?: boolean,\n): Record<string, NodePath<t.Identifier> | NodePath<t.Identifier>[]>;\n\n// original source - https://github.com/babel/babel/blob/main/packages/babel-types/src/retrievers/getBindingIdentifiers.js\n// path.getBindingIdentifiers returns nodes where the following re-implementation returns paths\nfunction getBindingIdentifierPaths(\n this: NodePath,\n duplicates: boolean = false,\n outerOnly: boolean = false,\n): Record<string, NodePath<t.Identifier> | NodePath<t.Identifier>[]> {\n const path = this;\n const search = [path];\n const ids = Object.create(null);\n\n while (search.length) {\n const id = search.shift();\n if (!id) continue;\n if (!id.node) continue;\n\n const keys =\n // @ts-expect-error _getBindingIdentifiers.keys do not cover all node types\n _getBindingIdentifiers.keys[id.node.type];\n\n if (id.isIdentifier()) {\n if (duplicates) {\n const _ids = (ids[id.node.name] = ids[id.node.name] || []);\n _ids.push(id);\n } else {\n ids[id.node.name] = id;\n }\n continue;\n }\n\n if (id.isExportDeclaration()) {\n const declaration = id.get(\"declaration\");\n if (isDeclaration(declaration)) {\n search.push(declaration);\n }\n continue;\n }\n\n if (outerOnly) {\n if (id.isFunctionDeclaration()) {\n search.push(id.get(\"id\"));\n continue;\n }\n if (id.isFunctionExpression()) {\n continue;\n }\n }\n\n if (keys) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const child = id.get(key);\n if (Array.isArray(child)) {\n search.push(...child);\n } else if (child.node) {\n search.push(child);\n }\n }\n }\n }\n\n return ids;\n}\n\nexport { getBindingIdentifierPaths };\n\nfunction getOuterBindingIdentifierPaths(\n duplicates: true,\n): Record<string, NodePath<t.Identifier>[]>;\nfunction getOuterBindingIdentifierPaths(\n duplicates?: false,\n): Record<string, NodePath<t.Identifier>>;\nfunction getOuterBindingIdentifierPaths(\n duplicates?: boolean,\n): Record<string, NodePath<t.Identifier> | NodePath<t.Identifier>[]>;\n\nfunction getOuterBindingIdentifierPaths(\n this: NodePath,\n duplicates: boolean = false,\n) {\n return this.getBindingIdentifierPaths(duplicates, true);\n}\n\nexport { getOuterBindingIdentifierPaths };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,EAAA,GAAAD,OAAA;AAMsB;EALpBE,qBAAqB,EAAIC,sBAAsB;EAC/CC,0BAA0B,EAAIC,2BAA2B;EACzDC,aAAa;EACbC,cAAc;EACdC;AAAe,IAAAP,EAAA;AAIjB,MAAMQ,iBAAiB,GAAG,CAAU;AACpC,MAAMC,gBAAgB,GAAG,CAAU;AAmBnC,SAASC,gBAAgBA,CAACC,IAAc,EAAE;EACxC,OAAO;IAAEC,IAAI,EAAEJ,iBAAiB;IAAEG;EAAK,CAAC;AAC1C;AAEA,SAASE,eAAeA,CAACF,IAAc,EAAE;EACvC,OAAO;IAAEC,IAAI,EAAEH,gBAAgB;IAAEE;EAAK,CAAC;AACzC;AAEO,SAASG,WAAWA,CAAA,EAAkC;EAC3D,IAAI,IAAI,CAACC,GAAG,KAAK,MAAM,EAAE;IACvB,OAAO,IAAI,CAACC,UAAU,CAAC,OAAO,CAAC;EACjC,CAAC,MAAM,IAAI,IAAI,CAACD,GAAG,KAAK,OAAO,EAAE;IAC/B,OAAO,IAAI,CAACC,UAAU,CAAC,MAAM,CAAC;EAChC;EACA,OAAO,IAAI;AACb;AAEA,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,IAAI0C,EAAE,CAACS,oBAAoB,CAAC,CAAC,EAAE;QAC7B;MACF;IACF;IAEA,IAAIP,IAAI,EAAE;MACR,KAAK,IAAI3E,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG2E,IAAI,CAAC1E,MAAM,EAAED,CAAC,EAAE,EAAE;QACpC,MAAMV,GAAG,GAAGqF,IAAI,CAAC3E,CAAC,CAAC;QACnB,MAAMmF,KAAK,GAAGV,EAAE,CAAC1C,GAAG,CAACzC,GAAG,CAAC;QACzB,IAAIyE,KAAK,CAACC,OAAO,CAACmB,KAAK,CAAC,EAAE;UACxBb,MAAM,CAAC3E,IAAI,CAAC,GAAGwF,KAAK,CAAC;QACvB,CAAC,MAAM,IAAIA,KAAK,CAAC1B,IAAI,EAAE;UACrBa,MAAM,CAAC3E,IAAI,CAACwF,KAAK,CAAC;QACpB;MACF;IACF;EACF;EAEA,OAAOZ,GAAG;AACZ;AAcA,SAASa,8BAA8BA,CAErCjB,UAAmB,GAAG,KAAK,EAC3B;EACA,OAAO,IAAI,CAACC,yBAAyB,CAACD,UAAU,EAAE,IAAI,CAAC;AACzD"}
|
package/lib/path/index.js
CHANGED
@@ -4,58 +4,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = exports.SHOULD_STOP = exports.SHOULD_SKIP = exports.REMOVED = void 0;
|
7
|
-
|
8
|
-
var virtualTypes = require("./lib/virtual-types");
|
9
|
-
|
7
|
+
var virtualTypes = require("./lib/virtual-types.js");
|
10
8
|
var _debug = require("debug");
|
11
|
-
|
12
|
-
var
|
13
|
-
|
14
|
-
var _scope = require("../scope");
|
15
|
-
|
9
|
+
var _index = require("../index.js");
|
10
|
+
var _index2 = require("../scope/index.js");
|
16
11
|
var _t = require("@babel/types");
|
17
|
-
|
18
12
|
var t = _t;
|
19
|
-
|
20
|
-
var _cache = require("../cache");
|
21
|
-
|
13
|
+
var cache = require("../cache.js");
|
22
14
|
var _generator = require("@babel/generator");
|
23
|
-
|
24
|
-
var
|
25
|
-
|
26
|
-
var
|
27
|
-
|
28
|
-
var
|
29
|
-
|
30
|
-
var
|
31
|
-
|
32
|
-
var
|
33
|
-
|
34
|
-
var
|
35
|
-
|
36
|
-
var NodePath_context = require("./context");
|
37
|
-
|
38
|
-
var NodePath_removal = require("./removal");
|
39
|
-
|
40
|
-
var NodePath_modification = require("./modification");
|
41
|
-
|
42
|
-
var NodePath_family = require("./family");
|
43
|
-
|
44
|
-
var NodePath_comments = require("./comments");
|
45
|
-
|
15
|
+
var NodePath_ancestry = require("./ancestry.js");
|
16
|
+
var NodePath_inference = require("./inference/index.js");
|
17
|
+
var NodePath_replacement = require("./replacement.js");
|
18
|
+
var NodePath_evaluation = require("./evaluation.js");
|
19
|
+
var NodePath_conversion = require("./conversion.js");
|
20
|
+
var NodePath_introspection = require("./introspection.js");
|
21
|
+
var NodePath_context = require("./context.js");
|
22
|
+
var NodePath_removal = require("./removal.js");
|
23
|
+
var NodePath_modification = require("./modification.js");
|
24
|
+
var NodePath_family = require("./family.js");
|
25
|
+
var NodePath_comments = require("./comments.js");
|
26
|
+
var NodePath_virtual_types_validator = require("./lib/virtual-types-validator.js");
|
46
27
|
const {
|
47
28
|
validate
|
48
29
|
} = _t;
|
49
|
-
|
50
30
|
const debug = _debug("babel");
|
51
|
-
|
52
|
-
const
|
53
|
-
exports.
|
54
|
-
const SHOULD_STOP = 1 << 1;
|
55
|
-
exports.SHOULD_STOP = SHOULD_STOP;
|
56
|
-
const SHOULD_SKIP = 1 << 2;
|
57
|
-
exports.SHOULD_SKIP = SHOULD_SKIP;
|
58
|
-
|
31
|
+
const REMOVED = exports.REMOVED = 1 << 0;
|
32
|
+
const SHOULD_STOP = exports.SHOULD_STOP = 1 << 1;
|
33
|
+
const SHOULD_SKIP = exports.SHOULD_SKIP = 1 << 2;
|
59
34
|
class NodePath {
|
60
35
|
constructor(hub, parent) {
|
61
36
|
this.contexts = [];
|
@@ -75,7 +50,6 @@ class NodePath {
|
|
75
50
|
this.context = null;
|
76
51
|
this.scope = null;
|
77
52
|
}
|
78
|
-
|
79
53
|
static get({
|
80
54
|
hub,
|
81
55
|
parentPath,
|
@@ -87,111 +61,80 @@ class NodePath {
|
|
87
61
|
if (!hub && parentPath) {
|
88
62
|
hub = parentPath.hub;
|
89
63
|
}
|
90
|
-
|
91
64
|
if (!parent) {
|
92
65
|
throw new Error("To get a node path the parent needs to exist");
|
93
66
|
}
|
94
|
-
|
95
67
|
const targetNode = container[key];
|
96
|
-
|
97
|
-
let paths = _cache.path.get(parent);
|
98
|
-
|
99
|
-
if (!paths) {
|
100
|
-
paths = new Map();
|
101
|
-
|
102
|
-
_cache.path.set(parent, paths);
|
103
|
-
}
|
104
|
-
|
68
|
+
const paths = cache.getOrCreateCachedPaths(hub, parent);
|
105
69
|
let path = paths.get(targetNode);
|
106
|
-
|
107
70
|
if (!path) {
|
108
71
|
path = new NodePath(hub, parent);
|
109
72
|
if (targetNode) paths.set(targetNode, path);
|
110
73
|
}
|
111
|
-
|
112
74
|
path.setup(parentPath, container, listKey, key);
|
113
75
|
return path;
|
114
76
|
}
|
115
|
-
|
116
77
|
getScope(scope) {
|
117
|
-
return this.isScope() ? new
|
78
|
+
return this.isScope() ? new _index2.default(this) : scope;
|
118
79
|
}
|
119
|
-
|
120
80
|
setData(key, val) {
|
121
81
|
if (this.data == null) {
|
122
82
|
this.data = Object.create(null);
|
123
83
|
}
|
124
|
-
|
125
84
|
return this.data[key] = val;
|
126
85
|
}
|
127
|
-
|
128
86
|
getData(key, def) {
|
129
87
|
if (this.data == null) {
|
130
88
|
this.data = Object.create(null);
|
131
89
|
}
|
132
|
-
|
133
90
|
let val = this.data[key];
|
134
91
|
if (val === undefined && def !== undefined) val = this.data[key] = def;
|
135
92
|
return val;
|
136
93
|
}
|
137
|
-
|
138
94
|
hasNode() {
|
139
95
|
return this.node != null;
|
140
96
|
}
|
141
|
-
|
142
97
|
buildCodeFrameError(msg, Error = SyntaxError) {
|
143
98
|
return this.hub.buildError(this.node, msg, Error);
|
144
99
|
}
|
145
|
-
|
146
100
|
traverse(visitor, state) {
|
147
101
|
(0, _index.default)(this.node, visitor, this.scope, state, this);
|
148
102
|
}
|
149
|
-
|
150
103
|
set(key, node) {
|
151
104
|
validate(this.node, key, node);
|
152
105
|
this.node[key] = node;
|
153
106
|
}
|
154
|
-
|
155
107
|
getPathLocation() {
|
156
108
|
const parts = [];
|
157
109
|
let path = this;
|
158
|
-
|
159
110
|
do {
|
160
111
|
let key = path.key;
|
161
112
|
if (path.inList) key = `${path.listKey}[${key}]`;
|
162
113
|
parts.unshift(key);
|
163
114
|
} while (path = path.parentPath);
|
164
|
-
|
165
115
|
return parts.join(".");
|
166
116
|
}
|
167
|
-
|
168
117
|
debug(message) {
|
169
118
|
if (!debug.enabled) return;
|
170
119
|
debug(`${this.getPathLocation()} ${this.type}: ${message}`);
|
171
120
|
}
|
172
|
-
|
173
121
|
toString() {
|
174
122
|
return (0, _generator.default)(this.node).code;
|
175
123
|
}
|
176
|
-
|
177
124
|
get inList() {
|
178
125
|
return !!this.listKey;
|
179
126
|
}
|
180
|
-
|
181
127
|
set inList(inList) {
|
182
128
|
if (!inList) {
|
183
129
|
this.listKey = null;
|
184
130
|
}
|
185
131
|
}
|
186
|
-
|
187
132
|
get parentKey() {
|
188
133
|
return this.listKey || this.key;
|
189
134
|
}
|
190
|
-
|
191
135
|
get shouldSkip() {
|
192
136
|
return !!(this._traverseFlags & SHOULD_SKIP);
|
193
137
|
}
|
194
|
-
|
195
138
|
set shouldSkip(v) {
|
196
139
|
if (v) {
|
197
140
|
this._traverseFlags |= SHOULD_SKIP;
|
@@ -199,11 +142,9 @@ class NodePath {
|
|
199
142
|
this._traverseFlags &= ~SHOULD_SKIP;
|
200
143
|
}
|
201
144
|
}
|
202
|
-
|
203
145
|
get shouldStop() {
|
204
146
|
return !!(this._traverseFlags & SHOULD_STOP);
|
205
147
|
}
|
206
|
-
|
207
148
|
set shouldStop(v) {
|
208
149
|
if (v) {
|
209
150
|
this._traverseFlags |= SHOULD_STOP;
|
@@ -211,11 +152,9 @@ class NodePath {
|
|
211
152
|
this._traverseFlags &= ~SHOULD_STOP;
|
212
153
|
}
|
213
154
|
}
|
214
|
-
|
215
155
|
get removed() {
|
216
156
|
return !!(this._traverseFlags & REMOVED);
|
217
157
|
}
|
218
|
-
|
219
158
|
set removed(v) {
|
220
159
|
if (v) {
|
221
160
|
this._traverseFlags |= REMOVED;
|
@@ -223,35 +162,28 @@ class NodePath {
|
|
223
162
|
this._traverseFlags &= ~REMOVED;
|
224
163
|
}
|
225
164
|
}
|
226
|
-
|
227
165
|
}
|
228
|
-
|
229
166
|
Object.assign(NodePath.prototype, NodePath_ancestry, NodePath_inference, NodePath_replacement, NodePath_evaluation, NodePath_conversion, NodePath_introspection, NodePath_context, NodePath_removal, NodePath_modification, NodePath_family, NodePath_comments);
|
230
|
-
|
167
|
+
{
|
168
|
+
NodePath.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo;
|
169
|
+
}
|
231
170
|
for (const type of t.TYPES) {
|
232
171
|
const typeKey = `is${type}`;
|
233
172
|
const fn = t[typeKey];
|
234
|
-
|
235
173
|
NodePath.prototype[typeKey] = function (opts) {
|
236
174
|
return fn(this.node, opts);
|
237
175
|
};
|
238
|
-
|
239
176
|
NodePath.prototype[`assert${type}`] = function (opts) {
|
240
177
|
if (!fn(this.node, opts)) {
|
241
178
|
throw new TypeError(`Expected node path of type ${type}`);
|
242
179
|
}
|
243
180
|
};
|
244
181
|
}
|
245
|
-
|
182
|
+
Object.assign(NodePath.prototype, NodePath_virtual_types_validator);
|
246
183
|
for (const type of Object.keys(virtualTypes)) {
|
247
184
|
if (type[0] === "_") continue;
|
248
|
-
if (t.TYPES.
|
249
|
-
const virtualType = virtualTypes[type];
|
250
|
-
|
251
|
-
NodePath.prototype[`is${type}`] = function (opts) {
|
252
|
-
return virtualType.checkPath(this, opts);
|
253
|
-
};
|
185
|
+
if (!t.TYPES.includes(type)) t.TYPES.push(type);
|
254
186
|
}
|
187
|
+
var _default = exports.default = NodePath;
|
255
188
|
|
256
|
-
|
257
|
-
exports.default = _default;
|
189
|
+
//# sourceMappingURL=index.js.map
|