@babel/traverse 7.0.0-beta.5 → 7.0.0-beta.53

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.insertBefore = insertBefore;
5
7
  exports._containerInsert = _containerInsert;
6
8
  exports._containerInsertBefore = _containerInsertBefore;
@@ -18,29 +20,38 @@ 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
+ const data = _interopRequireWildcard(require("@babel/types"));
22
25
 
23
- 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)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
26
+ t = function () {
27
+ return data;
28
+ };
24
29
 
25
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
+ return data;
31
+ }
26
32
 
27
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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; } }
34
+
35
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
36
 
29
37
  function insertBefore(nodes) {
30
38
  this._assertUnremoved();
31
39
 
32
40
  nodes = this._verifyNodeList(nodes);
41
+ const {
42
+ parentPath
43
+ } = this;
33
44
 
34
- if (this.parentPath.isExpressionStatement() || this.parentPath.isLabeledStatement()) {
35
- return this.parentPath.insertBefore(nodes);
36
- } else if (this.isNodeType("Expression") && this.listKey !== "params" && this.listKey !== "arguments" || this.parentPath.isForStatement() && this.key === "init") {
45
+ if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || parentPath.isExportNamedDeclaration() || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) {
46
+ return parentPath.insertBefore(nodes);
47
+ } else if (this.isNodeType("Expression") && this.listKey !== "params" && this.listKey !== "arguments" || parentPath.isForStatement() && this.key === "init") {
37
48
  if (this.node) nodes.push(this.node);
38
49
  return this.replaceExpressionWithStatements(nodes);
39
50
  } else if (Array.isArray(this.container)) {
40
51
  return this._containerInsertBefore(nodes);
41
52
  } else if (this.isStatementOrBlock()) {
42
- var shouldInsertCurrentNode = this.node && (!this.isExpressionStatement() || this.node.expression != null);
43
- this.replaceWith(t.blockStatement(shouldInsertCurrentNode ? [this.node] : []));
53
+ const shouldInsertCurrentNode = this.node && (!this.isExpressionStatement() || this.node.expression != null);
54
+ this.replaceWith(t().blockStatement(shouldInsertCurrentNode ? [this.node] : []));
44
55
  return this.unshiftContainer("body", nodes);
45
56
  } else {
46
57
  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?");
@@ -48,16 +59,13 @@ function insertBefore(nodes) {
48
59
  }
49
60
 
50
61
  function _containerInsert(from, nodes) {
51
- var _container;
52
-
53
62
  this.updateSiblingKeys(from, nodes.length);
54
- var paths = [];
55
-
56
- (_container = this.container).splice.apply(_container, [from, 0].concat(nodes));
63
+ const paths = [];
64
+ this.container.splice(from, 0, ...nodes);
57
65
 
58
- for (var i = 0; i < nodes.length; i++) {
59
- var to = from + i;
60
- var path = this.getSibling("" + to);
66
+ for (let i = 0; i < nodes.length; i++) {
67
+ const to = from + i;
68
+ const path = this.getSibling(to);
61
69
  paths.push(path);
62
70
 
63
71
  if (this.context && this.context.queue) {
@@ -65,30 +73,14 @@ function _containerInsert(from, nodes) {
65
73
  }
66
74
  }
67
75
 
68
- var contexts = this._getQueueContexts();
69
-
70
- for (var _i = 0; _i < paths.length; _i++) {
71
- var _path = paths[_i];
72
-
73
- _path.setScope();
76
+ const contexts = this._getQueueContexts();
74
77
 
75
- _path.debug("Inserted.");
78
+ for (const path of paths) {
79
+ path.setScope();
80
+ path.debug("Inserted.");
76
81
 
77
- for (var _iterator = contexts, _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
78
- var _ref;
79
-
80
- if (_isArray) {
81
- if (_i2 >= _iterator.length) break;
82
- _ref = _iterator[_i2++];
83
- } else {
84
- _i2 = _iterator.next();
85
- if (_i2.done) break;
86
- _ref = _i2.value;
87
- }
88
-
89
- var _context = _ref;
90
-
91
- _context.maybeQueue(_path, true);
82
+ for (const context of contexts) {
83
+ context.maybeQueue(path, true);
92
84
  }
93
85
  }
94
86
 
@@ -107,22 +99,36 @@ function insertAfter(nodes) {
107
99
  this._assertUnremoved();
108
100
 
109
101
  nodes = this._verifyNodeList(nodes);
102
+ const {
103
+ parentPath
104
+ } = this;
110
105
 
111
- if (this.parentPath.isExpressionStatement() || this.parentPath.isLabeledStatement()) {
112
- return this.parentPath.insertAfter(nodes);
113
- } else if (this.isNodeType("Expression") || this.parentPath.isForStatement() && this.key === "init") {
106
+ if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || parentPath.isExportNamedDeclaration() || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) {
107
+ return parentPath.insertAfter(nodes);
108
+ } else if (this.isNodeType("Expression") || parentPath.isForStatement() && this.key === "init") {
114
109
  if (this.node) {
115
- var temp = this.scope.generateDeclaredUidIdentifier();
116
- nodes.unshift(t.expressionStatement(t.assignmentExpression("=", temp, this.node)));
117
- nodes.push(t.expressionStatement(temp));
110
+ let {
111
+ scope
112
+ } = this;
113
+
114
+ if (parentPath.isMethod({
115
+ computed: true,
116
+ key: this.node
117
+ })) {
118
+ scope = scope.parent;
119
+ }
120
+
121
+ const temp = scope.generateDeclaredUidIdentifier();
122
+ nodes.unshift(t().expressionStatement(t().assignmentExpression("=", t().cloneNode(temp), this.node)));
123
+ nodes.push(t().expressionStatement(t().cloneNode(temp)));
118
124
  }
119
125
 
120
126
  return this.replaceExpressionWithStatements(nodes);
121
127
  } else if (Array.isArray(this.container)) {
122
128
  return this._containerInsertAfter(nodes);
123
129
  } else if (this.isStatementOrBlock()) {
124
- var shouldInsertCurrentNode = this.node && (!this.isExpressionStatement() || this.node.expression != null);
125
- this.replaceWith(t.blockStatement(shouldInsertCurrentNode ? [this.node] : []));
130
+ const shouldInsertCurrentNode = this.node && (!this.isExpressionStatement() || this.node.expression != null);
131
+ this.replaceWith(t().blockStatement(shouldInsertCurrentNode ? [this.node] : []));
126
132
  return this.pushContainer("body", nodes);
127
133
  } else {
128
134
  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?");
@@ -132,10 +138,10 @@ function insertAfter(nodes) {
132
138
  function updateSiblingKeys(fromIndex, incrementBy) {
133
139
  if (!this.parent) return;
134
140
 
135
- var paths = _cache.path.get(this.parent);
141
+ const paths = _cache.path.get(this.parent);
136
142
 
137
- for (var i = 0; i < paths.length; i++) {
138
- var path = paths[i];
143
+ for (let i = 0; i < paths.length; i++) {
144
+ const path = paths[i];
139
145
 
140
146
  if (path.key >= fromIndex) {
141
147
  path.key += incrementBy;
@@ -152,13 +158,13 @@ function _verifyNodeList(nodes) {
152
158
  nodes = [nodes];
153
159
  }
154
160
 
155
- for (var i = 0; i < nodes.length; i++) {
156
- var node = nodes[i];
157
- var msg = void 0;
161
+ for (let i = 0; i < nodes.length; i++) {
162
+ const node = nodes[i];
163
+ let msg;
158
164
 
159
165
  if (!node) {
160
166
  msg = "has falsy node";
161
- } else if (_typeof(node) !== "object") {
167
+ } else if (typeof node !== "object") {
162
168
  msg = "contains a non-object node";
163
169
  } else if (!node.type) {
164
170
  msg = "without a type";
@@ -167,8 +173,8 @@ function _verifyNodeList(nodes) {
167
173
  }
168
174
 
169
175
  if (msg) {
170
- var type = Array.isArray(node) ? "array" : _typeof(node);
171
- throw new Error("Node list " + msg + " with the index of " + i + " and type of " + type);
176
+ const type = Array.isArray(node) ? "array" : typeof node;
177
+ throw new Error(`Node list ${msg} with the index of ${i} and type of ${type}`);
172
178
  }
173
179
  }
174
180
 
@@ -180,11 +186,11 @@ function unshiftContainer(listKey, nodes) {
180
186
 
181
187
  nodes = this._verifyNodeList(nodes);
182
188
 
183
- var path = _index.default.get({
189
+ const path = _index.default.get({
184
190
  parentPath: this,
185
191
  parent: this.node,
186
192
  container: this.node[listKey],
187
- listKey: listKey,
193
+ listKey,
188
194
  key: 0
189
195
  });
190
196
 
@@ -195,24 +201,20 @@ function pushContainer(listKey, nodes) {
195
201
  this._assertUnremoved();
196
202
 
197
203
  nodes = this._verifyNodeList(nodes);
198
- var container = this.node[listKey];
204
+ const container = this.node[listKey];
199
205
 
200
- var path = _index.default.get({
206
+ const path = _index.default.get({
201
207
  parentPath: this,
202
208
  parent: this.node,
203
209
  container: container,
204
- listKey: listKey,
210
+ listKey,
205
211
  key: container.length
206
212
  });
207
213
 
208
214
  return path.replaceWithMultiple(nodes);
209
215
  }
210
216
 
211
- function hoist(scope) {
212
- if (scope === void 0) {
213
- scope = this.scope;
214
- }
215
-
216
- var hoister = new _hoister.default(this, scope);
217
+ function hoist(scope = this.scope) {
218
+ const hoister = new _hoister.default(this, scope);
217
219
  return hoister.run();
218
220
  }
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
 
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
4
6
  exports.remove = remove;
7
+ exports._removeFromScope = _removeFromScope;
5
8
  exports._callRemovalHooks = _callRemovalHooks;
6
9
  exports._remove = _remove;
7
10
  exports._markRemoved = _markRemoved;
@@ -14,6 +17,8 @@ function remove() {
14
17
 
15
18
  this.resync();
16
19
 
20
+ this._removeFromScope();
21
+
17
22
  if (this._callRemovalHooks()) {
18
23
  this._markRemoved();
19
24
 
@@ -27,11 +32,13 @@ function remove() {
27
32
  this._markRemoved();
28
33
  }
29
34
 
30
- function _callRemovalHooks() {
31
- var _arr = _removalHooks.hooks;
35
+ function _removeFromScope() {
36
+ const bindings = this.getBindingIdentifiers();
37
+ Object.keys(bindings).forEach(name => this.scope.removeBinding(name));
38
+ }
32
39
 
33
- for (var _i = 0; _i < _arr.length; _i++) {
34
- var fn = _arr[_i];
40
+ function _callRemovalHooks() {
41
+ for (const fn of _removalHooks.hooks) {
35
42
  if (fn(this, this.parentPath)) return true;
36
43
  }
37
44
  }
@@ -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,56 +10,79 @@ 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
+ const data = require("@babel/code-frame");
15
+
16
+ _codeFrame = function () {
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 _parser() {
28
+ const data = require("@babel/parser");
29
+
30
+ _parser = function () {
31
+ return data;
32
+ };
33
+
34
+ return data;
35
+ }
36
+
37
+ function t() {
38
+ const data = _interopRequireWildcard(require("@babel/types"));
18
39
 
19
- var t = _interopRequireWildcard(require("@babel/types"));
40
+ t = function () {
41
+ return data;
42
+ };
20
43
 
21
- 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)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
44
+ return data;
45
+ }
46
+
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
 
23
49
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
50
 
25
- var hoistVariablesVisitor = {
26
- Function: function Function(path) {
51
+ const hoistVariablesVisitor = {
52
+ Function(path) {
27
53
  path.skip();
28
54
  },
29
- VariableDeclaration: function VariableDeclaration(path) {
55
+
56
+ VariableDeclaration(path) {
30
57
  if (path.node.kind !== "var") return;
31
- var bindings = path.getBindingIdentifiers();
58
+ const bindings = path.getBindingIdentifiers();
32
59
 
33
- for (var key in bindings) {
60
+ for (const key in bindings) {
34
61
  path.scope.push({
35
62
  id: bindings[key]
36
63
  });
37
64
  }
38
65
 
39
- var exprs = [];
40
- var _arr = path.node.declarations;
41
-
42
- for (var _i = 0; _i < _arr.length; _i++) {
43
- var declar = _arr[_i];
66
+ const exprs = [];
44
67
 
68
+ for (const declar of path.node.declarations) {
45
69
  if (declar.init) {
46
- exprs.push(t.expressionStatement(t.assignmentExpression("=", declar.id, declar.init)));
70
+ exprs.push(t().expressionStatement(t().assignmentExpression("=", declar.id, declar.init)));
47
71
  }
48
72
  }
49
73
 
50
74
  path.replaceWithMultiple(exprs);
51
75
  }
76
+
52
77
  };
53
78
 
54
79
  function replaceWithMultiple(nodes) {
55
80
  this.resync();
56
81
  nodes = this._verifyNodeList(nodes);
57
- t.inheritLeadingComments(nodes[0], this.node);
58
- t.inheritTrailingComments(nodes[nodes.length - 1], this.node);
82
+ t().inheritLeadingComments(nodes[0], this.node);
83
+ t().inheritTrailingComments(nodes[nodes.length - 1], this.node);
59
84
  this.node = this.container[this.key] = null;
60
- var paths = this.insertAfter(nodes);
85
+ const paths = this.insertAfter(nodes);
61
86
 
62
87
  if (this.node) {
63
88
  this.requeue();
@@ -72,19 +97,19 @@ function replaceWithSourceString(replacement) {
72
97
  this.resync();
73
98
 
74
99
  try {
75
- replacement = "(" + replacement + ")";
76
- replacement = (0, _babylon.parse)(replacement);
100
+ replacement = `(${replacement})`;
101
+ replacement = (0, _parser().parse)(replacement);
77
102
  } catch (err) {
78
- var loc = err.loc;
103
+ const loc = err.loc;
79
104
 
80
105
  if (loc) {
81
- err.loc = null;
82
- err.message += " - make sure this is an expression.\n" + (0, _codeFrame.codeFrameColumns)(replacement, {
106
+ err.message += " - make sure this is an expression.\n" + (0, _codeFrame().codeFrameColumns)(replacement, {
83
107
  start: {
84
108
  line: loc.line,
85
109
  column: loc.column + 1
86
110
  }
87
111
  });
112
+ err.code = "BABEL_REPLACE_SOURCE_ERROR";
88
113
  }
89
114
 
90
115
  throw err;
@@ -116,7 +141,7 @@ function replaceWith(replacement) {
116
141
  return [this];
117
142
  }
118
143
 
119
- if (this.isProgram() && !t.isProgram(replacement)) {
144
+ if (this.isProgram() && !t().isProgram(replacement)) {
120
145
  throw new Error("You can only replace a Program root node with another Program node");
121
146
  }
122
147
 
@@ -128,26 +153,26 @@ function replaceWith(replacement) {
128
153
  throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`");
129
154
  }
130
155
 
131
- var nodePath = "";
156
+ let nodePath = "";
132
157
 
133
- if (this.isNodeType("Statement") && t.isExpression(replacement)) {
158
+ if (this.isNodeType("Statement") && t().isExpression(replacement)) {
134
159
  if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement) && !this.parentPath.isExportDefaultDeclaration()) {
135
- replacement = t.expressionStatement(replacement);
160
+ replacement = t().expressionStatement(replacement);
136
161
  nodePath = "expression";
137
162
  }
138
163
  }
139
164
 
140
- if (this.isNodeType("Expression") && t.isStatement(replacement)) {
165
+ if (this.isNodeType("Expression") && t().isStatement(replacement)) {
141
166
  if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {
142
167
  return this.replaceExpressionWithStatements([replacement]);
143
168
  }
144
169
  }
145
170
 
146
- var oldNode = this.node;
171
+ const oldNode = this.node;
147
172
 
148
173
  if (oldNode) {
149
- t.inheritsComments(replacement, oldNode);
150
- t.removeComments(oldNode);
174
+ t().inheritsComments(replacement, oldNode);
175
+ t().removeComments(oldNode);
151
176
  }
152
177
 
153
178
  this._replaceWith(replacement);
@@ -164,69 +189,51 @@ function _replaceWith(node) {
164
189
  }
165
190
 
166
191
  if (this.inList) {
167
- t.validate(this.parent, this.key, [node]);
192
+ t().validate(this.parent, this.key, [node]);
168
193
  } else {
169
- t.validate(this.parent, this.key, node);
194
+ t().validate(this.parent, this.key, node);
170
195
  }
171
196
 
172
- this.debug("Replace with " + (node && node.type));
197
+ this.debug(`Replace with ${node && node.type}`);
173
198
  this.node = this.container[this.key] = node;
174
199
  }
175
200
 
176
201
  function replaceExpressionWithStatements(nodes) {
177
202
  this.resync();
178
- var toSequenceExpression = t.toSequenceExpression(nodes, this.scope);
203
+ const toSequenceExpression = t().toSequenceExpression(nodes, this.scope);
179
204
 
180
205
  if (toSequenceExpression) {
181
206
  return this.replaceWith(toSequenceExpression)[0].get("expressions");
182
207
  }
183
208
 
184
- var container = t.arrowFunctionExpression([], t.blockStatement(nodes));
185
- this.replaceWith(t.callExpression(container, []));
209
+ const container = t().arrowFunctionExpression([], t().blockStatement(nodes));
210
+ this.replaceWith(t().callExpression(container, []));
186
211
  this.traverse(hoistVariablesVisitor);
187
- var completionRecords = this.get("callee").getCompletionRecords();
188
-
189
- for (var _iterator = completionRecords, _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
190
- var _ref;
191
-
192
- if (_isArray) {
193
- if (_i2 >= _iterator.length) break;
194
- _ref = _iterator[_i2++];
195
- } else {
196
- _i2 = _iterator.next();
197
- if (_i2.done) break;
198
- _ref = _i2.value;
199
- }
200
-
201
- var _path = _ref;
202
- if (!_path.isExpressionStatement()) continue;
212
+ const completionRecords = this.get("callee").getCompletionRecords();
203
213
 
204
- var loop = _path.findParent(function (path) {
205
- return path.isLoop();
206
- });
214
+ for (const path of completionRecords) {
215
+ if (!path.isExpressionStatement()) continue;
216
+ const loop = path.findParent(path => path.isLoop());
207
217
 
208
218
  if (loop) {
209
- var uid = loop.getData("expressionReplacementReturnUid");
219
+ let uid = loop.getData("expressionReplacementReturnUid");
210
220
 
211
221
  if (!uid) {
212
- var _callee = this.get("callee");
213
-
214
- uid = _callee.scope.generateDeclaredUidIdentifier("ret");
215
-
216
- _callee.get("body").pushContainer("body", t.returnStatement(uid));
217
-
222
+ const callee = this.get("callee");
223
+ uid = callee.scope.generateDeclaredUidIdentifier("ret");
224
+ callee.get("body").pushContainer("body", t().returnStatement(t().cloneNode(uid)));
218
225
  loop.setData("expressionReplacementReturnUid", uid);
219
226
  } else {
220
- uid = t.identifier(uid.name);
227
+ uid = t().identifier(uid.name);
221
228
  }
222
229
 
223
- _path.get("expression").replaceWith(t.assignmentExpression("=", uid, _path.node.expression));
230
+ path.get("expression").replaceWith(t().assignmentExpression("=", t().cloneNode(uid), path.node.expression));
224
231
  } else {
225
- _path.replaceWith(t.returnStatement(_path.node.expression));
232
+ path.replaceWith(t().returnStatement(path.node.expression));
226
233
  }
227
234
  }
228
235
 
229
- var callee = this.get("callee");
236
+ const callee = this.get("callee");
230
237
  callee.arrowFunctionToExpression();
231
238
  return callee.get("body.body");
232
239
  }
@@ -238,7 +245,7 @@ function replaceInline(nodes) {
238
245
  if (Array.isArray(this.container)) {
239
246
  nodes = this._verifyNodeList(nodes);
240
247
 
241
- var paths = this._containerInsertAfter(nodes);
248
+ const paths = this._containerInsertAfter(nodes);
242
249
 
243
250
  this.remove();
244
251
  return paths;
@@ -1,14 +1,17 @@
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 Binding = function () {
7
- function Binding(_ref) {
8
- var identifier = _ref.identifier,
9
- scope = _ref.scope,
10
- path = _ref.path,
11
- kind = _ref.kind;
8
+ class Binding {
9
+ constructor({
10
+ identifier,
11
+ scope,
12
+ path,
13
+ kind
14
+ }) {
12
15
  this.identifier = identifier;
13
16
  this.scope = scope;
14
17
  this.path = path;
@@ -21,26 +24,24 @@ var Binding = function () {
21
24
  this.clearValue();
22
25
  }
23
26
 
24
- var _proto = Binding.prototype;
25
-
26
- _proto.deoptValue = function deoptValue() {
27
+ deoptValue() {
27
28
  this.clearValue();
28
29
  this.hasDeoptedValue = true;
29
- };
30
+ }
30
31
 
31
- _proto.setValue = function setValue(value) {
32
+ setValue(value) {
32
33
  if (this.hasDeoptedValue) return;
33
34
  this.hasValue = true;
34
35
  this.value = value;
35
- };
36
+ }
36
37
 
37
- _proto.clearValue = function clearValue() {
38
+ clearValue() {
38
39
  this.hasDeoptedValue = false;
39
40
  this.hasValue = false;
40
41
  this.value = null;
41
- };
42
+ }
42
43
 
43
- _proto.reassign = function reassign(path) {
44
+ reassign(path) {
44
45
  this.constant = false;
45
46
 
46
47
  if (this.constantViolations.indexOf(path) !== -1) {
@@ -48,9 +49,9 @@ var Binding = function () {
48
49
  }
49
50
 
50
51
  this.constantViolations.push(path);
51
- };
52
+ }
52
53
 
53
- _proto.reference = function reference(path) {
54
+ reference(path) {
54
55
  if (this.referencePaths.indexOf(path) !== -1) {
55
56
  return;
56
57
  }
@@ -58,14 +59,13 @@ var Binding = function () {
58
59
  this.referenced = true;
59
60
  this.references++;
60
61
  this.referencePaths.push(path);
61
- };
62
+ }
62
63
 
63
- _proto.dereference = function dereference() {
64
+ dereference() {
64
65
  this.references--;
65
66
  this.referenced = !!this.references;
66
- };
67
+ }
67
68
 
68
- return Binding;
69
- }();
69
+ }
70
70
 
71
71
  exports.default = Binding;