@babel/traverse 7.20.0 → 7.20.5

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.

Files changed (57) hide show
  1. package/lib/cache.js +0 -3
  2. package/lib/cache.js.map +1 -1
  3. package/lib/context.js +7 -21
  4. package/lib/context.js.map +1 -1
  5. package/lib/hub.js +0 -6
  6. package/lib/hub.js.map +1 -1
  7. package/lib/index.js +3 -21
  8. package/lib/index.js.map +1 -1
  9. package/lib/path/ancestry.js +3 -23
  10. package/lib/path/ancestry.js.map +1 -1
  11. package/lib/path/comments.js +0 -4
  12. package/lib/path/comments.js.map +1 -1
  13. package/lib/path/context.js +14 -54
  14. package/lib/path/context.js.map +1 -1
  15. package/lib/path/conversion.js +23 -78
  16. package/lib/path/conversion.js.map +1 -1
  17. package/lib/path/evaluation.js +9 -85
  18. package/lib/path/evaluation.js.map +1 -1
  19. package/lib/path/family.js +6 -73
  20. package/lib/path/family.js.map +1 -1
  21. package/lib/path/index.js +2 -61
  22. package/lib/path/index.js.map +1 -1
  23. package/lib/path/inference/index.js +2 -27
  24. package/lib/path/inference/index.js.map +1 -1
  25. package/lib/path/inference/inferer-reference.js +10 -31
  26. package/lib/path/inference/inferer-reference.js.map +1 -1
  27. package/lib/path/inference/inferers.js +4 -44
  28. package/lib/path/inference/inferers.js.map +1 -1
  29. package/lib/path/inference/util.js +0 -4
  30. package/lib/path/inference/util.js.map +1 -1
  31. package/lib/path/introspection.js +17 -59
  32. package/lib/path/introspection.js.map +1 -1
  33. package/lib/path/lib/hoister.js +7 -23
  34. package/lib/path/lib/hoister.js.map +1 -1
  35. package/lib/path/lib/removal-hooks.js +7 -3
  36. package/lib/path/lib/removal-hooks.js.map +1 -1
  37. package/lib/path/lib/virtual-types-validator.js +0 -23
  38. package/lib/path/lib/virtual-types-validator.js.map +1 -1
  39. package/lib/path/lib/virtual-types.js +1 -0
  40. package/lib/path/lib/virtual-types.js.map +1 -1
  41. package/lib/path/modification.js +12 -47
  42. package/lib/path/modification.js.map +1 -1
  43. package/lib/path/removal.js +0 -16
  44. package/lib/path/removal.js.map +1 -1
  45. package/lib/path/replacement.js +8 -50
  46. package/lib/path/replacement.js.map +1 -1
  47. package/lib/scope/binding.js +2 -14
  48. package/lib/scope/binding.js.map +1 -1
  49. package/lib/scope/index.js +19 -184
  50. package/lib/scope/index.js.map +1 -1
  51. package/lib/scope/lib/renamer.js +2 -25
  52. package/lib/scope/lib/renamer.js.map +1 -1
  53. package/lib/traverse-node.js +0 -7
  54. package/lib/traverse-node.js.map +1 -1
  55. package/lib/visitors.js +13 -44
  56. package/lib/visitors.js.map +1 -1
  57. package/package.json +4 -4
@@ -8,15 +8,10 @@ exports.arrowFunctionToShadowed = arrowFunctionToShadowed;
8
8
  exports.ensureBlock = ensureBlock;
9
9
  exports.toComputedKey = toComputedKey;
10
10
  exports.unwrapFunctionEnvironment = unwrapFunctionEnvironment;
11
-
12
11
  var _t = require("@babel/types");
13
-
14
12
  var _helperEnvironmentVisitor = require("@babel/helper-environment-visitor");
15
-
16
13
  var _helperFunctionName = require("@babel/helper-function-name");
17
-
18
14
  var _visitors = require("../visitors");
