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