@babel/traverse 7.0.0-beta.40 → 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.

@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
4
6
  exports.matchesPattern = matchesPattern;
5
7
  exports.has = has;
6
8
  exports.isStatic = isStatic;
@@ -21,16 +23,32 @@ exports._resolve = _resolve;
21
23
  exports.isConstantExpression = isConstantExpression;
22
24
  exports.is = void 0;
23
25
 
24
- var _includes = _interopRequireDefault(require("lodash/includes"));
26
+ function _includes() {
27
+ var data = _interopRequireDefault(require("lodash/includes"));
25
28
 
26
- var t = _interopRequireWildcard(require("@babel/types"));
29
+ _includes = function _includes() {
30
+ return data;
31
+ };
32
+
33
+ return data;
34
+ }
35
+
36
+ function t() {
37
+ var data = _interopRequireWildcard(require("@babel/types"));
38
+
39
+ t = function t() {
40
+ return data;
41
+ };
42
+
43
+ return data;
44
+ }
27
45
 
28
46
  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; } }
29
47
 
30
48
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
49
 
32
50
  function matchesPattern(pattern, allowPartial) {
33
- return t.matchesPattern(this.node, pattern, allowPartial);
51
+ return t().matchesPattern(this.node, pattern, allowPartial);
34
52
  }
35
53
 