19
-
20
15
  const {
21
16
  arrowFunctionExpression,
22
17
  assignmentExpression,
@@ -44,10 +39,8 @@ const {
44
39
  toExpression,
45
40
  unaryExpression
46
41
  } = _t;
47
-
48
42
  function toComputedKey() {
49
43
  let key;
50
-
51
44
  if (this.isMemberExpression()) {
52
45
  key = this.node.property;
53
46
  } else if (this.isProperty() || this.isMethod()) {
@@ -59,38 +52,30 @@ function toComputedKey() {
59
52
  if (!this.node.computed) {
60
53
  if (isIdentifier(key)) key = stringLiteral(key.name);
61
54
  }
62
-
63
55
  return key;
64
56
  }
65
-
66
57
  function ensureBlock() {
67
58
  const body = this.get("body");
68
59
  const bodyNode = body.node;
69
-
70
60
  if (Array.isArray(body)) {
71
61
  throw new Error("Can't convert array path to a block statement");
72
62
  }
73
-
74
63
  if (!bodyNode) {
75
64
  throw new Error("Can't convert node without a body");
76
65
  }
77
-
78
66
  if (body.isBlockStatement()) {
79
67
  return bodyNode;
80
68
  }
81
-
82
69
  const statements = [];
83
70
  let stringPath = "body";
84
71
  let key;
85
72
  let listKey;
86
-
87
73
  if (body.isStatement()) {
88
74
  listKey = "body";
89
75
  key = 0;
90
76
  statements.push(body.node);
91
77
  } else {
92
78
  stringPath += ".body.0";
93
-
94
79
  if (this.isFunction()) {
95
80
  key = "argument";
96
81
  statements.push(returnStatement(body.node));
@@ -99,10 +84,10 @@ function ensureBlock() {
99
84
  statements.push(expressionStatement(body.node));
100
85
  }
101
86
  }
102
-
103
87
  this.node.body = blockStatement(statements);
104
88
  const parentPath = this.get(stringPath);
105
- body.setup(parentPath, listKey ? parentPath.node[listKey] : parentPath.node, listKey, key);
89
+ body.setup(parentPath, listKey ?
90
+ parentPath.node[listKey] : parentPath.node, listKey, key);
106
91
  return this.node;
107
92
  }
108
93
 
@@ -115,48 +100,43 @@ function unwrapFunctionEnvironment() {
115
100
  if (!this.isArrowFunctionExpression() && !this.isFunctionExpression() && !this.isFunctionDeclaration()) {
116
101
  throw this.buildCodeFrameError("Can only unwrap the environment of a function.");
117
102
  }
118
-
119
103
  hoistFunctionEnvironment(this);
120
104
  }
121
-
122
105
  function setType(path, type) {
123
106
  path.node.type = type;
124
107
  }
125
108
 
126
109
  function arrowFunctionToExpression({
127
110
  allowInsertArrow = true,
111
+ allowInsertArrowWithRest = allowInsertArrow,
128
112
  specCompliant = false,
129
113
  noNewArrows = !specCompliant
130
114
  } = {}) {
131
115
  if (!this.isArrowFunctionExpression()) {
132
116
  throw this.buildCodeFrameError("Cannot convert non-arrow function to a function expression.");
133
117
  }
134
-
135
118
  const {
136
119
  thisBinding,
137
120
  fnPath: fn
138
- } = hoistFunctionEnvironment(this, noNewArrows, allowInsertArrow);
121
+ } = hoistFunctionEnvironment(this, noNewArrows, allowInsertArrow, allowInsertArrowWithRest);
122
+
139
123
  fn.ensureBlock();
140
124
  setType(fn, "FunctionExpression");
141
-
142
125
  if (!noNewArrows) {
143
126
  const checkBinding = thisBinding ? null : fn.scope.generateUidIdentifier("arrowCheckId");
144
-
145
127
  if (checkBinding) {
146
128
  fn.parentPath.scope.push({
147
129
  id: checkBinding,
148
130
  init: objectExpression([])
149
131
  });
150
132
  }
151
-
152
133
  fn.get("body").unshiftContainer("body", expressionStatement(callExpression(this.hub.addHelper("newArrowCheck"), [thisExpression(), checkBinding ? identifier(checkBinding.name) : identifier(thisBinding)])));
153
- fn.replaceWith(callExpression(memberExpression((0, _helperFunctionName.default)(this, true) || fn.node, identifier("bind")), [checkBinding ? identifier(checkBinding.name) : thisExpression()]));
134
+ fn.replaceWith(callExpression(memberExpression(
135
+ (0, _helperFunctionName.default)(this, true) || fn.node, identifier("bind")), [checkBinding ? identifier(checkBinding.name) : thisExpression()]));
154
136
  return fn.get("callee.object");
155
137
  }
156
-
157
138
  return fn;
158
139
  }
159
-
160
140
  const getSuperCallsVisitor = (0, _visitors.merge)([{
161
141
  CallExpression(child, {
162
142
  allSuperCalls
@@ -164,19 +144,17 @@ const getSuperCallsVisitor = (0, _visitors.merge)([{
164
144
  if (!child.get("callee").isSuper()) return;
165
145
  allSuperCalls.push(child);
166
146
  }
167
-
168
147
  }, _helperEnvironmentVisitor.default]);
169
148
 
170
- function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow = true) {
149
+ function hoistFunctionEnvironment(fnPath,
150
+ noNewArrows = true, allowInsertArrow = true, allowInsertArrowWithRest = true) {
171
151
  let arrowParent;
172
152
  let thisEnvFn = fnPath.findParent(p => {
173
153
  if (p.isArrowFunctionExpression()) {
174
154
  var _arrowParent;
175
-
176
155
  (_arrowParent = arrowParent) != null ? _arrowParent : arrowParent = p;
177
156
  return false;
178
157
  }
179
-
180
158
  return p.isFunction() || p.isProgram() || p.isClassProperty({
181
159
  static: false
182
160
  }) || p.isClassPrivateProperty({
@@ -186,7 +164,6 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
186
164
  const inConstructor = thisEnvFn.isClassMethod({
187
165
  kind: "constructor"
188
166
  });
189
-
190
167
  if (thisEnvFn.isClassProperty() || thisEnvFn.isClassPrivateProperty()) {
191
168
  if (arrowParent) {
192
169
  thisEnvFn = arrowParent;
@@ -198,7 +175,6 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
198
175
  throw fnPath.buildCodeFrameError("Unable to transform arrow inside class property");
199
176
  }
200
177
  }
201
-
202
178
  const {
203
179
  thisPaths,
204
180
  argumentsPaths,
@@ -209,9 +185,11 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
209
185
 
210
186
  if (inConstructor && superCalls.length > 0) {
211
187
  if (!allowInsertArrow) {
212
- throw superCalls[0].buildCodeFrameError("Unable to handle nested super() usage in arrow");
188
+ throw superCalls[0].buildCodeFrameError("When using '@babel/plugin-transform-arrow-functions', " + "it's not possible to compile `super()` in an arrow function without compiling classes.\n" + "Please add '@babel/plugin-transform-classes' to your Babel configuration.");
189
+ }
190
+ if (!allowInsertArrowWithRest) {
191
+ throw superCalls[0].buildCodeFrameError("When using '@babel/plugin-transform-parameters', " + "it's not possible to compile `super()` in an arrow function with default or rest parameters without compiling classes.\n" + "Please add '@babel/plugin-transform-classes' to your Babel configuration.");
213
192
  }
214
-
215
193
  const allSuperCalls = [];
216
194
  thisEnvFn.traverse(getSuperCallsVisitor, {
217
195
  allSuperCalls
@@ -227,7 +205,6 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
227
205
  if (argumentsPaths.length > 0) {
228
206
  const argumentsBinding = getBinding(thisEnvFn, "arguments", () => {
229
207
  const args = () => identifier("arguments");
230
-
231
208
  if (thisEnvFn.scope.path.isProgram()) {
232
209
  return conditionalExpression(binaryExpression("===", unaryExpression("typeof", args()), stringLiteral("undefined")), thisEnvFn.scope.buildUndefinedNode(), args());
233
210
  } else {
@@ -252,12 +229,12 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
252
229
 
253
230
  if (superProps.length > 0) {
254
231
  if (!allowInsertArrow) {
255
- throw superProps[0].buildCodeFrameError("Unable to handle nested super.prop usage");
232
+ throw superProps[0].buildCodeFrameError("When using '@babel/plugin-transform-arrow-functions', " + "it's not possible to compile `super.prop` in an arrow function without compiling classes.\n" + "Please add '@babel/plugin-transform-classes' to your Babel configuration.");
256
233
  }
257
-
258
234
  const flatSuperProps = superProps.reduce((acc, superProp) => acc.concat(standardizeSuperProperty(superProp)), []);
259
235
  flatSuperProps.forEach(superProp => {
260
- const key = superProp.node.computed ? "" : superProp.get("property").node.name;
236
+ const key = superProp.node.computed ? "" :
237
+ superProp.get("property").node.name;
261
238
  const superParentPath = superProp.parentPath;
262
239
  const isAssignment = superParentPath.isAssignmentExpression({
263
240
  left: superProp.node
@@ -270,18 +247,14 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
270
247
  });
271
248
  const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key);
272
249
  const args = [];
273
-
274
250
  if (superProp.node.computed) {
275
251
  args.push(superProp.get("property").node);
276
252
  }
277
-
278
253
  if (isAssignment) {
279
254
  const value = superParentPath.node.right;
280
255
  args.push(value);
281
256
  }
282
-
283
257
  const call = callExpression(identifier(superBinding), args);
284
-
285
258
  if (isCall) {
286
259
  superParentPath.unshiftContainer("arguments", thisExpression());
287
260
  superProp.replaceWith(memberExpression(call, identifier("call")));
@@ -298,11 +271,10 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
298
271
  }
299
272
 
300
273
  let thisBinding;
301
-
302
274
  if (thisPaths.length > 0 || !noNewArrows) {
303
275
  thisBinding = getThisBinding(thisEnvFn, inConstructor);
304
-
305
- if (noNewArrows || inConstructor && hasSuperClass(thisEnvFn)) {
276
+ if (noNewArrows ||
277
+ inConstructor && hasSuperClass(thisEnvFn)) {
306
278
  thisPaths.forEach(thisChild => {
307
279
  const thisRef = thisChild.isJSX() ? jsxIdentifier(thisBinding) : identifier(thisBinding);
308
280
  thisRef.loc = thisChild.node.loc;
@@ -311,62 +283,56 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
311
283
  if (!noNewArrows) thisBinding = null;
312
284
  }
313
285
  }
314
-
315
286
  return {
316
287
  thisBinding,
317
288
  fnPath
318
289
  };
319
290
  }
320
-
321
291
  function isLogicalOp(op) {
322
292
  return LOGICAL_OPERATORS.includes(op);
323
293
  }
324
-
325
294
  function standardizeSuperProperty(superProp) {
326
295
  if (superProp.parentPath.isAssignmentExpression() && superProp.parentPath.node.operator !== "=") {
327
296
  const assignmentPath = superProp.parentPath;
328
297
  const op = assignmentPath.node.operator.slice(0, -1);
329
298
  const value = assignmentPath.node.right;
330
299
  const isLogicalAssignment = isLogicalOp(op);
331
-
332
300
  if (superProp.node.computed) {
301
+
333
302
  const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp");
334
303
  const object = superProp.node.object;
335
304
  const property = superProp.node.property;
336
305
  assignmentPath.get("left").replaceWith(memberExpression(object, assignmentExpression("=", tmp, property), true));
306
+
337
307
  assignmentPath.get("right").replaceWith(rightExpression(isLogicalAssignment ? "=" : op, memberExpression(object, identifier(tmp.name), true), value));
338
308
  } else {
309
+
339
310
  const object = superProp.node.object;
340
311
  const property = superProp.node.property;
341
312
  assignmentPath.get("left").replaceWith(memberExpression(object, property));
342
313
  assignmentPath.get("right").replaceWith(rightExpression(isLogicalAssignment ? "=" : op, memberExpression(object, identifier(property.name)), value));
343
314
  }
344
-
345
315
  if (isLogicalAssignment) {
346
316
  assignmentPath.replaceWith(logicalExpression(op, assignmentPath.node.left, assignmentPath.node.right));
347
317
  } else {
348
318
  assignmentPath.node.operator = "=";
349
319
  }
350
-
351
320
  return [assignmentPath.get("left"), assignmentPath.get("right").get("left")];
352
321
  } else if (superProp.parentPath.isUpdateExpression()) {
353
322
  const updateExpr = superProp.parentPath;
354
323
  const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp");
355
324
  const computedKey = superProp.node.computed ? superProp.scope.generateDeclaredUidIdentifier("prop") : null;
356
- const parts = [assignmentExpression("=", tmp, memberExpression(superProp.node.object, computedKey ? assignmentExpression("=", computedKey, superProp.node.property) : superProp.node.property, superProp.node.computed)), assignmentExpression("=", memberExpression(superProp.node.object, computedKey ? identifier(computedKey.name) : superProp.node.property, superProp.node.computed), binaryExpression(superProp.parentPath.node.operator[0], identifier(tmp.name), numericLiteral(1)))];
357
-
325
+ const parts = [assignmentExpression("=", tmp, memberExpression(superProp.node.object, computedKey ? assignmentExpression("=", computedKey, superProp.node.property) : superProp.node.property, superProp.node.computed)), assignmentExpression("=", memberExpression(superProp.node.object, computedKey ? identifier(computedKey.name) : superProp.node.property, superProp.node.computed), binaryExpression(
326
+ superProp.parentPath.node.operator[0], identifier(tmp.name), numericLiteral(1)))];
358
327
  if (!superProp.parentPath.node.prefix) {
359
328
  parts.push(identifier(tmp.name));
360
329
  }
361
-
362
330
  updateExpr.replaceWith(sequenceExpression(parts));
363
331
  const left = updateExpr.get("expressions.0.right");
364
332
  const right = updateExpr.get("expressions.1.left");
365
333
  return [left, right];
366
334
  }
367
-
368
335
  return [superProp];
369
-
370
336
  function rightExpression(op, left, right) {
371
337
  if (op === "=") {
372
338
  return assignmentExpression("=", left, right);
@@ -375,11 +341,9 @@ function standardizeSuperProperty(superProp) {
375
341
  }
376
342
  }
377
343
  }
378
-
379
344
  function hasSuperClass(thisEnvFn) {
380
345
  return thisEnvFn.isClassMethod() && !!thisEnvFn.parentPath.parentPath.node.superClass;
381
346
  }
382
-
383
347
  const assignSuperThisVisitor = (0, _visitors.merge)([{
384
348
  CallExpression(child, {
385
349
  supers,
@@ -390,7 +354,6 @@ const assignSuperThisVisitor = (0, _visitors.merge)([{
390
354
  supers.add(child.node);
391
355
  child.replaceWithMultiple([child.node, assignmentExpression("=", identifier(thisBinding), identifier("this"))]);
392
356
  }
393
-
394
357
  }, _helperEnvironmentVisitor.default]);
395
358
 
396
359
  function getThisBinding(thisEnvFn, inConstructor) {
@@ -415,7 +378,6 @@ function getSuperPropBinding(thisEnvFn, isAssignment, propName) {
415
378
  return getBinding(thisEnvFn, `superprop_${op}:${propName || ""}`, () => {
416
379
  const argsList = [];
417
380
  let fnBody;
418
-
419
381
  if (propName) {
420
382
  fnBody = memberExpression(_super(), identifier(propName));
421
383
  } else {
@@ -429,15 +391,12 @@ function getSuperPropBinding(thisEnvFn, isAssignment, propName) {
429
391
  argsList.push(valueIdent);
430
392
  fnBody = assignmentExpression("=", fnBody, identifier(valueIdent.name));
431
393
  }
432
-
433
394
  return arrowFunctionExpression(argsList, fnBody);
434
395
  });
435
396
  }
436
-
437
397
  function getBinding(thisEnvFn, key, init) {
438
398
  const cacheKey = "binding:" + key;
439
399
  let data = thisEnvFn.getData(cacheKey);
440
-
441
400
  if (!data) {
442
401
  const id = thisEnvFn.scope.generateUidIdentifier(key);
443
402
  data = id.name;
@@ -447,22 +406,18 @@ function getBinding(thisEnvFn, key, init) {
447
406
  init: init(data)
448
407
  });
449
408
  }
450
-
451
409
  return data;
452
410
  }
453
-
454
411
  const getScopeInformationVisitor = (0, _visitors.merge)([{
455
412
  ThisExpression(child, {
456
413
  thisPaths
457
414
  }) {
458
415
  thisPaths.push(child);
459
416
  },
460
-
461
417
  JSXIdentifier(child, {
462
418
  thisPaths
463
419
  }) {
464
420
  if (child.node.name !== "this") return;
465
-
466
421
  if (!child.parentPath.isJSXMemberExpression({
467
422
  object: child.node
468
423
  }) && !child.parentPath.isJSXOpeningElement({
@@ -470,22 +425,18 @@ const getScopeInformationVisitor = (0, _visitors.merge)([{
470
425
  })) {
471
426
  return;
472
427
  }
473
-
474
428
  thisPaths.push(child);
475
429
  },
476
-
477
430
  CallExpression(child, {
478
431
  superCalls
479
432
  }) {
480
433
  if (child.get("callee").isSuper()) superCalls.push(child);
481
434
  },
482
-
483
435
  MemberExpression(child, {
484
436
  superProps
485
437
  }) {
486
438
  if (child.get("object").isSuper()) superProps.push(child);
487
439
  },
488
-
489
440
  Identifier(child, {
490
441
  argumentsPaths
491
442
  }) {
@@ -493,21 +444,17 @@ const getScopeInformationVisitor = (0, _visitors.merge)([{
493
444
  name: "arguments"
494
445
  })) return;
495
446
  let curr = child.scope;
496
-
497
447
  do {
498
448
  if (curr.hasOwnBinding("arguments")) {
499
449
  curr.rename("arguments");
500
450
  return;
501
451
  }
502
-
503
452
  if (curr.path.isFunction() && !curr.path.isArrowFunctionExpression()) {
504
453
  break;
505
454
  }
506
455
  } while (curr = curr.parent);
507
-
508
456
  argumentsPaths.push(child);
509
457
  },
510
-
511
458
  MetaProperty(child, {
512
459
  newTargetPaths
513
460
  }) {
@@ -519,9 +466,7 @@ const getScopeInformationVisitor = (0, _visitors.merge)([{
519
466
  })) return;
520
467
  newTargetPaths.push(child);
521
468
  }
522
-
523
469
  }, _helperEnvironmentVisitor.default]);
524
-
525
470
  function getScopeInformation(fnPath) {
526
471
  const thisPaths = [];
527
472
  const argumentsPaths = [];
@@ -1 +1 @@
1
- {"version":3,"names":["arrowFunctionExpression","assignmentExpression","binaryExpression","blockStatement","callExpression","conditionalExpression","expressionStatement","identifier","isIdentifier","jsxIdentifier","logicalExpression","LOGICAL_OPERATORS","memberExpression","metaProperty","numericLiteral","objectExpression","restElement","returnStatement","sequenceExpression","spreadElement","stringLiteral","super","_super","thisExpression","toExpression","unaryExpression","toComputedKey","key","isMemberExpression","node","property","isProperty","isMethod","ReferenceError","computed","name","ensureBlock","body","get","bodyNode","Array","isArray","Error","isBlockStatement","statements","stringPath","listKey","isStatement","push","isFunction","parentPath","setup","arrowFunctionToShadowed","isArrowFunctionExpression","arrowFunctionToExpression","unwrapFunctionEnvironment","isFunctionExpression","isFunctionDeclaration","buildCodeFrameError","hoistFunctionEnvironment","setType","path","type","allowInsertArrow","specCompliant","noNewArrows","thisBinding","fnPath","fn","checkBinding","scope","generateUidIdentifier","id","init","unshiftContainer","hub","addHelper","replaceWith","nameFunction","getSuperCallsVisitor","mergeVisitors","CallExpression","child","allSuperCalls","isSuper","environmentVisitor","arrowParent","thisEnvFn","findParent","p","isProgram","isClassProperty","static","isClassPrivateProperty","inConstructor","isClassMethod","kind","thisPaths","argumentsPaths","newTargetPaths","superProps","superCalls","getScopeInformation","length","traverse","superBinding","getSuperBinding","forEach","superCall","callee","loc","argumentsBinding","getBinding","args","buildUndefinedNode","argumentsChild","argsRef","newTargetBinding","targetChild","targetRef","flatSuperProps","reduce","acc","superProp","concat","standardizeSuperProperty","superParentPath","isAssignment","isAssignmentExpression","left","isCall","isCallExpression","isTaggedTemplate","isTaggedTemplateExpression","tag","getSuperPropBinding","value","right","call","getThisBinding","hasSuperClass","thisChild","thisRef","isJSX","isLogicalOp","op","includes","operator","assignmentPath","slice","isLogicalAssignment","tmp","generateDeclaredUidIdentifier","object","rightExpression","isUpdateExpression","updateExpr","computedKey","parts","prefix","superClass","assignSuperThisVisitor","supers","has","add","replaceWithMultiple","WeakSet","argsBinding","propName","argsList","fnBody","method","unshift","valueIdent","cacheKey","data","getData","setData","getScopeInformationVisitor","ThisExpression","JSXIdentifier","isJSXMemberExpression","isJSXOpeningElement","MemberExpression","Identifier","isReferencedIdentifier","curr","hasOwnBinding","rename","parent","MetaProperty"],"sources":["../../src/path/conversion.ts"],"sourcesContent":["// This file contains methods that convert the path node into another node or some other type of data.\n\nimport {\n arrowFunctionExpression,\n assignmentExpression,\n binaryExpression,\n blockStatement,\n callExpression,\n conditionalExpression,\n expressionStatement,\n identifier,\n isIdentifier,\n jsxIdentifier,\n logicalExpression,\n LOGICAL_OPERATORS,\n memberExpression,\n metaProperty,\n numericLiteral,\n objectExpression,\n restElement,\n returnStatement,\n sequenceExpression,\n spreadElement,\n stringLiteral,\n super as _super,\n thisExpression,\n toExpression,\n unaryExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport environmentVisitor from \"@babel/helper-environment-visitor\";\nimport nameFunction from \"@babel/helper-function-name\";\nimport { merge as mergeVisitors } from \"../visitors\";\nimport type NodePath from \"./index\";\n\nexport function toComputedKey(this: NodePath) {\n let key;\n if (this.isMemberExpression()) {\n key = this.node.property;\n } else if (this.isProperty() || this.isMethod()) {\n key = this.node.key;\n } else {\n throw new ReferenceError(\"todo\");\n }\n\n // @ts-expect-error todo(flow->ts) computed does not exist in ClassPrivateProperty\n if (!this.node.computed) {\n if (isIdentifier(key)) key = stringLiteral(key.name);\n }\n\n return key;\n}\n\nexport function ensureBlock(\n this: NodePath<\n t.Loop | t.WithStatement | t.Function | t.LabeledStatement | t.CatchClause\n >,\n) {\n const body = this.get(\"body\");\n const bodyNode = body.node;\n\n if (Array.isArray(body)) {\n throw new Error(\"Can't convert array path to a block statement\");\n }\n if (!bodyNode) {\n throw new Error(\"Can't convert node without a body\");\n }\n\n if (body.isBlockStatement()) {\n return bodyNode;\n }\n\n const statements: Array<t.Statement> = [];\n\n let stringPath = \"body\";\n let key;\n let listKey;\n if (body.isStatement()) {\n listKey = \"body\";\n key = 0;\n statements.push(body.node);\n } else {\n stringPath += \".body.0\";\n if (this.isFunction()) {\n key = \"argument\";\n statements.push(returnStatement(body.node as t.Expression));\n } else {\n key = \"expression\";\n statements.push(expressionStatement(body.node as t.Expression));\n }\n }\n\n this.node.body = blockStatement(statements);\n const parentPath = this.get(stringPath) as NodePath;\n body.setup(\n parentPath,\n listKey\n ? // @ts-expect-error listKey must present in parent path\n parentPath.node[listKey]\n : parentPath.node,\n listKey,\n key,\n );\n\n return this.node;\n}\n\n/**\n * Keeping this for backward-compatibility. You should use arrowFunctionToExpression() for >=7.x.\n */\n// TODO(Babel 8): Remove this\nexport function arrowFunctionToShadowed(this: NodePath) {\n if (!this.isArrowFunctionExpression()) return;\n\n this.arrowFunctionToExpression();\n}\n\n/**\n * Given an arbitrary function, process its content as if it were an arrow function, moving references\n * to \"this\", \"arguments\", \"super\", and such into the function's parent scope. This method is useful if\n * you have wrapped some set of items in an IIFE or other function, but want \"this\", \"arguments\", and super\"\n * to continue behaving as expected.\n */\nexport function unwrapFunctionEnvironment(this: NodePath) {\n if (\n !this.isArrowFunctionExpression() &&\n !this.isFunctionExpression() &&\n !this.isFunctionDeclaration()\n ) {\n throw this.buildCodeFrameError(\n \"Can only unwrap the environment of a function.\",\n );\n }\n\n hoistFunctionEnvironment(this);\n}\n\nfunction setType<N extends t.Node, T extends N[\"type\"]>(\n path: NodePath<N>,\n type: T,\n): asserts path is NodePath<Extract<N, { type: T }>> {\n path.node.type = type;\n}\n\n/**\n * Convert a given arrow function into a normal ES5 function expression.\n */\nexport function arrowFunctionToExpression(\n this: NodePath<t.ArrowFunctionExpression>,\n {\n allowInsertArrow = true,\n /** @deprecated Use `noNewArrows` instead */\n specCompliant = false,\n // TODO(Babel 8): Consider defaulting to `false` for spec compliancy\n noNewArrows = !specCompliant,\n }: {\n allowInsertArrow?: boolean | void;\n specCompliant?: boolean | void;\n noNewArrows?: boolean;\n } = {},\n): NodePath<Exclude<t.Function, t.Method | t.ArrowFunctionExpression>> {\n if (!this.isArrowFunctionExpression()) {\n throw (this as NodePath).buildCodeFrameError(\n \"Cannot convert non-arrow function to a function expression.\",\n );\n }\n\n const { thisBinding, fnPath: fn } = hoistFunctionEnvironment(\n this,\n noNewArrows,\n allowInsertArrow,\n );\n\n // @ts-expect-error TS requires explicit fn type annotation\n fn.ensureBlock();\n setType(fn, \"FunctionExpression\");\n\n if (!noNewArrows) {\n const checkBinding = thisBinding\n ? null\n : fn.scope.generateUidIdentifier(\"arrowCheckId\");\n if (checkBinding) {\n fn.parentPath.scope.push({\n id: checkBinding,\n init: objectExpression([]),\n });\n }\n\n fn.get(\"body\").unshiftContainer(\n \"body\",\n expressionStatement(\n callExpression(this.hub.addHelper(\"newArrowCheck\"), [\n thisExpression(),\n checkBinding\n ? identifier(checkBinding.name)\n : identifier(thisBinding),\n ]),\n ),\n );\n\n fn.replaceWith(\n callExpression(\n memberExpression(\n // @ts-expect-error TS can't infer nameFunction returns CallExpression | ArrowFunctionExpression here\n nameFunction(this, true) || fn.node,\n identifier(\"bind\"),\n ),\n [checkBinding ? identifier(checkBinding.name) : thisExpression()],\n ),\n );\n\n return fn.get(\"callee.object\");\n }\n\n return fn;\n}\n\nconst getSuperCallsVisitor = mergeVisitors<{\n allSuperCalls: NodePath<t.CallExpression>[];\n}>([\n {\n CallExpression(child, { allSuperCalls }) {\n if (!child.get(\"callee\").isSuper()) return;\n allSuperCalls.push(child);\n },\n },\n environmentVisitor,\n]);\n\n/**\n * Given a function, traverse its contents, and if there are references to \"this\", \"arguments\", \"super\",\n * or \"new.target\", ensure that these references reference the parent environment around this function.\n *\n * @returns `thisBinding`: the name of the injected reference to `this`; for example \"_this\"\n * @returns `fnPath`: the new path to the function node. This is different from the fnPath\n * parameter when the function node is wrapped in another node.\n */\nfunction hoistFunctionEnvironment(\n fnPath: NodePath<t.Function>,\n // TODO(Babel 8): Consider defaulting to `false` for spec compliancy\n noNewArrows: boolean | void = true,\n allowInsertArrow: boolean | void = true,\n): { thisBinding: string; fnPath: NodePath<t.Function> } {\n let arrowParent;\n let thisEnvFn: NodePath<t.Function> = fnPath.findParent(p => {\n if (p.isArrowFunctionExpression()) {\n arrowParent ??= p;\n return false;\n }\n return (\n p.isFunction() ||\n p.isProgram() ||\n p.isClassProperty({ static: false }) ||\n p.isClassPrivateProperty({ static: false })\n );\n }) as NodePath<t.Function>;\n const inConstructor = thisEnvFn.isClassMethod({ kind: \"constructor\" });\n\n if (thisEnvFn.isClassProperty() || thisEnvFn.isClassPrivateProperty()) {\n if (arrowParent) {\n thisEnvFn = arrowParent;\n } else if (allowInsertArrow) {\n // It's safe to wrap this function in another and not hoist to the\n // top level because the 'this' binding is constant in class\n // properties (since 'super()' has already been called), so we don't\n // need to capture/reassign it at the top level.\n fnPath.replaceWith(\n callExpression(\n arrowFunctionExpression([], toExpression(fnPath.node)),\n [],\n ),\n );\n thisEnvFn = fnPath.get(\"callee\") as NodePath<t.ArrowFunctionExpression>;\n fnPath = thisEnvFn.get(\"body\") as NodePath<t.FunctionExpression>;\n } else {\n throw fnPath.buildCodeFrameError(\n \"Unable to transform arrow inside class property\",\n );\n }\n }\n\n const { thisPaths, argumentsPaths, newTargetPaths, superProps, superCalls } =\n getScopeInformation(fnPath);\n\n // Convert all super() calls in the constructor, if super is used in an arrow.\n if (inConstructor && superCalls.length > 0) {\n if (!allowInsertArrow) {\n throw superCalls[0].buildCodeFrameError(\n \"Unable to handle nested super() usage in arrow\",\n );\n }\n const allSuperCalls: NodePath<t.CallExpression>[] = [];\n thisEnvFn.traverse(getSuperCallsVisitor, { allSuperCalls });\n const superBinding = getSuperBinding(thisEnvFn);\n allSuperCalls.forEach(superCall => {\n const callee = identifier(superBinding);\n callee.loc = superCall.node.callee.loc;\n\n superCall.get(\"callee\").replaceWith(callee);\n });\n }\n\n // Convert all \"arguments\" references in the arrow to point at the alias.\n if (argumentsPaths.length > 0) {\n const argumentsBinding = getBinding(thisEnvFn, \"arguments\", () => {\n const args = () => identifier(\"arguments\");\n if (thisEnvFn.scope.path.isProgram()) {\n return conditionalExpression(\n binaryExpression(\n \"===\",\n unaryExpression(\"typeof\", args()),\n stringLiteral(\"undefined\"),\n ),\n thisEnvFn.scope.buildUndefinedNode(),\n args(),\n );\n } else {\n return args();\n }\n });\n\n argumentsPaths.forEach(argumentsChild => {\n const argsRef = identifier(argumentsBinding);\n argsRef.loc = argumentsChild.node.loc;\n\n argumentsChild.replaceWith(argsRef);\n });\n }\n\n // Convert all \"new.target\" references in the arrow to point at the alias.\n if (newTargetPaths.length > 0) {\n const newTargetBinding = getBinding(thisEnvFn, \"newtarget\", () =>\n metaProperty(identifier(\"new\"), identifier(\"target\")),\n );\n\n newTargetPaths.forEach(targetChild => {\n const targetRef = identifier(newTargetBinding);\n targetRef.loc = targetChild.node.loc;\n\n targetChild.replaceWith(targetRef);\n });\n }\n\n // Convert all \"super.prop\" references to point at aliases.\n if (superProps.length > 0) {\n if (!allowInsertArrow) {\n throw superProps[0].buildCodeFrameError(\n \"Unable to handle nested super.prop usage\",\n );\n }\n\n const flatSuperProps: NodePath<t.MemberExpression>[] = superProps.reduce(\n (acc, superProp) => acc.concat(standardizeSuperProperty(superProp)),\n [],\n );\n\n flatSuperProps.forEach(superProp => {\n const key = superProp.node.computed\n ? \"\"\n : // @ts-expect-error super property must not contain private name\n superProp.get(\"property\").node.name;\n\n const superParentPath = superProp.parentPath;\n\n const isAssignment = superParentPath.isAssignmentExpression({\n left: superProp.node,\n });\n const isCall = superParentPath.isCallExpression({\n callee: superProp.node,\n });\n const isTaggedTemplate = superParentPath.isTaggedTemplateExpression({\n tag: superProp.node,\n });\n const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key);\n\n const args: t.Expression[] = [];\n if (superProp.node.computed) {\n // SuperProperty must not be a private name\n args.push(superProp.get(\"property\").node as t.Expression);\n }\n\n if (isAssignment) {\n const value = superParentPath.node.right;\n args.push(value);\n }\n\n const call = callExpression(identifier(superBinding), args);\n\n if (isCall) {\n superParentPath.unshiftContainer(\"arguments\", thisExpression());\n superProp.replaceWith(memberExpression(call, identifier(\"call\")));\n\n thisPaths.push(\n superParentPath.get(\"arguments.0\") as NodePath<t.ThisExpression>,\n );\n } else if (isAssignment) {\n // Replace not only the super.prop, but the whole assignment\n superParentPath.replaceWith(call);\n } else if (isTaggedTemplate) {\n superProp.replaceWith(\n callExpression(memberExpression(call, identifier(\"bind\"), false), [\n thisExpression(),\n ]),\n );\n\n thisPaths.push(\n superProp.get(\"arguments.0\") as NodePath<t.ThisExpression>,\n );\n } else {\n superProp.replaceWith(call);\n }\n });\n }\n\n // Convert all \"this\" references in the arrow to point at the alias.\n let thisBinding: string | null;\n if (thisPaths.length > 0 || !noNewArrows) {\n thisBinding = getThisBinding(thisEnvFn, inConstructor);\n\n if (\n noNewArrows ||\n // In subclass constructors, still need to rewrite because \"this\" can't be bound in spec mode\n // because it might not have been initialized yet.\n (inConstructor && hasSuperClass(thisEnvFn))\n ) {\n thisPaths.forEach(thisChild => {\n const thisRef = thisChild.isJSX()\n ? jsxIdentifier(thisBinding)\n : identifier(thisBinding);\n\n thisRef.loc = thisChild.node.loc;\n thisChild.replaceWith(thisRef);\n });\n\n if (!noNewArrows) thisBinding = null;\n }\n }\n\n return { thisBinding, fnPath };\n}\n\ntype LogicalOp = Parameters<typeof logicalExpression>[0];\ntype BinaryOp = Parameters<typeof binaryExpression>[0];\n\nfunction isLogicalOp(op: string): op is LogicalOp {\n return LOGICAL_OPERATORS.includes(op);\n}\n\nfunction standardizeSuperProperty(\n superProp: NodePath<t.MemberExpression>,\n):\n | [NodePath<t.MemberExpression>]\n | [NodePath<t.MemberExpression>, NodePath<t.MemberExpression>] {\n if (\n superProp.parentPath.isAssignmentExpression() &&\n superProp.parentPath.node.operator !== \"=\"\n ) {\n const assignmentPath = superProp.parentPath;\n\n const op = assignmentPath.node.operator.slice(0, -1) as\n | LogicalOp\n | BinaryOp;\n\n const value = assignmentPath.node.right;\n\n const isLogicalAssignment = isLogicalOp(op);\n\n if (superProp.node.computed) {\n // from: super[foo] **= 4;\n // to: super[tmp = foo] = super[tmp] ** 4;\n\n // from: super[foo] ??= 4;\n // to: super[tmp = foo] ?? super[tmp] = 4;\n\n const tmp = superProp.scope.generateDeclaredUidIdentifier(\"tmp\");\n\n const object = superProp.node.object;\n const property = superProp.node.property as t.Expression;\n\n assignmentPath\n .get(\"left\")\n .replaceWith(\n memberExpression(\n object,\n assignmentExpression(\"=\", tmp, property),\n true /* computed */,\n ),\n );\n\n assignmentPath\n .get(\"right\")\n .replaceWith(\n rightExpression(\n isLogicalAssignment ? \"=\" : op,\n memberExpression(object, identifier(tmp.name), true /* computed */),\n value,\n ),\n );\n } else {\n // from: super.foo **= 4;\n // to: super.foo = super.foo ** 4;\n\n // from: super.foo ??= 4;\n // to: super.foo ?? super.foo = 4;\n\n const object = superProp.node.object;\n const property = superProp.node.property as t.Identifier;\n\n assignmentPath\n .get(\"left\")\n .replaceWith(memberExpression(object, property));\n\n assignmentPath\n .get(\"right\")\n .replaceWith(\n rightExpression(\n isLogicalAssignment ? \"=\" : op,\n memberExpression(object, identifier(property.name)),\n value,\n ),\n );\n }\n\n if (isLogicalAssignment) {\n assignmentPath.replaceWith(\n logicalExpression(\n op,\n assignmentPath.node.left as t.MemberExpression,\n assignmentPath.node.right as t.Expression,\n ),\n );\n } else {\n assignmentPath.node.operator = \"=\";\n }\n\n return [\n assignmentPath.get(\"left\") as NodePath<t.MemberExpression>,\n assignmentPath.get(\"right\").get(\"left\"),\n ];\n } else if (superProp.parentPath.isUpdateExpression()) {\n const updateExpr = superProp.parentPath;\n\n const tmp = superProp.scope.generateDeclaredUidIdentifier(\"tmp\");\n const computedKey = superProp.node.computed\n ? superProp.scope.generateDeclaredUidIdentifier(\"prop\")\n : null;\n\n const parts: t.Expression[] = [\n assignmentExpression(\n \"=\",\n tmp,\n memberExpression(\n superProp.node.object,\n computedKey\n ? assignmentExpression(\n \"=\",\n computedKey,\n superProp.node.property as t.Expression,\n )\n : superProp.node.property,\n superProp.node.computed,\n ),\n ),\n assignmentExpression(\n \"=\",\n memberExpression(\n superProp.node.object,\n computedKey ? identifier(computedKey.name) : superProp.node.property,\n superProp.node.computed,\n ),\n binaryExpression(\n // map `++` to `+`, and `--` to `-`\n superProp.parentPath.node.operator[0] as \"+\" | \"-\",\n identifier(tmp.name),\n numericLiteral(1),\n ),\n ),\n ];\n\n if (!superProp.parentPath.node.prefix) {\n parts.push(identifier(tmp.name));\n }\n\n updateExpr.replaceWith(sequenceExpression(parts));\n\n const left = updateExpr.get(\n \"expressions.0.right\",\n ) as NodePath<t.MemberExpression>;\n const right = updateExpr.get(\n \"expressions.1.left\",\n ) as NodePath<t.MemberExpression>;\n return [left, right];\n }\n\n return [superProp];\n\n function rightExpression(\n op: BinaryOp | \"=\",\n left: t.MemberExpression,\n right: t.Expression,\n ) {\n if (op === \"=\") {\n return assignmentExpression(\"=\", left, right);\n } else {\n return binaryExpression(op, left, right);\n }\n }\n}\n\nfunction hasSuperClass(thisEnvFn: NodePath<t.Function>) {\n return (\n thisEnvFn.isClassMethod() &&\n !!(thisEnvFn.parentPath.parentPath.node as t.Class).superClass\n );\n}\n\nconst assignSuperThisVisitor = mergeVisitors<{\n supers: WeakSet<t.CallExpression>;\n thisBinding: string;\n}>([\n {\n CallExpression(child, { supers, thisBinding }) {\n if (!child.get(\"callee\").isSuper()) return;\n if (supers.has(child.node)) return;\n supers.add(child.node);\n\n child.replaceWithMultiple([\n child.node,\n assignmentExpression(\"=\", identifier(thisBinding), identifier(\"this\")),\n ]);\n },\n },\n environmentVisitor,\n]);\n\n// Create a binding that evaluates to the \"this\" of the given function.\nfunction getThisBinding(\n thisEnvFn: NodePath<t.Function>,\n inConstructor: boolean,\n) {\n return getBinding(thisEnvFn, \"this\", thisBinding => {\n if (!inConstructor || !hasSuperClass(thisEnvFn)) return thisExpression();\n\n thisEnvFn.traverse(assignSuperThisVisitor, {\n supers: new WeakSet(),\n thisBinding,\n });\n });\n}\n\n// Create a binding for a function that will call \"super()\" with arguments passed through.\nfunction getSuperBinding(thisEnvFn: NodePath<t.Function>) {\n return getBinding(thisEnvFn, \"supercall\", () => {\n const argsBinding = thisEnvFn.scope.generateUidIdentifier(\"args\");\n return arrowFunctionExpression(\n [restElement(argsBinding)],\n callExpression(_super(), [spreadElement(identifier(argsBinding.name))]),\n );\n });\n}\n\n// Create a binding for a function that will call \"super.foo\" or \"super[foo]\".\nfunction getSuperPropBinding(\n thisEnvFn: NodePath<t.Function>,\n isAssignment: boolean,\n propName: string,\n) {\n const op = isAssignment ? \"set\" : \"get\";\n\n return getBinding(thisEnvFn, `superprop_${op}:${propName || \"\"}`, () => {\n const argsList = [];\n\n let fnBody;\n if (propName) {\n // () => super.foo\n fnBody = memberExpression(_super(), identifier(propName));\n } else {\n const method = thisEnvFn.scope.generateUidIdentifier(\"prop\");\n // (method) => super[method]\n argsList.unshift(method);\n fnBody = memberExpression(\n _super(),\n identifier(method.name),\n true /* computed */,\n );\n }\n\n if (isAssignment) {\n const valueIdent = thisEnvFn.scope.generateUidIdentifier(\"value\");\n argsList.push(valueIdent);\n\n fnBody = assignmentExpression(\"=\", fnBody, identifier(valueIdent.name));\n }\n\n return arrowFunctionExpression(argsList, fnBody);\n });\n}\n\nfunction getBinding(\n thisEnvFn: NodePath,\n key: string,\n init: (name: string) => t.Expression,\n) {\n const cacheKey = \"binding:\" + key;\n let data: string | undefined = thisEnvFn.getData(cacheKey);\n if (!data) {\n const id = thisEnvFn.scope.generateUidIdentifier(key);\n data = id.name;\n thisEnvFn.setData(cacheKey, data);\n\n thisEnvFn.scope.push({\n id: id,\n init: init(data),\n });\n }\n\n return data;\n}\n\ntype ScopeInfo = {\n thisPaths: NodePath<t.ThisExpression | t.JSXIdentifier>[];\n superCalls: NodePath<t.CallExpression>[];\n superProps: NodePath<t.MemberExpression>[];\n argumentsPaths: NodePath<t.Identifier | t.JSXIdentifier>[];\n newTargetPaths: NodePath<t.MetaProperty>[];\n};\n\nconst getScopeInformationVisitor = mergeVisitors<ScopeInfo>([\n {\n ThisExpression(child, { thisPaths }) {\n thisPaths.push(child);\n },\n JSXIdentifier(child, { thisPaths }) {\n if (child.node.name !== \"this\") return;\n if (\n !child.parentPath.isJSXMemberExpression({ object: child.node }) &&\n !child.parentPath.isJSXOpeningElement({ name: child.node })\n ) {\n return;\n }\n\n thisPaths.push(child);\n },\n CallExpression(child, { superCalls }) {\n if (child.get(\"callee\").isSuper()) superCalls.push(child);\n },\n MemberExpression(child, { superProps }) {\n if (child.get(\"object\").isSuper()) superProps.push(child);\n },\n Identifier(child, { argumentsPaths }) {\n if (!child.isReferencedIdentifier({ name: \"arguments\" })) return;\n\n let curr = child.scope;\n do {\n if (curr.hasOwnBinding(\"arguments\")) {\n curr.rename(\"arguments\");\n return;\n }\n if (curr.path.isFunction() && !curr.path.isArrowFunctionExpression()) {\n break;\n }\n } while ((curr = curr.parent));\n\n argumentsPaths.push(child);\n },\n MetaProperty(child, { newTargetPaths }) {\n if (!child.get(\"meta\").isIdentifier({ name: \"new\" })) return;\n if (!child.get(\"property\").isIdentifier({ name: \"target\" })) return;\n\n newTargetPaths.push(child);\n },\n },\n environmentVisitor,\n]);\n\nfunction getScopeInformation(fnPath: NodePath) {\n const thisPaths: ScopeInfo[\"thisPaths\"] = [];\n const argumentsPaths: ScopeInfo[\"argumentsPaths\"] = [];\n const newTargetPaths: ScopeInfo[\"newTargetPaths\"] = [];\n const superProps: ScopeInfo[\"superProps\"] = [];\n const superCalls: ScopeInfo[\"superCalls\"] = [];\n\n fnPath.traverse(getScopeInformationVisitor, {\n thisPaths,\n argumentsPaths,\n newTargetPaths,\n superProps,\n superCalls,\n });\n\n return {\n thisPaths,\n argumentsPaths,\n newTargetPaths,\n superProps,\n superCalls,\n };\n}\n"],"mappings":";;;;;;;;;;;AAEA;;AA4BA;;AACA;;AACA;;;EA7BEA,uB;EACAC,oB;EACAC,gB;EACAC,c;EACAC,c;EACAC,qB;EACAC,mB;EACAC,U;EACAC,Y;EACAC,a;EACAC,iB;EACAC,iB;EACAC,gB;EACAC,Y;EACAC,c;EACAC,gB;EACAC,W;EACAC,e;EACAC,kB;EACAC,a;EACAC,a;EACAC,K,EAASC,M;EACTC,c;EACAC,Y;EACAC;;;AAQK,SAASC,aAAT,GAAuC;EAC5C,IAAIC,GAAJ;;EACA,IAAI,KAAKC,kBAAL,EAAJ,EAA+B;IAC7BD,GAAG,GAAG,KAAKE,IAAL,CAAUC,QAAhB;EACD,CAFD,MAEO,IAAI,KAAKC,UAAL,MAAqB,KAAKC,QAAL,EAAzB,EAA0C;IAC/CL,GAAG,GAAG,KAAKE,IAAL,CAAUF,GAAhB;EACD,CAFM,MAEA;IACL,MAAM,IAAIM,cAAJ,CAAmB,MAAnB,CAAN;EACD;;EAGD,IAAI,CAAC,KAAKJ,IAAL,CAAUK,QAAf,EAAyB;IACvB,IAAI1B,YAAY,CAACmB,GAAD,CAAhB,EAAuBA,GAAG,GAAGP,aAAa,CAACO,GAAG,C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;EAEAlC,MAAM,CAACqC,QAAP,CAAgB0E,0BAAhB,EAA4C;IAC1CjF,SAD0C;IAE1CC,cAF0C;IAG1CC,cAH0C;IAI1CC,UAJ0C;IAK1CC;EAL0C,CAA5C;EAQA,OAAO;IACLJ,SADK;IAELC,cAFK;IAGLC,cAHK;IAILC,UAJK;IAKLC;EALK,CAAP;AAOD"}
1
+ {"version":3,"names":["arrowFunctionExpression","assignmentExpression","binaryExpression","blockStatement","callExpression","conditionalExpression","expressionStatement","identifier","isIdentifier","jsxIdentifier","logicalExpression","LOGICAL_OPERATORS","memberExpression","metaProperty","numericLiteral","objectExpression","restElement","returnStatement","sequenceExpression","spreadElement","stringLiteral","super","_super","thisExpression","toExpression","unaryExpression","toComputedKey","key","isMemberExpression","node","property","isProperty","isMethod","ReferenceError","computed","name","ensureBlock","body","get","bodyNode","Array","isArray","Error","isBlockStatement","statements","stringPath","listKey","isStatement","push","isFunction","parentPath","setup","arrowFunctionToShadowed","isArrowFunctionExpression","arrowFunctionToExpression","unwrapFunctionEnvironment","isFunctionExpression","isFunctionDeclaration","buildCodeFrameError","hoistFunctionEnvironment","setType","path","type","allowInsertArrow","allowInsertArrowWithRest","specCompliant","noNewArrows","thisBinding","fnPath","fn","checkBinding","scope","generateUidIdentifier","id","init","unshiftContainer","hub","addHelper","replaceWith","nameFunction","getSuperCallsVisitor","mergeVisitors","CallExpression","child","allSuperCalls","isSuper","environmentVisitor","arrowParent","thisEnvFn","findParent","p","isProgram","isClassProperty","static","isClassPrivateProperty","inConstructor","isClassMethod","kind","thisPaths","argumentsPaths","newTargetPaths","superProps","superCalls","getScopeInformation","length","traverse","superBinding","getSuperBinding","forEach","superCall","callee","loc","argumentsBinding","getBinding","args","buildUndefinedNode","argumentsChild","argsRef","newTargetBinding","targetChild","targetRef","flatSuperProps","reduce","acc","superProp","concat","standardizeSuperProperty","superParentPath","isAssignment","isAssignmentExpression","left","isCall","isCallExpression","isTaggedTemplate","isTaggedTemplateExpression","tag","getSuperPropBinding","value","right","call","getThisBinding","hasSuperClass","thisChild","thisRef","isJSX","isLogicalOp","op","includes","operator","assignmentPath","slice","isLogicalAssignment","tmp","generateDeclaredUidIdentifier","object","rightExpression","isUpdateExpression","updateExpr","computedKey","parts","prefix","superClass","assignSuperThisVisitor","supers","has","add","replaceWithMultiple","WeakSet","argsBinding","propName","argsList","fnBody","method","unshift","valueIdent","cacheKey","data","getData","setData","getScopeInformationVisitor","ThisExpression","JSXIdentifier","isJSXMemberExpression","isJSXOpeningElement","MemberExpression","Identifier","isReferencedIdentifier","curr","hasOwnBinding","rename","parent","MetaProperty"],"sources":["../../src/path/conversion.ts"],"sourcesContent":["// This file contains methods that convert the path node into another node or some other type of data.\n\nimport {\n arrowFunctionExpression,\n assignmentExpression,\n binaryExpression,\n blockStatement,\n callExpression,\n conditionalExpression,\n expressionStatement,\n identifier,\n isIdentifier,\n jsxIdentifier,\n logicalExpression,\n LOGICAL_OPERATORS,\n memberExpression,\n metaProperty,\n numericLiteral,\n objectExpression,\n restElement,\n returnStatement,\n sequenceExpression,\n spreadElement,\n stringLiteral,\n super as _super,\n thisExpression,\n toExpression,\n unaryExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport environmentVisitor from \"@babel/helper-environment-visitor\";\nimport nameFunction from \"@babel/helper-function-name\";\nimport { merge as mergeVisitors } from \"../visitors\";\nimport type NodePath from \"./index\";\n\nexport function toComputedKey(this: NodePath) {\n let key;\n if (this.isMemberExpression()) {\n key = this.node.property;\n } else if (this.isProperty() || this.isMethod()) {\n key = this.node.key;\n } else {\n throw new ReferenceError(\"todo\");\n }\n\n // @ts-expect-error todo(flow->ts) computed does not exist in ClassPrivateProperty\n if (!this.node.computed) {\n if (isIdentifier(key)) key = stringLiteral(key.name);\n }\n\n return key;\n}\n\nexport function ensureBlock(\n this: NodePath<\n t.Loop | t.WithStatement | t.Function | t.LabeledStatement | t.CatchClause\n >,\n) {\n const body = this.get(\"body\");\n const bodyNode = body.node;\n\n if (Array.isArray(body)) {\n throw new Error(\"Can't convert array path to a block statement\");\n }\n if (!bodyNode) {\n throw new Error(\"Can't convert node without a body\");\n }\n\n if (body.isBlockStatement()) {\n return bodyNode;\n }\n\n const statements: Array<t.Statement> = [];\n\n let stringPath = \"body\";\n let key;\n let listKey;\n if (body.isStatement()) {\n listKey = \"body\";\n key = 0;\n statements.push(body.node);\n } else {\n stringPath += \".body.0\";\n if (this.isFunction()) {\n key = \"argument\";\n statements.push(returnStatement(body.node as t.Expression));\n } else {\n key = \"expression\";\n statements.push(expressionStatement(body.node as t.Expression));\n }\n }\n\n this.node.body = blockStatement(statements);\n const parentPath = this.get(stringPath) as NodePath;\n body.setup(\n parentPath,\n listKey\n ? // @ts-expect-error listKey must present in parent path\n parentPath.node[listKey]\n : parentPath.node,\n listKey,\n key,\n );\n\n return this.node;\n}\n\n/**\n * Keeping this for backward-compatibility. You should use arrowFunctionToExpression() for >=7.x.\n */\n// TODO(Babel 8): Remove this\nexport function arrowFunctionToShadowed(this: NodePath) {\n if (!this.isArrowFunctionExpression()) return;\n\n this.arrowFunctionToExpression();\n}\n\n/**\n * Given an arbitrary function, process its content as if it were an arrow function, moving references\n * to \"this\", \"arguments\", \"super\", and such into the function's parent scope. This method is useful if\n * you have wrapped some set of items in an IIFE or other function, but want \"this\", \"arguments\", and super\"\n * to continue behaving as expected.\n */\nexport function unwrapFunctionEnvironment(this: NodePath) {\n if (\n !this.isArrowFunctionExpression() &&\n !this.isFunctionExpression() &&\n !this.isFunctionDeclaration()\n ) {\n throw this.buildCodeFrameError(\n \"Can only unwrap the environment of a function.\",\n );\n }\n\n hoistFunctionEnvironment(this);\n}\n\nfunction setType<N extends t.Node, T extends N[\"type\"]>(\n path: NodePath<N>,\n type: T,\n): asserts path is NodePath<Extract<N, { type: T }>> {\n path.node.type = type;\n}\n\n/**\n * Convert a given arrow function into a normal ES5 function expression.\n */\nexport function arrowFunctionToExpression(\n this: NodePath<t.ArrowFunctionExpression>,\n {\n allowInsertArrow = true,\n allowInsertArrowWithRest = allowInsertArrow,\n /** @deprecated Use `noNewArrows` instead */\n specCompliant = false,\n // TODO(Babel 8): Consider defaulting to `false` for spec compliancy\n noNewArrows = !specCompliant,\n }: {\n allowInsertArrow?: boolean | void;\n allowInsertArrowWithRest?: boolean | void;\n specCompliant?: boolean | void;\n noNewArrows?: boolean;\n } = {},\n): NodePath<\n Exclude<t.Function, t.Method | t.ArrowFunctionExpression> | t.CallExpression\n> {\n if (!this.isArrowFunctionExpression()) {\n throw (this as NodePath).buildCodeFrameError(\n \"Cannot convert non-arrow function to a function expression.\",\n );\n }\n\n const { thisBinding, fnPath: fn } = hoistFunctionEnvironment(\n this,\n noNewArrows,\n allowInsertArrow,\n allowInsertArrowWithRest,\n );\n\n // @ts-expect-error TS requires explicit fn type annotation\n fn.ensureBlock();\n setType(fn, \"FunctionExpression\");\n\n if (!noNewArrows) {\n const checkBinding = thisBinding\n ? null\n : fn.scope.generateUidIdentifier(\"arrowCheckId\");\n if (checkBinding) {\n fn.parentPath.scope.push({\n id: checkBinding,\n init: objectExpression([]),\n });\n }\n\n fn.get(\"body\").unshiftContainer(\n \"body\",\n expressionStatement(\n callExpression(this.hub.addHelper(\"newArrowCheck\"), [\n thisExpression(),\n checkBinding\n ? identifier(checkBinding.name)\n : identifier(thisBinding),\n ]),\n ),\n );\n\n fn.replaceWith(\n callExpression(\n memberExpression(\n // @ts-expect-error TS can't infer nameFunction returns CallExpression | ArrowFunctionExpression here\n nameFunction(this, true) || fn.node,\n identifier(\"bind\"),\n ),\n [checkBinding ? identifier(checkBinding.name) : thisExpression()],\n ),\n );\n\n return fn.get(\"callee.object\");\n }\n\n return fn;\n}\n\nconst getSuperCallsVisitor = mergeVisitors<{\n allSuperCalls: NodePath<t.CallExpression>[];\n}>([\n {\n CallExpression(child, { allSuperCalls }) {\n if (!child.get(\"callee\").isSuper()) return;\n allSuperCalls.push(child);\n },\n },\n environmentVisitor,\n]);\n\n/**\n * Given a function, traverse its contents, and if there are references to \"this\", \"arguments\", \"super\",\n * or \"new.target\", ensure that these references reference the parent environment around this function.\n *\n * @returns `thisBinding`: the name of the injected reference to `this`; for example \"_this\"\n * @returns `fnPath`: the new path to the function node. This is different from the fnPath\n * parameter when the function node is wrapped in another node.\n */\nfunction hoistFunctionEnvironment(\n fnPath: NodePath<t.Function>,\n // TODO(Babel 8): Consider defaulting to `false` for spec compliancy\n noNewArrows: boolean | void = true,\n allowInsertArrow: boolean | void = true,\n allowInsertArrowWithRest: boolean | void = true,\n): { thisBinding: string; fnPath: NodePath<t.Function> } {\n let arrowParent;\n let thisEnvFn: NodePath<t.Function> = fnPath.findParent(p => {\n if (p.isArrowFunctionExpression()) {\n arrowParent ??= p;\n return false;\n }\n return (\n p.isFunction() ||\n p.isProgram() ||\n p.isClassProperty({ static: false }) ||\n p.isClassPrivateProperty({ static: false })\n );\n }) as NodePath<t.Function>;\n const inConstructor = thisEnvFn.isClassMethod({ kind: \"constructor\" });\n\n if (thisEnvFn.isClassProperty() || thisEnvFn.isClassPrivateProperty()) {\n if (arrowParent) {\n thisEnvFn = arrowParent;\n } else if (allowInsertArrow) {\n // It's safe to wrap this function in another and not hoist to the\n // top level because the 'this' binding is constant in class\n // properties (since 'super()' has already been called), so we don't\n // need to capture/reassign it at the top level.\n fnPath.replaceWith(\n callExpression(\n arrowFunctionExpression([], toExpression(fnPath.node)),\n [],\n ),\n );\n thisEnvFn = fnPath.get(\"callee\") as NodePath<t.ArrowFunctionExpression>;\n fnPath = thisEnvFn.get(\"body\") as NodePath<t.FunctionExpression>;\n } else {\n throw fnPath.buildCodeFrameError(\n \"Unable to transform arrow inside class property\",\n );\n }\n }\n\n const { thisPaths, argumentsPaths, newTargetPaths, superProps, superCalls } =\n getScopeInformation(fnPath);\n\n // Convert all super() calls in the constructor, if super is used in an arrow.\n if (inConstructor && superCalls.length > 0) {\n if (!allowInsertArrow) {\n throw superCalls[0].buildCodeFrameError(\n \"When using '@babel/plugin-transform-arrow-functions', \" +\n \"it's not possible to compile `super()` in an arrow function without compiling classes.\\n\" +\n \"Please add '@babel/plugin-transform-classes' to your Babel configuration.\",\n );\n }\n if (!allowInsertArrowWithRest) {\n // preset-env with target `since 2017` enables `transform-parameters` without `transform-classes`.\n throw superCalls[0].buildCodeFrameError(\n \"When using '@babel/plugin-transform-parameters', \" +\n \"it's not possible to compile `super()` in an arrow function with default or rest parameters without compiling classes.\\n\" +\n \"Please add '@babel/plugin-transform-classes' to your Babel configuration.\",\n );\n }\n const allSuperCalls: NodePath<t.CallExpression>[] = [];\n thisEnvFn.traverse(getSuperCallsVisitor, { allSuperCalls });\n const superBinding = getSuperBinding(thisEnvFn);\n allSuperCalls.forEach(superCall => {\n const callee = identifier(superBinding);\n callee.loc = superCall.node.callee.loc;\n\n superCall.get(\"callee\").replaceWith(callee);\n });\n }\n\n // Convert all \"arguments\" references in the arrow to point at the alias.\n if (argumentsPaths.length > 0) {\n const argumentsBinding = getBinding(thisEnvFn, \"arguments\", () => {\n const args = () => identifier(\"arguments\");\n if (thisEnvFn.scope.path.isProgram()) {\n return conditionalExpression(\n binaryExpression(\n \"===\",\n unaryExpression(\"typeof\", args()),\n stringLiteral(\"undefined\"),\n ),\n thisEnvFn.scope.buildUndefinedNode(),\n args(),\n );\n } else {\n return args();\n }\n });\n\n argumentsPaths.forEach(argumentsChild => {\n const argsRef = identifier(argumentsBinding);\n argsRef.loc = argumentsChild.node.loc;\n\n argumentsChild.replaceWith(argsRef);\n });\n }\n\n // Convert all \"new.target\" references in the arrow to point at the alias.\n if (newTargetPaths.length > 0) {\n const newTargetBinding = getBinding(thisEnvFn, \"newtarget\", () =>\n metaProperty(identifier(\"new\"), identifier(\"target\")),\n );\n\n newTargetPaths.forEach(targetChild => {\n const targetRef = identifier(newTargetBinding);\n targetRef.loc = targetChild.node.loc;\n\n targetChild.replaceWith(targetRef);\n });\n }\n\n // Convert all \"super.prop\" references to point at aliases.\n if (superProps.length > 0) {\n if (!allowInsertArrow) {\n throw superProps[0].buildCodeFrameError(\n \"When using '@babel/plugin-transform-arrow-functions', \" +\n \"it's not possible to compile `super.prop` in an arrow function without compiling classes.\\n\" +\n \"Please add '@babel/plugin-transform-classes' to your Babel configuration.\",\n );\n }\n\n const flatSuperProps: NodePath<t.MemberExpression>[] = superProps.reduce(\n (acc, superProp) => acc.concat(standardizeSuperProperty(superProp)),\n [],\n );\n\n flatSuperProps.forEach(superProp => {\n const key = superProp.node.computed\n ? \"\"\n : // @ts-expect-error super property must not contain private name\n superProp.get(\"property\").node.name;\n\n const superParentPath = superProp.parentPath;\n\n const isAssignment = superParentPath.isAssignmentExpression({\n left: superProp.node,\n });\n const isCall = superParentPath.isCallExpression({\n callee: superProp.node,\n });\n const isTaggedTemplate = superParentPath.isTaggedTemplateExpression({\n tag: superProp.node,\n });\n const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key);\n\n const args: t.Expression[] = [];\n if (superProp.node.computed) {\n // SuperProperty must not be a private name\n args.push(superProp.get(\"property\").node as t.Expression);\n }\n\n if (isAssignment) {\n const value = superParentPath.node.right;\n args.push(value);\n }\n\n const call = callExpression(identifier(superBinding), args);\n\n if (isCall) {\n superParentPath.unshiftContainer(\"arguments\", thisExpression());\n superProp.replaceWith(memberExpression(call, identifier(\"call\")));\n\n thisPaths.push(\n superParentPath.get(\"arguments.0\") as NodePath<t.ThisExpression>,\n );\n } else if (isAssignment) {\n // Replace not only the super.prop, but the whole assignment\n superParentPath.replaceWith(call);\n } else if (isTaggedTemplate) {\n superProp.replaceWith(\n callExpression(memberExpression(call, identifier(\"bind\"), false), [\n thisExpression(),\n ]),\n );\n\n thisPaths.push(\n superProp.get(\"arguments.0\") as NodePath<t.ThisExpression>,\n );\n } else {\n superProp.replaceWith(call);\n }\n });\n }\n\n // Convert all \"this\" references in the arrow to point at the alias.\n let thisBinding: string | null;\n if (thisPaths.length > 0 || !noNewArrows) {\n thisBinding = getThisBinding(thisEnvFn, inConstructor);\n\n if (\n noNewArrows ||\n // In subclass constructors, still need to rewrite because \"this\" can't be bound in spec mode\n // because it might not have been initialized yet.\n (inConstructor && hasSuperClass(thisEnvFn))\n ) {\n thisPaths.forEach(thisChild => {\n const thisRef = thisChild.isJSX()\n ? jsxIdentifier(thisBinding)\n : identifier(thisBinding);\n\n thisRef.loc = thisChild.node.loc;\n thisChild.replaceWith(thisRef);\n });\n\n if (!noNewArrows) thisBinding = null;\n }\n }\n\n return { thisBinding, fnPath };\n}\n\ntype LogicalOp = Parameters<typeof logicalExpression>[0];\ntype BinaryOp = Parameters<typeof binaryExpression>[0];\n\nfunction isLogicalOp(op: string): op is LogicalOp {\n return LOGICAL_OPERATORS.includes(op);\n}\n\nfunction standardizeSuperProperty(\n superProp: NodePath<t.MemberExpression>,\n):\n | [NodePath<t.MemberExpression>]\n | [NodePath<t.MemberExpression>, NodePath<t.MemberExpression>] {\n if (\n superProp.parentPath.isAssignmentExpression() &&\n superProp.parentPath.node.operator !== \"=\"\n ) {\n const assignmentPath = superProp.parentPath;\n\n const op = assignmentPath.node.operator.slice(0, -1) as\n | LogicalOp\n | BinaryOp;\n\n const value = assignmentPath.node.right;\n\n const isLogicalAssignment = isLogicalOp(op);\n\n if (superProp.node.computed) {\n // from: super[foo] **= 4;\n // to: super[tmp = foo] = super[tmp] ** 4;\n\n // from: super[foo] ??= 4;\n // to: super[tmp = foo] ?? super[tmp] = 4;\n\n const tmp = superProp.scope.generateDeclaredUidIdentifier(\"tmp\");\n\n const object = superProp.node.object;\n const property = superProp.node.property as t.Expression;\n\n assignmentPath\n .get(\"left\")\n .replaceWith(\n memberExpression(\n object,\n assignmentExpression(\"=\", tmp, property),\n true /* computed */,\n ),\n );\n\n assignmentPath\n .get(\"right\")\n .replaceWith(\n rightExpression(\n isLogicalAssignment ? \"=\" : op,\n memberExpression(object, identifier(tmp.name), true /* computed */),\n value,\n ),\n );\n } else {\n // from: super.foo **= 4;\n // to: super.foo = super.foo ** 4;\n\n // from: super.foo ??= 4;\n // to: super.foo ?? super.foo = 4;\n\n const object = superProp.node.object;\n const property = superProp.node.property as t.Identifier;\n\n assignmentPath\n .get(\"left\")\n .replaceWith(memberExpression(object, property));\n\n assignmentPath\n .get(\"right\")\n .replaceWith(\n rightExpression(\n isLogicalAssignment ? \"=\" : op,\n memberExpression(object, identifier(property.name)),\n value,\n ),\n );\n }\n\n if (isLogicalAssignment) {\n assignmentPath.replaceWith(\n logicalExpression(\n op,\n assignmentPath.node.left as t.MemberExpression,\n assignmentPath.node.right as t.Expression,\n ),\n );\n } else {\n assignmentPath.node.operator = \"=\";\n }\n\n return [\n assignmentPath.get(\"left\") as NodePath<t.MemberExpression>,\n assignmentPath.get(\"right\").get(\"left\"),\n ];\n } else if (superProp.parentPath.isUpdateExpression()) {\n const updateExpr = superProp.parentPath;\n\n const tmp = superProp.scope.generateDeclaredUidIdentifier(\"tmp\");\n const computedKey = superProp.node.computed\n ? superProp.scope.generateDeclaredUidIdentifier(\"prop\")\n : null;\n\n const parts: t.Expression[] = [\n assignmentExpression(\n \"=\",\n tmp,\n memberExpression(\n superProp.node.object,\n computedKey\n ? assignmentExpression(\n \"=\",\n computedKey,\n superProp.node.property as t.Expression,\n )\n : superProp.node.property,\n superProp.node.computed,\n ),\n ),\n assignmentExpression(\n \"=\",\n memberExpression(\n superProp.node.object,\n computedKey ? identifier(computedKey.name) : superProp.node.property,\n superProp.node.computed,\n ),\n binaryExpression(\n // map `++` to `+`, and `--` to `-`\n superProp.parentPath.node.operator[0] as \"+\" | \"-\",\n identifier(tmp.name),\n numericLiteral(1),\n ),\n ),\n ];\n\n if (!superProp.parentPath.node.prefix) {\n parts.push(identifier(tmp.name));\n }\n\n updateExpr.replaceWith(sequenceExpression(parts));\n\n const left = updateExpr.get(\n \"expressions.0.right\",\n ) as NodePath<t.MemberExpression>;\n const right = updateExpr.get(\n \"expressions.1.left\",\n ) as NodePath<t.MemberExpression>;\n return [left, right];\n }\n\n return [superProp];\n\n function rightExpression(\n op: BinaryOp | \"=\",\n left: t.MemberExpression,\n right: t.Expression,\n ) {\n if (op === \"=\") {\n return assignmentExpression(\"=\", left, right);\n } else {\n return binaryExpression(op, left, right);\n }\n }\n}\n\nfunction hasSuperClass(thisEnvFn: NodePath<t.Function>) {\n return (\n thisEnvFn.isClassMethod() &&\n !!(thisEnvFn.parentPath.parentPath.node as t.Class).superClass\n );\n}\n\nconst assignSuperThisVisitor = mergeVisitors<{\n supers: WeakSet<t.CallExpression>;\n thisBinding: string;\n}>([\n {\n CallExpression(child, { supers, thisBinding }) {\n if (!child.get(\"callee\").isSuper()) return;\n if (supers.has(child.node)) return;\n supers.add(child.node);\n\n child.replaceWithMultiple([\n child.node,\n assignmentExpression(\"=\", identifier(thisBinding), identifier(\"this\")),\n ]);\n },\n },\n environmentVisitor,\n]);\n\n// Create a binding that evaluates to the \"this\" of the given function.\nfunction getThisBinding(\n thisEnvFn: NodePath<t.Function>,\n inConstructor: boolean,\n) {\n return getBinding(thisEnvFn, \"this\", thisBinding => {\n if (!inConstructor || !hasSuperClass(thisEnvFn)) return thisExpression();\n\n thisEnvFn.traverse(assignSuperThisVisitor, {\n supers: new WeakSet(),\n thisBinding,\n });\n });\n}\n\n// Create a binding for a function that will call \"super()\" with arguments passed through.\nfunction getSuperBinding(thisEnvFn: NodePath<t.Function>) {\n return getBinding(thisEnvFn, \"supercall\", () => {\n const argsBinding = thisEnvFn.scope.generateUidIdentifier(\"args\");\n return arrowFunctionExpression(\n [restElement(argsBinding)],\n callExpression(_super(), [spreadElement(identifier(argsBinding.name))]),\n );\n });\n}\n\n// Create a binding for a function that will call \"super.foo\" or \"super[foo]\".\nfunction getSuperPropBinding(\n thisEnvFn: NodePath<t.Function>,\n isAssignment: boolean,\n propName: string,\n) {\n const op = isAssignment ? \"set\" : \"get\";\n\n return getBinding(thisEnvFn, `superprop_${op}:${propName || \"\"}`, () => {\n const argsList = [];\n\n let fnBody;\n if (propName) {\n // () => super.foo\n fnBody = memberExpression(_super(), identifier(propName));\n } else {\n const method = thisEnvFn.scope.generateUidIdentifier(\"prop\");\n // (method) => super[method]\n argsList.unshift(method);\n fnBody = memberExpression(\n _super(),\n identifier(method.name),\n true /* computed */,\n );\n }\n\n if (isAssignment) {\n const valueIdent = thisEnvFn.scope.generateUidIdentifier(\"value\");\n argsList.push(valueIdent);\n\n fnBody = assignmentExpression(\"=\", fnBody, identifier(valueIdent.name));\n }\n\n return arrowFunctionExpression(argsList, fnBody);\n });\n}\n\nfunction getBinding(\n thisEnvFn: NodePath,\n key: string,\n init: (name: string) => t.Expression,\n) {\n const cacheKey = \"binding:\" + key;\n let data: string | undefined = thisEnvFn.getData(cacheKey);\n if (!data) {\n const id = thisEnvFn.scope.generateUidIdentifier(key);\n data = id.name;\n thisEnvFn.setData(cacheKey, data);\n\n thisEnvFn.scope.push({\n id: id,\n init: init(data),\n });\n }\n\n return data;\n}\n\ntype ScopeInfo = {\n thisPaths: NodePath<t.ThisExpression | t.JSXIdentifier>[];\n superCalls: NodePath<t.CallExpression>[];\n superProps: NodePath<t.MemberExpression>[];\n argumentsPaths: NodePath<t.Identifier | t.JSXIdentifier>[];\n newTargetPaths: NodePath<t.MetaProperty>[];\n};\n\nconst getScopeInformationVisitor = mergeVisitors<ScopeInfo>([\n {\n ThisExpression(child, { thisPaths }) {\n thisPaths.push(child);\n },\n JSXIdentifier(child, { thisPaths }) {\n if (child.node.name !== \"this\") return;\n if (\n !child.parentPath.isJSXMemberExpression({ object: child.node }) &&\n !child.parentPath.isJSXOpeningElement({ name: child.node })\n ) {\n return;\n }\n\n thisPaths.push(child);\n },\n CallExpression(child, { superCalls }) {\n if (child.get(\"callee\").isSuper()) superCalls.push(child);\n },\n MemberExpression(child, { superProps }) {\n if (child.get(\"object\").isSuper()) superProps.push(child);\n },\n Identifier(child, { argumentsPaths }) {\n if (!child.isReferencedIdentifier({ name: \"arguments\" })) return;\n\n let curr = child.scope;\n do {\n if (curr.hasOwnBinding(\"arguments\")) {\n curr.rename(\"arguments\");\n return;\n }\n if (curr.path.isFunction() && !curr.path.isArrowFunctionExpression()) {\n break;\n }\n } while ((curr = curr.parent));\n\n argumentsPaths.push(child);\n },\n MetaProperty(child, { newTargetPaths }) {\n if (!child.get(\"meta\").isIdentifier({ name: \"new\" })) return;\n if (!child.get(\"property\").isIdentifier({ name: \"target\" })) return;\n\n newTargetPaths.push(child);\n },\n },\n environmentVisitor,\n]);\n\nfunction getScopeInformation(fnPath: NodePath) {\n const thisPaths: ScopeInfo[\"thisPaths\"] = [];\n const argumentsPaths: ScopeInfo[\"argumentsPaths\"] = [];\n const newTargetPaths: ScopeInfo[\"newTargetPaths\"] = [];\n const superProps: ScopeInfo[\"superProps\"] = [];\n const superCalls: ScopeInfo[\"superCalls\"] = [];\n\n fnPath.traverse(getScopeInformationVisitor, {\n thisPaths,\n argumentsPaths,\n newTargetPaths,\n superProps,\n superCalls,\n });\n\n return {\n thisPaths,\n argumentsPaths,\n newTargetPaths,\n superProps,\n superCalls,\n };\n}\n"],"mappings":";;;;;;;;;;AAEA;AA4BA;AACA;AACA;AAAqD;EA7BnDA,uBAAuB;EACvBC,oBAAoB;EACpBC,gBAAgB;EAChBC,cAAc;EACdC,cAAc;EACdC,qBAAqB;EACrBC,mBAAmB;EACnBC,UAAU;EACVC,YAAY;EACZC,aAAa;EACbC,iBAAiB;EACjBC,iBAAiB;EACjBC,gBAAgB;EAChBC,YAAY;EACZC,cAAc;EACdC,gBAAgB;EAChBC,WAAW;EACXC,eAAe;EACfC,kBAAkB;EAClBC,aAAa;EACbC,aAAa;EACbC,KAAK,EAAIC,MAAM;EACfC,cAAc;EACdC,YAAY;EACZC;AAAe;AAQV,SAASC,aAAa,GAAiB;EAC5C,IAAIC,GAAG;EACP,IAAI,IAAI,CAACC,kBAAkB,EAAE,EAAE;IAC7BD,GAAG,GAAG,IAAI,CAACE,IAAI,CAACC,QAAQ;EAC1B,CAAC,MAAM,IAAI,IAAI,CAACC,UAAU,EAAE,IAAI,IAAI,CAACC,QAAQ,EAAE,EAAE;IAC/CL,GAAG,GAAG,IAAI,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