@babel/traverse 7.0.0-beta.46 → 7.0.0-beta.47
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.
Potentially problematic release.
This version of @babel/traverse might be problematic. Click here for more details.
- package/lib/cache.js +2 -2
- package/lib/context.js +34 -38
- package/lib/hub.js +6 -3
- package/lib/index.js +7 -7
- package/lib/path/ancestry.js +25 -31
- package/lib/path/comments.js +8 -8
- package/lib/path/context.js +17 -21
- package/lib/path/conversion.js +119 -126
- package/lib/path/evaluation.js +87 -99
- package/lib/path/family.js +26 -36
- package/lib/path/index.js +59 -77
- package/lib/path/inference/index.js +11 -11
- package/lib/path/inference/inferer-reference.js +36 -38
- package/lib/path/inference/inferers.js +14 -14
- package/lib/path/introspection.js +51 -57
- package/lib/path/lib/hoister.js +48 -50
- package/lib/path/lib/removal-hooks.js +2 -2
- package/lib/path/lib/virtual-types.js +75 -45
- package/lib/path/modification.js +33 -42
- package/lib/path/removal.js +3 -7
- package/lib/path/replacement.js +29 -32
- package/lib/scope/binding.js +20 -22
- package/lib/scope/index.js +271 -284
- package/lib/scope/lib/renamer.js +31 -33
- package/lib/visitors.js +59 -73
- package/package.json +9 -9
package/lib/path/conversion.js
CHANGED
@@ -10,7 +10,7 @@ exports.unwrapFunctionEnvironment = unwrapFunctionEnvironment;
|
|
10
10
|
exports.arrowFunctionToExpression = arrowFunctionToExpression;
|
11
11
|
|
12
12
|
function t() {
|
13
|
-
|
13
|
+
const data = _interopRequireWildcard(require("@babel/types"));
|
14
14
|
|
15
15
|
t = function t() {
|
16
16
|
return data;
|
@@ -20,7 +20,7 @@ function t() {
|
|
20
20
|
}
|
21
21
|
|
22
22
|
function _helperFunctionName() {
|
23
|
-
|
23
|
+
const data = _interopRequireDefault(require("@babel/helper-function-name"));
|
24
24
|
|
25
25
|
_helperFunctionName = function _helperFunctionName() {
|
26
26
|
return data;
|
@@ -34,8 +34,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
34
34
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
35
35
|
|
36
36
|
function toComputedKey() {
|
37
|
-
|
38
|
-
|
37
|
+
const node = this.node;
|
38
|
+
let key;
|
39
39
|
|
40
40
|
if (this.isMemberExpression()) {
|
41
41
|
key = node.property;
|
@@ -53,8 +53,8 @@ function toComputedKey() {
|
|
53
53
|
}
|
54
54
|
|
55
55
|
function ensureBlock() {
|
56
|
-
|
57
|
-
|
56
|
+
const body = this.get("body");
|
57
|
+
const bodyNode = body.node;
|
58
58
|
|
59
59
|
if (Array.isArray(body)) {
|
60
60
|
throw new Error("Can't convert array path to a block statement");
|
@@ -68,10 +68,10 @@ function ensureBlock() {
|
|
68
68
|
return bodyNode;
|
69
69
|
}
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
const statements = [];
|
72
|
+
let stringPath = "body";
|
73
|
+
let key;
|
74
|
+
let listKey;
|
75
75
|
|
76
76
|
if (body.isStatement()) {
|
77
77
|
listKey = "body";
|
@@ -90,7 +90,7 @@ function ensureBlock() {
|
|
90
90
|
}
|
91
91
|
|
92
92
|
this.node.body = t().blockStatement(statements);
|
93
|
-
|
93
|
+
const parentPath = this.get(stringPath);
|
94
94
|
body.setup(parentPath, listKey ? parentPath.node[listKey] : parentPath.node, listKey, key);
|
95
95
|
return this.node;
|
96
96
|
}
|
@@ -108,23 +108,20 @@ function unwrapFunctionEnvironment() {
|
|
108
108
|
hoistFunctionEnvironment(this);
|
109
109
|
}
|
110
110
|
|
111
|
-
function arrowFunctionToExpression(
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
_ref$specCompliant = _ref.specCompliant,
|
116
|
-
specCompliant = _ref$specCompliant === void 0 ? false : _ref$specCompliant;
|
117
|
-
|
111
|
+
function arrowFunctionToExpression({
|
112
|
+
allowInsertArrow = true,
|
113
|
+
specCompliant = false
|
114
|
+
} = {}) {
|
118
115
|
if (!this.isArrowFunctionExpression()) {
|
119
116
|
throw this.buildCodeFrameError("Cannot convert non-arrow function to a function expression.");
|
120
117
|
}
|
121
118
|
|
122
|
-
|
119
|
+
const thisBinding = hoistFunctionEnvironment(this, specCompliant, allowInsertArrow);
|
123
120
|
this.ensureBlock();
|
124
121
|
this.node.type = "FunctionExpression";
|
125
122
|
|
126
123
|
if (specCompliant) {
|
127
|
-
|
124
|
+
const checkBinding = thisBinding ? null : this.parentPath.scope.generateUidIdentifier("arrowCheckId");
|
128
125
|
|
129
126
|
if (checkBinding) {
|
130
127
|
this.parentPath.scope.push({
|
@@ -138,69 +135,64 @@ function arrowFunctionToExpression(_temp) {
|
|
138
135
|
}
|
139
136
|
}
|
140
137
|
|
141
|
-
function hoistFunctionEnvironment(fnPath, specCompliant, allowInsertArrow) {
|
142
|
-
|
143
|
-
specCompliant = false;
|
144
|
-
}
|
145
|
-
|
146
|
-
if (allowInsertArrow === void 0) {
|
147
|
-
allowInsertArrow = true;
|
148
|
-
}
|
149
|
-
|
150
|
-
var thisEnvFn = fnPath.findParent(function (p) {
|
138
|
+
function hoistFunctionEnvironment(fnPath, specCompliant = false, allowInsertArrow = true) {
|
139
|
+
const thisEnvFn = fnPath.findParent(p => {
|
151
140
|
return p.isFunction() && !p.isArrowFunctionExpression() || p.isProgram() || p.isClassProperty({
|
152
141
|
static: false
|
153
142
|
});
|
154
143
|
});
|
155
|
-
|
144
|
+
const inConstructor = thisEnvFn && thisEnvFn.node.kind === "constructor";
|
156
145
|
|
157
146
|
if (thisEnvFn.isClassProperty()) {
|
158
147
|
throw fnPath.buildCodeFrameError("Unable to transform arrow inside class property");
|
159
148
|
}
|
160
149
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
150
|
+
const _getScopeInformation = getScopeInformation(fnPath),
|
151
|
+
thisPaths = _getScopeInformation.thisPaths,
|
152
|
+
argumentsPaths = _getScopeInformation.argumentsPaths,
|
153
|
+
newTargetPaths = _getScopeInformation.newTargetPaths,
|
154
|
+
superProps = _getScopeInformation.superProps,
|
155
|
+
superCalls = _getScopeInformation.superCalls;
|
167
156
|
|
168
157
|
if (inConstructor && superCalls.length > 0) {
|
169
158
|
if (!allowInsertArrow) {
|
170
159
|
throw superCalls[0].buildCodeFrameError("Unable to handle nested super() usage in arrow");
|
171
160
|
}
|
172
161
|
|
173
|
-
|
162
|
+
const allSuperCalls = [];
|
174
163
|
thisEnvFn.traverse({
|
175
|
-
Function
|
164
|
+
Function(child) {
|
176
165
|
if (child.isArrowFunctionExpression()) return;
|
177
166
|
child.skip();
|
178
167
|
},
|
179
|
-
|
168
|
+
|
169
|
+
ClassProperty(child) {
|
180
170
|
if (child.node.static) return;
|
181
171
|
child.skip();
|
182
172
|
},
|
183
|
-
|
173
|
+
|
174
|
+
CallExpression(child) {
|
184
175
|
if (!child.get("callee").isSuper()) return;
|
185
176
|
allSuperCalls.push(child);
|
186
177
|
}
|
178
|
+
|
187
179
|
});
|
188
|
-
|
189
|
-
allSuperCalls.forEach(
|
190
|
-
|
180
|
+
const superBinding = getSuperBinding(thisEnvFn);
|
181
|
+
allSuperCalls.forEach(superCall => {
|
182
|
+
const callee = t().identifier(superBinding);
|
191
183
|
callee.loc = superCall.node.callee.loc;
|
192
184
|
superCall.get("callee").replaceWith(callee);
|
193
185
|
});
|
194
186
|
}
|
195
187
|
|
196
|
-
|
188
|
+
let thisBinding;
|
197
189
|
|
198
190
|
if (thisPaths.length > 0 || specCompliant) {
|
199
191
|
thisBinding = getThisBinding(thisEnvFn, inConstructor);
|
200
192
|
|
201
193
|
if (!specCompliant || inConstructor && hasSuperClass(thisEnvFn)) {
|
202
|
-
thisPaths.forEach(
|
203
|
-
|
194
|
+
thisPaths.forEach(thisChild => {
|
195
|
+
const thisRef = thisChild.isJSX() ? t().jsxIdentifier(thisBinding) : t().identifier(thisBinding);
|
204
196
|
thisRef.loc = thisChild.node.loc;
|
205
197
|
thisChild.replaceWith(thisRef);
|
206
198
|
});
|
@@ -209,22 +201,18 @@ function hoistFunctionEnvironment(fnPath, specCompliant, allowInsertArrow) {
|
|
209
201
|
}
|
210
202
|
|
211
203
|
if (argumentsPaths.length > 0) {
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
argumentsPaths.forEach(function (argumentsChild) {
|
216
|
-
var argsRef = t().identifier(argumentsBinding);
|
204
|
+
const argumentsBinding = getBinding(thisEnvFn, "arguments", () => t().identifier("arguments"));
|
205
|
+
argumentsPaths.forEach(argumentsChild => {
|
206
|
+
const argsRef = t().identifier(argumentsBinding);
|
217
207
|
argsRef.loc = argumentsChild.node.loc;
|
218
208
|
argumentsChild.replaceWith(argsRef);
|
219
209
|
});
|
220
210
|
}
|
221
211
|
|
222
212
|
if (newTargetPaths.length > 0) {
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
newTargetPaths.forEach(function (targetChild) {
|
227
|
-
var targetRef = t().identifier(newTargetBinding);
|
213
|
+
const newTargetBinding = getBinding(thisEnvFn, "newtarget", () => t().metaProperty(t().identifier("new"), t().identifier("target")));
|
214
|
+
newTargetPaths.forEach(targetChild => {
|
215
|
+
const targetRef = t().identifier(newTargetBinding);
|
228
216
|
targetRef.loc = targetChild.node.loc;
|
229
217
|
targetChild.replaceWith(targetRef);
|
230
218
|
});
|
@@ -235,43 +223,39 @@ function hoistFunctionEnvironment(fnPath, specCompliant, allowInsertArrow) {
|
|
235
223
|
throw superProps[0].buildCodeFrameError("Unable to handle nested super.prop usage");
|
236
224
|
}
|
237
225
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
flatSuperProps.forEach(function (superProp) {
|
242
|
-
var key = superProp.node.computed ? "" : superProp.get("property").node.name;
|
226
|
+
const flatSuperProps = superProps.reduce((acc, superProp) => acc.concat(standardizeSuperProperty(superProp)), []);
|
227
|
+
flatSuperProps.forEach(superProp => {
|
228
|
+
const key = superProp.node.computed ? "" : superProp.get("property").node.name;
|
243
229
|
|
244
230
|
if (superProp.parentPath.isCallExpression({
|
245
231
|
callee: superProp.node
|
246
232
|
})) {
|
247
|
-
|
233
|
+
const superBinding = getSuperPropCallBinding(thisEnvFn, key);
|
248
234
|
|
249
235
|
if (superProp.node.computed) {
|
250
|
-
|
251
|
-
superProp.replaceWith(t().identifier(
|
236
|
+
const prop = superProp.get("property").node;
|
237
|
+
superProp.replaceWith(t().identifier(superBinding));
|
252
238
|
superProp.parentPath.node.arguments.unshift(prop);
|
253
239
|
} else {
|
254
|
-
superProp.replaceWith(t().identifier(
|
240
|
+
superProp.replaceWith(t().identifier(superBinding));
|
255
241
|
}
|
256
242
|
} else {
|
257
|
-
|
243
|
+
const isAssignment = superProp.parentPath.isAssignmentExpression({
|
258
244
|
left: superProp.node
|
259
245
|
});
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
var args = [];
|
246
|
+
const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key);
|
247
|
+
const args = [];
|
264
248
|
|
265
249
|
if (superProp.node.computed) {
|
266
250
|
args.push(superProp.get("property").node);
|
267
251
|
}
|
268
252
|
|
269
253
|
if (isAssignment) {
|
270
|
-
|
254
|
+
const value = superProp.parentPath.node.right;
|
271
255
|
args.push(value);
|
272
|
-
superProp.parentPath.replaceWith(t().callExpression(t().identifier(
|
256
|
+
superProp.parentPath.replaceWith(t().callExpression(t().identifier(superBinding), args));
|
273
257
|
} else {
|
274
|
-
superProp.replaceWith(t().callExpression(t().identifier(
|
258
|
+
superProp.replaceWith(t().callExpression(t().identifier(superBinding), args));
|
275
259
|
}
|
276
260
|
}
|
277
261
|
});
|
@@ -282,13 +266,13 @@ function hoistFunctionEnvironment(fnPath, specCompliant, allowInsertArrow) {
|
|
282
266
|
|
283
267
|
function standardizeSuperProperty(superProp) {
|
284
268
|
if (superProp.parentPath.isAssignmentExpression() && superProp.parentPath.node.operator !== "=") {
|
285
|
-
|
286
|
-
|
287
|
-
|
269
|
+
const assignmentPath = superProp.parentPath;
|
270
|
+
const op = assignmentPath.node.operator.slice(0, -1);
|
271
|
+
const value = assignmentPath.node.right;
|
288
272
|
assignmentPath.node.operator = "=";
|
289
273
|
|
290
274
|
if (superProp.node.computed) {
|
291
|
-
|
275
|
+
const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp");
|
292
276
|
assignmentPath.get("left").replaceWith(t().memberExpression(superProp.node.object, t().assignmentExpression("=", tmp, superProp.node.property), true));
|
293
277
|
assignmentPath.get("right").replaceWith(t().binaryExpression(op, t().memberExpression(superProp.node.object, t().identifier(tmp.name), true), value));
|
294
278
|
} else {
|
@@ -298,20 +282,18 @@ function standardizeSuperProperty(superProp) {
|
|
298
282
|
|
299
283
|
return [assignmentPath.get("left"), assignmentPath.get("right").get("left")];
|
300
284
|
} else if (superProp.parentPath.isUpdateExpression()) {
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
var computedKey = superProp.node.computed ? superProp.scope.generateDeclaredUidIdentifier("prop") : null;
|
306
|
-
var parts = [t().assignmentExpression("=", _tmp, t().memberExpression(superProp.node.object, computedKey ? t().assignmentExpression("=", computedKey, superProp.node.property) : superProp.node.property, superProp.node.computed)), t().assignmentExpression("=", t().memberExpression(superProp.node.object, computedKey ? t().identifier(computedKey.name) : superProp.node.property, superProp.node.computed), t().binaryExpression("+", t().identifier(_tmp.name), t().numericLiteral(1)))];
|
285
|
+
const updateExpr = superProp.parentPath;
|
286
|
+
const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp");
|
287
|
+
const computedKey = superProp.node.computed ? superProp.scope.generateDeclaredUidIdentifier("prop") : null;
|
288
|
+
const parts = [t().assignmentExpression("=", tmp, t().memberExpression(superProp.node.object, computedKey ? t().assignmentExpression("=", computedKey, superProp.node.property) : superProp.node.property, superProp.node.computed)), t().assignmentExpression("=", t().memberExpression(superProp.node.object, computedKey ? t().identifier(computedKey.name) : superProp.node.property, superProp.node.computed), t().binaryExpression("+", t().identifier(tmp.name), t().numericLiteral(1)))];
|
307
289
|
|
308
290
|
if (!superProp.parentPath.node.prefix) {
|
309
|
-
parts.push(t().identifier(
|
291
|
+
parts.push(t().identifier(tmp.name));
|
310
292
|
}
|
311
293
|
|
312
294
|
updateExpr.replaceWith(t().sequenceExpression(parts));
|
313
|
-
|
314
|
-
|
295
|
+
const left = updateExpr.get("expressions.0.right");
|
296
|
+
const right = updateExpr.get("expressions.1.left");
|
315
297
|
return [left, right];
|
316
298
|
}
|
317
299
|
|
@@ -323,45 +305,48 @@ function hasSuperClass(thisEnvFn) {
|
|
323
305
|
}
|
324
306
|
|
325
307
|
function getThisBinding(thisEnvFn, inConstructor) {
|
326
|
-
return getBinding(thisEnvFn, "this",
|
308
|
+
return getBinding(thisEnvFn, "this", thisBinding => {
|
327
309
|
if (!inConstructor || !hasSuperClass(thisEnvFn)) return t().thisExpression();
|
328
|
-
|
310
|
+
const supers = new WeakSet();
|
329
311
|
thisEnvFn.traverse({
|
330
|
-
Function
|
312
|
+
Function(child) {
|
331
313
|
if (child.isArrowFunctionExpression()) return;
|
332
314
|
child.skip();
|
333
315
|
},
|
334
|
-
|
316
|
+
|
317
|
+
ClassProperty(child) {
|
335
318
|
if (child.node.static) return;
|
336
319
|
child.skip();
|
337
320
|
},
|
338
|
-
|
321
|
+
|
322
|
+
CallExpression(child) {
|
339
323
|
if (!child.get("callee").isSuper()) return;
|
340
324
|
if (supers.has(child.node)) return;
|
341
325
|
supers.add(child.node);
|
342
326
|
child.replaceWith(t().assignmentExpression("=", t().identifier(thisBinding), child.node));
|
343
327
|
}
|
328
|
+
|
344
329
|
});
|
345
330
|
});
|
346
331
|
}
|
347
332
|
|
348
333
|
function getSuperBinding(thisEnvFn) {
|
349
|
-
return getBinding(thisEnvFn, "supercall",
|
350
|
-
|
334
|
+
return getBinding(thisEnvFn, "supercall", () => {
|
335
|
+
const argsBinding = thisEnvFn.scope.generateUidIdentifier("args");
|
351
336
|
return t().arrowFunctionExpression([t().restElement(argsBinding)], t().callExpression(t().super(), [t().spreadElement(t().identifier(argsBinding.name))]));
|
352
337
|
});
|
353
338
|
}
|
354
339
|
|
355
340
|
function getSuperPropCallBinding(thisEnvFn, propName) {
|
356
|
-
return getBinding(thisEnvFn,
|
357
|
-
|
358
|
-
|
359
|
-
|
341
|
+
return getBinding(thisEnvFn, `superprop_call:${propName || ""}`, () => {
|
342
|
+
const argsBinding = thisEnvFn.scope.generateUidIdentifier("args");
|
343
|
+
const argsList = [t().restElement(argsBinding)];
|
344
|
+
let fnBody;
|
360
345
|
|
361
346
|
if (propName) {
|
362
347
|
fnBody = t().callExpression(t().memberExpression(t().super(), t().identifier(propName)), [t().spreadElement(t().identifier(argsBinding.name))]);
|
363
348
|
} else {
|
364
|
-
|
349
|
+
const method = thisEnvFn.scope.generateUidIdentifier("prop");
|
365
350
|
argsList.unshift(method);
|
366
351
|
fnBody = t().callExpression(t().memberExpression(t().super(), t().identifier(method.name), true), [t().spreadElement(t().identifier(argsBinding.name))]);
|
367
352
|
}
|
@@ -371,21 +356,21 @@ function getSuperPropCallBinding(thisEnvFn, propName) {
|
|
371
356
|
}
|
372
357
|
|
373
358
|
function getSuperPropBinding(thisEnvFn, isAssignment, propName) {
|
374
|
-
|
375
|
-
return getBinding(thisEnvFn,
|
376
|
-
|
377
|
-
|
359
|
+
const op = isAssignment ? "set" : "get";
|
360
|
+
return getBinding(thisEnvFn, `superprop_${op}:${propName || ""}`, () => {
|
361
|
+
const argsList = [];
|
362
|
+
let fnBody;
|
378
363
|
|
379
364
|
if (propName) {
|
380
365
|
fnBody = t().memberExpression(t().super(), t().identifier(propName));
|
381
366
|
} else {
|
382
|
-
|
367
|
+
const method = thisEnvFn.scope.generateUidIdentifier("prop");
|
383
368
|
argsList.unshift(method);
|
384
369
|
fnBody = t().memberExpression(t().super(), t().identifier(method.name), true);
|
385
370
|
}
|
386
371
|
|
387
372
|
if (isAssignment) {
|
388
|
-
|
373
|
+
const valueIdent = thisEnvFn.scope.generateUidIdentifier("value");
|
389
374
|
argsList.push(valueIdent);
|
390
375
|
fnBody = t().assignmentExpression("=", fnBody, t().identifier(valueIdent.name));
|
391
376
|
}
|
@@ -395,11 +380,11 @@ function getSuperPropBinding(thisEnvFn, isAssignment, propName) {
|
|
395
380
|
}
|
396
381
|
|
397
382
|
function getBinding(thisEnvFn, key, init) {
|
398
|
-
|
399
|
-
|
383
|
+
const cacheKey = "binding:" + key;
|
384
|
+
let data = thisEnvFn.getData(cacheKey);
|
400
385
|
|
401
386
|
if (!data) {
|
402
|
-
|
387
|
+
const id = thisEnvFn.scope.generateUidIdentifier(key);
|
403
388
|
data = id.name;
|
404
389
|
thisEnvFn.setData(cacheKey, data);
|
405
390
|
thisEnvFn.scope.push({
|
@@ -412,24 +397,27 @@ function getBinding(thisEnvFn, key, init) {
|
|
412
397
|
}
|
413
398
|
|
414
399
|
function getScopeInformation(fnPath) {
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
400
|
+
const thisPaths = [];
|
401
|
+
const argumentsPaths = [];
|
402
|
+
const newTargetPaths = [];
|
403
|
+
const superProps = [];
|
404
|
+
const superCalls = [];
|
420
405
|
fnPath.traverse({
|
421
|
-
ClassProperty
|
406
|
+
ClassProperty(child) {
|
422
407
|
if (child.node.static) return;
|
423
408
|
child.skip();
|
424
409
|
},
|
425
|
-
|
410
|
+
|
411
|
+
Function(child) {
|
426
412
|
if (child.isArrowFunctionExpression()) return;
|
427
413
|
child.skip();
|
428
414
|
},
|
429
|
-
|
415
|
+
|
416
|
+
ThisExpression(child) {
|
430
417
|
thisPaths.push(child);
|
431
418
|
},
|
432
|
-
|
419
|
+
|
420
|
+
JSXIdentifier(child) {
|
433
421
|
if (child.node.name !== "this") return;
|
434
422
|
|
435
423
|
if (!child.parentPath.isJSXMemberExpression({
|
@@ -442,17 +430,21 @@ function getScopeInformation(fnPath) {
|
|
442
430
|
|
443
431
|
thisPaths.push(child);
|
444
432
|
},
|
445
|
-
|
433
|
+
|
434
|
+
CallExpression(child) {
|
446
435
|
if (child.get("callee").isSuper()) superCalls.push(child);
|
447
436
|
},
|
448
|
-
|
437
|
+
|
438
|
+
MemberExpression(child) {
|
449
439
|
if (child.get("object").isSuper()) superProps.push(child);
|
450
440
|
},
|
451
|
-
|
441
|
+
|
442
|
+
ReferencedIdentifier(child) {
|
452
443
|
if (child.node.name !== "arguments") return;
|
453
444
|
argumentsPaths.push(child);
|
454
445
|
},
|
455
|
-
|
446
|
+
|
447
|
+
MetaProperty(child) {
|
456
448
|
if (!child.get("meta").isIdentifier({
|
457
449
|
name: "new"
|
458
450
|
})) return;
|
@@ -461,12 +453,13 @@ function getScopeInformation(fnPath) {
|
|
461
453
|
})) return;
|
462
454
|
newTargetPaths.push(child);
|
463
455
|
}
|
456
|
+
|
464
457
|
});
|
465
458
|
return {
|
466
|
-
thisPaths
|
467
|
-
argumentsPaths
|
468
|
-
newTargetPaths
|
469
|
-
superProps
|
470
|
-
superCalls
|
459
|
+
thisPaths,
|
460
|
+
argumentsPaths,
|
461
|
+
newTargetPaths,
|
462
|
+
superProps,
|
463
|
+
superCalls
|
471
464
|
};
|
472
465
|
}
|