36
54
  function has(key) {
@@ -59,7 +77,7 @@ function equals(key, value) {
59
77
  }
60
78
 
61
79
  function isNodeType(type) {
62
- return t.isType(this.type, type);
80
+ return t().isType(this.type, type);
63
81
  }
64
82
 
65
83
  function canHaveVariableDeclarationOrExpression() {
@@ -72,9 +90,9 @@ function canSwapBetweenExpressionAndStatement(replacement) {
72
90
  }
73
91
 
74
92
  if (this.isExpression()) {
75
- return t.isBlockStatement(replacement);
93
+ return t().isBlockStatement(replacement);
76
94
  } else if (this.isBlockStatement()) {
77
- return t.isExpression(replacement);
95
+ return t().isExpression(replacement);
78
96
  }
79
97
 
80
98
  return false;
@@ -102,10 +120,10 @@ function isCompletionRecord(allowInsideFunction) {
102
120
  }
103
121
 
104
122
  function isStatementOrBlock() {
105
- if (this.parentPath.isLabeledStatement() || t.isBlockStatement(this.container)) {
123
+ if (this.parentPath.isLabeledStatement() || t().isBlockStatement(this.container)) {
106
124
  return false;
107
125
  } else {
108
- return (0, _includes.default)(t.STATEMENT_OR_BLOCK_KEYS, this.key);
126
+ return (0, _includes().default)(t().STATEMENT_OR_BLOCK_KEYS, this.key);
109
127
  }
110
128
  }
111
129
 
@@ -198,7 +216,7 @@ function _guessExecutionStatusRelativeTo(target) {
198
216
  return targetRelationship.key > selfRelationship.key ? "before" : "after";
199
217
  }
200
218
 
201
- var keys = t.VISITOR_KEYS[commonPath.type];
219
+ var keys = t().VISITOR_KEYS[commonPath.type];
202
220
  var targetKeyPosition = keys.indexOf(targetRelationship.key);
203
221
  var selfKeyPosition = keys.indexOf(selfRelationship.key);
204
222
  return targetKeyPosition > selfKeyPosition ? "before" : "after";
@@ -223,9 +241,9 @@ function _guessExecutionStatusRelativeToDifferentFunctions(targetFuncParent) {
223
241
  _ref = _i.value;
224
242
  }
225
243
 
226
- var _path2 = _ref;
244
+ var path = _ref;
227
245
 
228
- if (_path2.key !== "callee" || !_path2.parentPath.isCallExpression()) {
246
+ if (path.key !== "callee" || !path.parentPath.isCallExpression()) {
229
247
  return;
230
248
  }
231
249
  }
@@ -244,13 +262,13 @@ function _guessExecutionStatusRelativeToDifferentFunctions(targetFuncParent) {
244
262
  _ref2 = _i2.value;
245
263
  }
246
264
 
247
- var _path3 = _ref2;
248
- var childOfFunction = !!_path3.find(function (path) {
265
+ var _path = _ref2;
266
+ var childOfFunction = !!_path.find(function (path) {
249
267
  return path.node === targetFuncPath.node;
250
268
  });
251
269
  if (childOfFunction) continue;
252
270
 
253
- var status = this._guessExecutionStatusRelativeTo(_path3);
271
+ var status = this._guessExecutionStatusRelativeTo(_path);
254
272
 
255
273
  if (allStatus) {
256
274
  if (allStatus !== status) return;
@@ -292,7 +310,7 @@ function _resolve(dangerous, resolved) {
292
310
  return this.get("expression").resolve(dangerous, resolved);
293
311
  } else if (dangerous && this.isMemberExpression()) {
294
312
  var targetKey = this.toComputedKey();
295
- if (!t.isLiteral(targetKey)) return;
313
+ if (!t().isLiteral(targetKey)) return;
296
314
  var targetName = targetKey.value;
297
315
  var target = this.get("object").resolve(dangerous, resolved);
298
316
 
@@ -1,15 +1,25 @@
1
1
  "use strict";
2
2
 
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
4
6
  exports.default = void 0;
5
7
 
6
- var t = _interopRequireWildcard(require("@babel/types"));
8
+ function t() {
9
+ var data = _interopRequireWildcard(require("@babel/types"));
10
+
11
+ t = function t() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
7
17
 
8
18
  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; } }
9
19
 
10
20
  var referenceVisitor = {
11
21
  ReferencedIdentifier: function ReferencedIdentifier(path, state) {
12
- if (path.isJSXIdentifier() && t.react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) {
22
+ if (path.isJSXIdentifier() && t().react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) {
13
23
  return;
14
24
  }
15
25
 
@@ -164,16 +174,20 @@ var PathHoister = function () {
164
174
  if (!attachTo) return;
165
175
  if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return;
166
176
  var uid = attachTo.scope.generateUidIdentifier("ref");
167
- var declarator = t.variableDeclarator(uid, this.path.node);
177
+ var declarator = t().variableDeclarator(uid, this.path.node);
168
178
  var insertFn = this.attachAfter ? "insertAfter" : "insertBefore";
169
- attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : t.variableDeclaration("var", [declarator])]);
179
+
180
+ var _attachTo$insertFn = attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : t().variableDeclaration("var", [declarator])]),
181
+ attached = _attachTo$insertFn[0];
182
+
170
183
  var parent = this.path.parentPath;
171
184
 
172
185
  if (parent.isJSXElement() && this.path.container === parent.node.children) {
173
- uid = t.JSXExpressionContainer(uid);
186
+ uid = t().JSXExpressionContainer(uid);
174
187
  }
175
188
 
176
- this.path.replaceWith(t.cloneNode(uid));
189
+ this.path.replaceWith(t().cloneNode(uid));
190
+ return attachTo.isVariableDeclarator() ? attached.get("init") : attached.get("declarations.0.init");
177
191
  };
178
192
 
179
193
  return PathHoister;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
4
6
  exports.hooks = void 0;
5
7
  var hooks = [function (self, parent) {
6
8
  var removeParent = self.key === "test" && (parent.isWhile() || parent.isSwitchCase()) || self.key === "declaration" && parent.isExportDeclaration() || self.key === "body" && parent.isLabeledStatement() || self.listKey === "declarations" && parent.isVariableDeclaration() && parent.node.declarations.length === 1 || self.key === "expression" && parent.isExpressionStatement();
@@ -1,9 +1,19 @@
1
1
  "use strict";
2
2
 
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
4
6
  exports.ForAwaitStatement = exports.NumericLiteralTypeAnnotation = exports.ExistentialTypeParam = exports.SpreadProperty = exports.RestProperty = exports.Flow = exports.Pure = exports.Generated = exports.User = exports.Var = exports.BlockScoped = exports.Referenced = exports.Scope = exports.Expression = exports.Statement = exports.BindingIdentifier = exports.ReferencedMemberExpression = exports.ReferencedIdentifier = void 0;
5
7
 
6
- var t = _interopRequireWildcard(require("@babel/types"));
8
+ function t() {
9
+ var data = _interopRequireWildcard(require("@babel/types"));
10
+
11
+ t = function t() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
7
17
 
8
18
  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; } }
9
19
 
@@ -13,15 +23,15 @@ var ReferencedIdentifier = {
13
23
  var node = _ref.node,
14
24
  parent = _ref.parent;
15
25
 
16
- if (!t.isIdentifier(node, opts) && !t.isJSXMemberExpression(parent, opts)) {
17
- if (t.isJSXIdentifier(node, opts)) {
18
- if (t.react.isCompatTag(node.name)) return false;
26
+ if (!t().isIdentifier(node, opts) && !t().isJSXMemberExpression(parent, opts)) {
27
+ if (t().isJSXIdentifier(node, opts)) {
28
+ if (t().react.isCompatTag(node.name)) return false;
19
29
  } else {
20
30
  return false;
21
31
  }
22
32
  }
23
33
 
24
- return t.isReferenced(node, parent);
34
+ return t().isReferenced(node, parent);
25
35
  }
26
36
  };
27
37
  exports.ReferencedIdentifier = ReferencedIdentifier;
@@ -30,7 +40,7 @@ var ReferencedMemberExpression = {
30
40
  checkPath: function checkPath(_ref2) {
31
41
  var node = _ref2.node,
32
42
  parent = _ref2.parent;
33
- return t.isMemberExpression(node) && t.isReferenced(node, parent);
43
+ return t().isMemberExpression(node) && t().isReferenced(node, parent);
34
44
  }
35
45
  };
36
46
  exports.ReferencedMemberExpression = ReferencedMemberExpression;
@@ -39,7 +49,7 @@ var BindingIdentifier = {
39
49
  checkPath: function checkPath(_ref3) {
40
50
  var node = _ref3.node,
41
51
  parent = _ref3.parent;
42
- return t.isIdentifier(node) && t.isBinding(node, parent);
52
+ return t().isIdentifier(node) && t().isBinding(node, parent);
43
53
  }
44
54
  };
45
55
  exports.BindingIdentifier = BindingIdentifier;
@@ -49,12 +59,12 @@ var Statement = {
49
59
  var node = _ref4.node,
50
60
  parent = _ref4.parent;
51
61
 
52
- if (t.isStatement(node)) {
53
- if (t.isVariableDeclaration(node)) {
54
- if (t.isForXStatement(parent, {
62
+ if (t().isStatement(node)) {
63
+ if (t().isVariableDeclaration(node)) {
64
+ if (t().isForXStatement(parent, {
55
65
  left: node
56
66
  })) return false;
57
- if (t.isForStatement(parent, {
67
+ if (t().isForStatement(parent, {
58
68
  init: node
59
69
  })) return false;
60
70
  }
@@ -72,7 +82,7 @@ var Expression = {
72
82
  if (path.isIdentifier()) {
73
83
  return path.isReferencedIdentifier();
74
84
  } else {
75
- return t.isExpression(path.node);
85
+ return t().isExpression(path.node);
76
86
  }
77
87
  }
78
88
  };
@@ -80,26 +90,26 @@ exports.Expression = Expression;
80
90
  var Scope = {
81
91
  types: ["Scopable"],
82
92
  checkPath: function checkPath(path) {
83
- return t.isScope(path.node, path.parent);
93
+ return t().isScope(path.node, path.parent);
84
94
  }
85
95
  };
86
96
  exports.Scope = Scope;
87
97
  var Referenced = {
88
98
  checkPath: function checkPath(path) {
89
- return t.isReferenced(path.node, path.parent);
99
+ return t().isReferenced(path.node, path.parent);
90
100
  }
91
101
  };
92
102
  exports.Referenced = Referenced;
93
103
  var BlockScoped = {
94
104
  checkPath: function checkPath(path) {
95
- return t.isBlockScoped(path.node);
105
+ return t().isBlockScoped(path.node);
96
106
  }
97
107
  };
98
108
  exports.BlockScoped = BlockScoped;
99
109
  var Var = {
100
110
  types: ["VariableDeclaration"],
101
111
  checkPath: function checkPath(path) {
102
- return t.isVar(path.node);
112
+ return t().isVar(path.node);
103
113
  }
104
114
  };
105
115
  exports.Var = Var;
@@ -126,13 +136,13 @@ var Flow = {
126
136
  checkPath: function checkPath(_ref5) {
127
137
  var node = _ref5.node;
128
138
 
129
- if (t.isFlow(node)) {
139
+ if (t().isFlow(node)) {
130
140
  return true;
131
- } else if (t.isImportDeclaration(node)) {
141
+ } else if (t().isImportDeclaration(node)) {
132
142
  return node.importKind === "type" || node.importKind === "typeof";
133
- } else if (t.isExportDeclaration(node)) {
143
+ } else if (t().isExportDeclaration(node)) {
134
144
  return node.exportKind === "type";
135
- } else if (t.isImportSpecifier(node)) {
145
+ } else if (t().isImportSpecifier(node)) {
136
146
  return node.importKind === "type" || node.importKind === "typeof";
137
147
  } else {
138
148
  return false;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
4
6
  exports.insertBefore = insertBefore;
5
7
  exports._containerInsert = _containerInsert;
6
8
  exports._containerInsertBefore = _containerInsertBefore;
@@ -18,7 +20,15 @@ var _hoister = _interopRequireDefault(require("./lib/hoister"));
18
20
 
19
21
  var _index = _interopRequireDefault(require("./index"));
20
22
 
21
- var t = _interopRequireWildcard(require("@babel/types"));
23
+ function t() {
24
+ var data = _interopRequireWildcard(require("@babel/types"));
25
+
26
+ t = function t() {
27
+ return data;
28
+ };
29
+
30
+ return data;
31
+ }
22
32
 
23
33
  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; } }
24
34
 
@@ -38,7 +48,7 @@ function insertBefore(nodes) {
38
48
  return this._containerInsertBefore(nodes);
39
49
  } else if (this.isStatementOrBlock()) {
40
50
  var shouldInsertCurrentNode = this.node && (!this.isExpressionStatement() || this.node.expression != null);
41
- this.replaceWith(t.blockStatement(shouldInsertCurrentNode ? [this.node] : []));
51
+ this.replaceWith(t().blockStatement(shouldInsertCurrentNode ? [this.node] : []));
42
52
  return this.unshiftContainer("body", nodes);
43
53
  } else {
44
54
  throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
@@ -84,9 +94,8 @@ function _containerInsert(from, nodes) {
84
94
  _ref = _i2.value;
85
95
  }
86
96
 
87
- var _context = _ref;
88
-
89
- _context.maybeQueue(_path, true);
97
+ var context = _ref;
98
+ context.maybeQueue(_path, true);
90
99
  }
91
100
  }
92
101
 
@@ -111,8 +120,8 @@ function insertAfter(nodes) {
111
120
  } else if (this.isNodeType("Expression") || this.parentPath.isForStatement() && this.key === "init") {
112
121
  if (this.node) {
113
122
  var temp = this.scope.generateDeclaredUidIdentifier();
114
- nodes.unshift(t.expressionStatement(t.assignmentExpression("=", t.cloneNode(temp), this.node)));
115
- nodes.push(t.expressionStatement(t.cloneNode(temp)));
123
+ nodes.unshift(t().expressionStatement(t().assignmentExpression("=", t().cloneNode(temp), this.node)));
124
+ nodes.push(t().expressionStatement(t().cloneNode(temp)));
116
125
  }
117
126
 
118
127
  return this.replaceExpressionWithStatements(nodes);
@@ -120,7 +129,7 @@ function insertAfter(nodes) {
120
129
  return this._containerInsertAfter(nodes);
121
130
  } else if (this.isStatementOrBlock()) {
122
131
  var shouldInsertCurrentNode = this.node && (!this.isExpressionStatement() || this.node.expression != null);
123
- this.replaceWith(t.blockStatement(shouldInsertCurrentNode ? [this.node] : []));
132
+ this.replaceWith(t().blockStatement(shouldInsertCurrentNode ? [this.node] : []));
124
133
  return this.pushContainer("body", nodes);
125
134
  } else {
126
135
  throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
4
6
  exports.remove = remove;
5
7
  exports._removeFromScope = _removeFromScope;
6
8
  exports._callRemovalHooks = _callRemovalHooks;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
4
6
  exports.replaceWithMultiple = replaceWithMultiple;
5
7
  exports.replaceWithSourceString = replaceWithSourceString;
6
8
  exports.replaceWith = replaceWith;
@@ -8,15 +10,39 @@ exports._replaceWith = _replaceWith;
8
10
  exports.replaceExpressionWithStatements = replaceExpressionWithStatements;
9
11
  exports.replaceInline = replaceInline;
10
12
 
11
- var _codeFrame = require("@babel/code-frame");
13
+ function _codeFrame() {
14
+ var data = require("@babel/code-frame");
15
+
16
+ _codeFrame = function _codeFrame() {
17
+ return data;
18
+ };
19
+
20
+ return data;
21
+ }
12
22
 
13
23
  var _index = _interopRequireDefault(require("../index"));
14
24
 
15
25
  var _index2 = _interopRequireDefault(require("./index"));
16
26
 
17
- var _babylon = require("babylon");
27
+ function _babylon() {
28
+ var data = require("babylon");
29
+
30
+ _babylon = function _babylon() {
31
+ return data;
32
+ };
33
+
34
+ return data;
35
+ }
36
+
37
+ function t() {
38
+ var data = _interopRequireWildcard(require("@babel/types"));
18
39
 
19
- var t = _interopRequireWildcard(require("@babel/types"));
40
+ t = function t() {
41
+ return data;
42
+ };
43
+
44
+ return data;
45
+ }
20
46
 
21
47
  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; } }
22
48
 
@@ -43,7 +69,7 @@ var hoistVariablesVisitor = {
43
69
  var declar = _arr[_i];
44
70
 
45
71
  if (declar.init) {
46
- exprs.push(t.expressionStatement(t.assignmentExpression("=", declar.id, declar.init)));
72
+ exprs.push(t().expressionStatement(t().assignmentExpression("=", declar.id, declar.init)));
47
73
  }
48
74
  }
49
75
 
@@ -54,8 +80,8 @@ var hoistVariablesVisitor = {
54
80
  function replaceWithMultiple(nodes) {
55
81
  this.resync();
56
82
  nodes = this._verifyNodeList(nodes);
57
- t.inheritLeadingComments(nodes[0], this.node);
58
- t.inheritTrailingComments(nodes[nodes.length - 1], this.node);
83
+ t().inheritLeadingComments(nodes[0], this.node);
84
+ t().inheritTrailingComments(nodes[nodes.length - 1], this.node);
59
85
  this.node = this.container[this.key] = null;
60
86
  var paths = this.insertAfter(nodes);
61
87
 
@@ -73,12 +99,12 @@ function replaceWithSourceString(replacement) {
73
99
 
74
100
  try {
75
101
  replacement = "(" + replacement + ")";
76
- replacement = (0, _babylon.parse)(replacement);
102
+ replacement = (0, _babylon().parse)(replacement);
77
103
  } catch (err) {
78
104
  var loc = err.loc;
79
105
 
80
106
  if (loc) {
81
- err.message += " - make sure this is an expression.\n" + (0, _codeFrame.codeFrameColumns)(replacement, {
107
+ err.message += " - make sure this is an expression.\n" + (0, _codeFrame().codeFrameColumns)(replacement, {
82
108
  start: {
83
109
  line: loc.line,
84
110
  column: loc.column + 1
@@ -116,7 +142,7 @@ function replaceWith(replacement) {
116
142
  return [this];
117
143
  }
118
144
 
119
- if (this.isProgram() && !t.isProgram(replacement)) {
145
+ if (this.isProgram() && !t().isProgram(replacement)) {
120
146
  throw new Error("You can only replace a Program root node with another Program node");
121
147
  }
122
148
 
@@ -130,14 +156,14 @@ function replaceWith(replacement) {
130
156
 
131
157
  var nodePath = "";
132
158
 
133
- if (this.isNodeType("Statement") && t.isExpression(replacement)) {
159
+ if (this.isNodeType("Statement") && t().isExpression(replacement)) {
134
160
  if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement) && !this.parentPath.isExportDefaultDeclaration()) {
135
- replacement = t.expressionStatement(replacement);
161
+ replacement = t().expressionStatement(replacement);
136
162
  nodePath = "expression";
137
163
  }
138
164
  }
139
165
 
140
- if (this.isNodeType("Expression") && t.isStatement(replacement)) {
166
+ if (this.isNodeType("Expression") && t().isStatement(replacement)) {
141
167
  if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {
142
168
  return this.replaceExpressionWithStatements([replacement]);
143
169
  }
@@ -146,8 +172,8 @@ function replaceWith(replacement) {
146
172
  var oldNode = this.node;
147
173
 
148
174
  if (oldNode) {
149
- t.inheritsComments(replacement, oldNode);
150
- t.removeComments(oldNode);
175
+ t().inheritsComments(replacement, oldNode);
176
+ t().removeComments(oldNode);
151
177
  }
152
178
 
153
179
  this._replaceWith(replacement);
@@ -164,9 +190,9 @@ function _replaceWith(node) {
164
190
  }
165
191
 
166
192
  if (this.inList) {
167
- t.validate(this.parent, this.key, [node]);
193
+ t().validate(this.parent, this.key, [node]);
168
194
  } else {
169
- t.validate(this.parent, this.key, node);
195
+ t().validate(this.parent, this.key, node);
170
196
  }
171
197
 
172
198
  this.debug("Replace with " + (node && node.type));
@@ -175,14 +201,14 @@ function _replaceWith(node) {
175
201
 
176
202
  function replaceExpressionWithStatements(nodes) {
177
203
  this.resync();
178
- var toSequenceExpression = t.toSequenceExpression(nodes, this.scope);
204
+ var toSequenceExpression = t().toSequenceExpression(nodes, this.scope);
179
205
 
180
206
  if (toSequenceExpression) {
181
207
  return this.replaceWith(toSequenceExpression)[0].get("expressions");
182
208
  }
183
209
 
184
- var container = t.arrowFunctionExpression([], t.blockStatement(nodes));
185
- this.replaceWith(t.callExpression(container, []));
210
+ var container = t().arrowFunctionExpression([], t().blockStatement(nodes));
211
+ this.replaceWith(t().callExpression(container, []));
186
212
  this.traverse(hoistVariablesVisitor);
187
213
  var completionRecords = this.get("callee").getCompletionRecords();
188
214
 
@@ -198,10 +224,9 @@ function replaceExpressionWithStatements(nodes) {
198
224
  _ref = _i2.value;
199
225
  }
200
226
 
201
- var _path = _ref;
202
- if (!_path.isExpressionStatement()) continue;
203
-
204
- var loop = _path.findParent(function (path) {
227
+ var path = _ref;
228
+ if (!path.isExpressionStatement()) continue;
229
+ var loop = path.findParent(function (path) {
205
230
  return path.isLoop();
206
231
  });
207
232
 
@@ -213,16 +238,16 @@ function replaceExpressionWithStatements(nodes) {
213
238
 
214
239
  uid = _callee.scope.generateDeclaredUidIdentifier("ret");
215
240
 
216
- _callee.get("body").pushContainer("body", t.returnStatement(t.cloneNode(uid)));
241
+ _callee.get("body").pushContainer("body", t().returnStatement(t().cloneNode(uid)));
217
242
 
218
243
  loop.setData("expressionReplacementReturnUid", uid);
219
244
  } else {
220
- uid = t.identifier(uid.name);
245
+ uid = t().identifier(uid.name);
221
246
  }
222
247
 
223
- _path.get("expression").replaceWith(t.assignmentExpression("=", t.cloneNode(uid), _path.node.expression));
248
+ path.get("expression").replaceWith(t().assignmentExpression("=", t().cloneNode(uid), path.node.expression));
224
249
  } else {
225
- _path.replaceWith(t.returnStatement(_path.node.expression));
250
+ path.replaceWith(t().returnStatement(path.node.expression));
226
251
  }
227
252
  }
228
253
 
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
4
6
  exports.default = void 0;
5
7
 
6
8
  var Binding = function () {