babel-schmooze-sprockets 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/bin/console +14 -0
  3. data/bin/export-external-helpers +3 -0
  4. data/bin/setup +6 -0
  5. data/bin/update-npm-deps +8 -0
  6. data/examples/myapp/Gemfile +4 -5
  7. data/examples/myapp/Gemfile.lock +69 -93
  8. data/examples/myapp/app/assets/javascripts/code/hello.es6 +5 -1
  9. data/examples/myapp/app/views/layouts/application.html.erb +1 -0
  10. data/examples/myapp/app/views/site/home.html.erb +0 -1
  11. data/lib/babel-schmooze-sprockets/babel_processor.rb +6 -4
  12. data/lib/babel-schmooze-sprockets/engine.rb +1 -4
  13. data/lib/babel-schmooze-sprockets/version.rb +1 -1
  14. data/node_modules/amdefine/package.json +8 -1
  15. data/node_modules/babel-core/node_modules/babel-runtime/package.json +9 -5
  16. data/node_modules/babel-core/node_modules/babel-traverse/.npmignore +3 -0
  17. data/node_modules/babel-core/node_modules/babel-traverse/README.md +1 -0
  18. data/node_modules/babel-core/node_modules/babel-traverse/lib/cache.js +20 -0
  19. data/node_modules/babel-core/node_modules/babel-traverse/lib/context.js +219 -0
  20. data/node_modules/babel-core/node_modules/babel-traverse/lib/hub.js +19 -0
  21. data/node_modules/babel-core/node_modules/babel-traverse/lib/index.js +250 -0
  22. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/ancestry.js +317 -0
  23. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/comments.js +55 -0
  24. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/context.js +297 -0
  25. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/conversion.js +48 -0
  26. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/evaluation.js +406 -0
  27. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/family.js +168 -0
  28. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/index.js +245 -0
  29. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/inference/index.js +151 -0
  30. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/inference/inferer-reference.js +225 -0
  31. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/inference/inferers.js +198 -0
  32. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/introspection.js +518 -0
  33. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/lib/hoister.js +166 -0
  34. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/lib/removal-hooks.js +64 -0
  35. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/lib/virtual-types.js +141 -0
  36. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/modification.js +293 -0
  37. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/removal.js +72 -0
  38. data/node_modules/babel-core/node_modules/babel-traverse/lib/path/replacement.js +302 -0
  39. data/node_modules/babel-core/node_modules/babel-traverse/lib/scope/binding.js +105 -0
  40. data/node_modules/babel-core/node_modules/babel-traverse/lib/scope/index.js +1222 -0
  41. data/node_modules/babel-core/node_modules/babel-traverse/lib/scope/lib/renamer.js +154 -0
  42. data/node_modules/babel-core/node_modules/babel-traverse/lib/visitors.js +360 -0
  43. data/node_modules/babel-core/node_modules/babel-traverse/package.json +107 -0
  44. data/node_modules/babel-core/node_modules/core-js/package.json +20 -2
  45. data/node_modules/babel-core/package.json +31 -24
  46. data/node_modules/babel-generator/lib/buffer.js +69 -70
  47. data/node_modules/babel-generator/lib/generators/base.js +16 -12
  48. data/node_modules/babel-generator/lib/generators/classes.js +28 -19
  49. data/node_modules/babel-generator/lib/generators/expressions.js +76 -99
  50. data/node_modules/babel-generator/lib/generators/flow.js +178 -119
  51. data/node_modules/babel-generator/lib/generators/jsx.js +38 -29
  52. data/node_modules/babel-generator/lib/generators/methods.js +34 -25
  53. data/node_modules/babel-generator/lib/generators/modules.js +67 -40
  54. data/node_modules/babel-generator/lib/generators/statements.js +93 -76
  55. data/node_modules/babel-generator/lib/generators/template-literals.js +12 -11
  56. data/node_modules/babel-generator/lib/generators/types.js +56 -49
  57. data/node_modules/babel-generator/lib/index.js +52 -39
  58. data/node_modules/babel-generator/lib/node/index.js +12 -18
  59. data/node_modules/babel-generator/lib/node/parentheses.js +23 -27
  60. data/node_modules/babel-generator/lib/node/whitespace.js +20 -26
  61. data/node_modules/babel-generator/lib/position.js +5 -5
  62. data/node_modules/babel-generator/lib/printer.js +52 -81
  63. data/node_modules/babel-generator/lib/source-map.js +9 -11
  64. data/node_modules/babel-generator/lib/whitespace.js +13 -13
  65. data/node_modules/babel-generator/node_modules/babel-runtime/package.json +19 -6
  66. data/node_modules/babel-generator/node_modules/babel-types/.npmignore +3 -0
  67. data/node_modules/babel-generator/node_modules/babel-types/README.md +1141 -0
  68. data/node_modules/babel-generator/node_modules/babel-types/lib/constants.js +40 -0
  69. data/node_modules/babel-generator/node_modules/babel-types/lib/converters.js +378 -0
  70. data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/core.js +704 -0
  71. data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/es2015.js +354 -0
  72. data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/experimental.js +85 -0
  73. data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/flow.js +319 -0
  74. data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/index.js +247 -0
  75. data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/init.js +15 -0
  76. data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/jsx.js +137 -0
  77. data/node_modules/babel-generator/node_modules/babel-types/lib/definitions/misc.js +21 -0
  78. data/node_modules/babel-generator/node_modules/babel-types/lib/flow.js +129 -0
  79. data/node_modules/babel-generator/node_modules/babel-types/lib/index.js +848 -0
  80. data/node_modules/babel-generator/node_modules/babel-types/lib/react.js +83 -0
  81. data/node_modules/babel-generator/node_modules/babel-types/lib/retrievers.js +123 -0
  82. data/node_modules/babel-generator/node_modules/babel-types/lib/validators.js +276 -0
  83. data/node_modules/babel-generator/node_modules/babel-types/package.json +103 -0
  84. data/node_modules/babel-generator/node_modules/core-js/package.json +10 -5
  85. data/node_modules/babel-generator/package.json +19 -16
  86. data/node_modules/babel-helpers/node_modules/babel-runtime/package.json +19 -3
  87. data/node_modules/babel-helpers/node_modules/core-js/package.json +20 -4
  88. data/node_modules/babel-helpers/package.json +8 -1
  89. data/node_modules/babel-register/node_modules/babel-runtime/package.json +19 -3
  90. data/node_modules/babel-register/node_modules/core-js/package.json +20 -4
  91. data/node_modules/babel-register/package.json +8 -1
  92. data/node_modules/balanced-match/package.json +8 -1
  93. data/node_modules/brace-expansion/package.json +19 -12
  94. data/node_modules/concat-map/package.json +9 -2
  95. data/node_modules/convert-source-map/package.json +8 -1
  96. data/node_modules/detect-indent/package.json +8 -1
  97. data/node_modules/get-stdin/package.json +8 -1
  98. data/node_modules/home-or-tmp/package.json +9 -2
  99. data/node_modules/is-finite/package.json +8 -2
  100. data/node_modules/json5/package.json +8 -1
  101. data/node_modules/minimatch/README.md +2 -9
  102. data/node_modules/minimatch/minimatch.js +15 -3
  103. data/node_modules/minimatch/package.json +29 -21
  104. data/node_modules/minimist/package.json +8 -1
  105. data/node_modules/mkdirp/node_modules/minimist/package.json +8 -1
  106. data/node_modules/mkdirp/package.json +8 -1
  107. data/node_modules/number-is-nan/package.json +8 -1
  108. data/node_modules/os-tmpdir/package.json +8 -1
  109. data/node_modules/path-exists/package.json +8 -1
  110. data/node_modules/path-is-absolute/package.json +8 -1
  111. data/node_modules/repeating/package.json +15 -11
  112. data/node_modules/shebang-regex/package.json +8 -1
  113. data/node_modules/slash/package.json +8 -1
  114. data/node_modules/source-map-support/node_modules/source-map/package.json +8 -1
  115. data/node_modules/source-map-support/package.json +8 -1
  116. data/node_modules/source-map/package.json +8 -1
  117. data/node_modules/user-home/package.json +8 -1
  118. data/package.json +1 -1
  119. metadata +54 -6
  120. data/node_modules/brace-expansion/.npmignore +0 -3
  121. data/node_modules/brace-expansion/example.js +0 -8
  122. data/node_modules/minimatch/browser.js +0 -1159
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+
5
+ var _getIterator2 = require("babel-runtime/core-js/get-iterator");
6
+
7
+ var _getIterator3 = _interopRequireDefault(_getIterator2);
8
+
9
+ exports.remove = remove;
10
+ exports._callRemovalHooks = _callRemovalHooks;
11
+ exports._remove = _remove;
12
+ exports._markRemoved = _markRemoved;
13
+ exports._assertUnremoved = _assertUnremoved;
14
+
15
+ var _removalHooks = require("./lib/removal-hooks");
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
19
+ function remove() {
20
+ this._assertUnremoved();
21
+
22
+ this.resync();
23
+
24
+ if (this._callRemovalHooks()) {
25
+ this._markRemoved();
26
+ return;
27
+ }
28
+
29
+ this.shareCommentsWithSiblings();
30
+ this._remove();
31
+ this._markRemoved();
32
+ } // This file contains methods responsible for removing a node.
33
+
34
+ function _callRemovalHooks() {
35
+ for (var _iterator = _removalHooks.hooks, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
36
+ var _ref;
37
+
38
+ if (_isArray) {
39
+ if (_i >= _iterator.length) break;
40
+ _ref = _iterator[_i++];
41
+ } else {
42
+ _i = _iterator.next();
43
+ if (_i.done) break;
44
+ _ref = _i.value;
45
+ }
46
+
47
+ var fn = _ref;
48
+
49
+ if (fn(this, this.parentPath)) return true;
50
+ }
51
+ }
52
+
53
+ function _remove() {
54
+ if (Array.isArray(this.container)) {
55
+ this.container.splice(this.key, 1);
56
+ this.updateSiblingKeys(this.key, -1);
57
+ } else {
58
+ this._replaceWith(null);
59
+ }
60
+ }
61
+
62
+ function _markRemoved() {
63
+ this.shouldSkip = true;
64
+ this.removed = true;
65
+ this.node = null;
66
+ }
67
+
68
+ function _assertUnremoved() {
69
+ if (this.removed) {
70
+ throw this.buildCodeFrameError("NodePath has been removed so is read-only.");
71
+ }
72
+ }
@@ -0,0 +1,302 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+
5
+ var _getIterator2 = require("babel-runtime/core-js/get-iterator");
6
+
7
+ var _getIterator3 = _interopRequireDefault(_getIterator2);
8
+
9
+ exports.replaceWithMultiple = replaceWithMultiple;
10
+ exports.replaceWithSourceString = replaceWithSourceString;
11
+ exports.replaceWith = replaceWith;
12
+ exports._replaceWith = _replaceWith;
13
+ exports.replaceExpressionWithStatements = replaceExpressionWithStatements;
14
+ exports.replaceInline = replaceInline;
15
+
16
+ var _babelCodeFrame = require("babel-code-frame");
17
+
18
+ var _babelCodeFrame2 = _interopRequireDefault(_babelCodeFrame);
19
+
20
+ var _index = require("../index");
21
+
22
+ var _index2 = _interopRequireDefault(_index);
23
+
24
+ var _index3 = require("./index");
25
+
26
+ var _index4 = _interopRequireDefault(_index3);
27
+
28
+ var _babylon = require("babylon");
29
+
30
+ var _babelTypes = require("babel-types");
31
+
32
+ var t = _interopRequireWildcard(_babelTypes);
33
+
34
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
35
+
36
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
+
38
+ var hoistVariablesVisitor = {
39
+ Function: function Function(path) {
40
+ path.skip();
41
+ },
42
+ VariableDeclaration: function VariableDeclaration(path) {
43
+ if (path.node.kind !== "var") return;
44
+
45
+ var bindings = path.getBindingIdentifiers();
46
+ for (var key in bindings) {
47
+ path.scope.push({ id: bindings[key] });
48
+ }
49
+
50
+ var exprs = [];
51
+
52
+ for (var _iterator = path.node.declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
53
+ var _ref;
54
+
55
+ if (_isArray) {
56
+ if (_i >= _iterator.length) break;
57
+ _ref = _iterator[_i++];
58
+ } else {
59
+ _i = _iterator.next();
60
+ if (_i.done) break;
61
+ _ref = _i.value;
62
+ }
63
+
64
+ var declar = _ref;
65
+
66
+ if (declar.init) {
67
+ exprs.push(t.expressionStatement(t.assignmentExpression("=", declar.id, declar.init)));
68
+ }
69
+ }
70
+
71
+ path.replaceWithMultiple(exprs);
72
+ }
73
+ };
74
+
75
+ /**
76
+ * Replace a node with an array of multiple. This method performs the following steps:
77
+ *
78
+ * - Inherit the comments of first provided node with that of the current node.
79
+ * - Insert the provided nodes after the current node.
80
+ * - Remove the current node.
81
+ */
82
+
83
+ /* eslint max-len: 0 */
84
+ // This file contains methods responsible for replacing a node with another.
85
+
86
+ function replaceWithMultiple(nodes) {
87
+ this.resync();
88
+
89
+ nodes = this._verifyNodeList(nodes);
90
+ t.inheritLeadingComments(nodes[0], this.node);
91
+ t.inheritTrailingComments(nodes[nodes.length - 1], this.node);
92
+ this.node = this.container[this.key] = null;
93
+ this.insertAfter(nodes);
94
+
95
+ if (this.node) {
96
+ this.requeue();
97
+ } else {
98
+ this.remove();
99
+ }
100
+ }
101
+
102
+ /**
103
+ * Parse a string as an expression and replace the current node with the result.
104
+ *
105
+ * NOTE: This is typically not a good idea to use. Building source strings when
106
+ * transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's
107
+ * easier to use, your transforms will be extremely brittle.
108
+ */
109
+
110
+ function replaceWithSourceString(replacement) {
111
+ this.resync();
112
+
113
+ try {
114
+ replacement = "(" + replacement + ")";
115
+ replacement = (0, _babylon.parse)(replacement);
116
+ } catch (err) {
117
+ var loc = err.loc;
118
+ if (loc) {
119
+ err.message += " - make sure this is an expression.";
120
+ err.message += "\n" + (0, _babelCodeFrame2.default)(replacement, loc.line, loc.column + 1);
121
+ }
122
+ throw err;
123
+ }
124
+
125
+ replacement = replacement.program.body[0].expression;
126
+ _index2.default.removeProperties(replacement);
127
+ return this.replaceWith(replacement);
128
+ }
129
+
130
+ /**
131
+ * Replace the current node with another.
132
+ */
133
+
134
+ function replaceWith(replacement) {
135
+ this.resync();
136
+
137
+ if (this.removed) {
138
+ throw new Error("You can't replace this node, we've already removed it");
139
+ }
140
+
141
+ if (replacement instanceof _index4.default) {
142
+ replacement = replacement.node;
143
+ }
144
+
145
+ if (!replacement) {
146
+ throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead");
147
+ }
148
+
149
+ if (this.node === replacement) {
150
+ return;
151
+ }
152
+
153
+ if (this.isProgram() && !t.isProgram(replacement)) {
154
+ throw new Error("You can only replace a Program root node with another Program node");
155
+ }
156
+
157
+ if (Array.isArray(replacement)) {
158
+ throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`");
159
+ }
160
+
161
+ if (typeof replacement === "string") {
162
+ throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`");
163
+ }
164
+
165
+ if (this.isNodeType("Statement") && t.isExpression(replacement)) {
166
+ if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {
167
+ // replacing a statement with an expression so wrap it in an expression statement
168
+ replacement = t.expressionStatement(replacement);
169
+ }
170
+ }
171
+
172
+ if (this.isNodeType("Expression") && t.isStatement(replacement)) {
173
+ if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {
174
+ // replacing an expression with a statement so let's explode it
175
+ return this.replaceExpressionWithStatements([replacement]);
176
+ }
177
+ }
178
+
179
+ var oldNode = this.node;
180
+ if (oldNode) {
181
+ t.inheritsComments(replacement, oldNode);
182
+ t.removeComments(oldNode);
183
+ }
184
+
185
+ // replace the node
186
+ this._replaceWith(replacement);
187
+ this.type = replacement.type;
188
+
189
+ // potentially create new scope
190
+ this.setScope();
191
+
192
+ // requeue for visiting
193
+ this.requeue();
194
+ }
195
+
196
+ /**
197
+ * Description
198
+ */
199
+
200
+ function _replaceWith(node) {
201
+ if (!this.container) {
202
+ throw new ReferenceError("Container is falsy");
203
+ }
204
+
205
+ if (this.inList) {
206
+ t.validate(this.parent, this.key, [node]);
207
+ } else {
208
+ t.validate(this.parent, this.key, node);
209
+ }
210
+
211
+ this.debug(function () {
212
+ return "Replace with " + (node && node.type);
213
+ });
214
+
215
+ this.node = this.container[this.key] = node;
216
+ }
217
+
218
+ /**
219
+ * This method takes an array of statements nodes and then explodes it
220
+ * into expressions. This method retains completion records which is
221
+ * extremely important to retain original semantics.
222
+ */
223
+
224
+ function replaceExpressionWithStatements(nodes) {
225
+ this.resync();
226
+
227
+ var toSequenceExpression = t.toSequenceExpression(nodes, this.scope);
228
+
229
+ if (t.isSequenceExpression(toSequenceExpression)) {
230
+ var exprs = toSequenceExpression.expressions;
231
+
232
+ if (exprs.length >= 2 && this.parentPath.isExpressionStatement()) {
233
+ this._maybePopFromStatements(exprs);
234
+ }
235
+
236
+ // could be just one element due to the previous maybe popping
237
+ if (exprs.length === 1) {
238
+ this.replaceWith(exprs[0]);
239
+ } else {
240
+ this.replaceWith(toSequenceExpression);
241
+ }
242
+ } else if (toSequenceExpression) {
243
+ this.replaceWith(toSequenceExpression);
244
+ } else {
245
+ var container = t.functionExpression(null, [], t.blockStatement(nodes));
246
+ container.shadow = true;
247
+
248
+ this.replaceWith(t.callExpression(container, []));
249
+ this.traverse(hoistVariablesVisitor);
250
+
251
+ // add implicit returns to all ending expression statements
252
+ var completionRecords = this.get("callee").getCompletionRecords();
253
+ for (var _iterator2 = completionRecords, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
254
+ var _ref2;
255
+
256
+ if (_isArray2) {
257
+ if (_i2 >= _iterator2.length) break;
258
+ _ref2 = _iterator2[_i2++];
259
+ } else {
260
+ _i2 = _iterator2.next();
261
+ if (_i2.done) break;
262
+ _ref2 = _i2.value;
263
+ }
264
+
265
+ var path = _ref2;
266
+
267
+ if (!path.isExpressionStatement()) continue;
268
+
269
+ var loop = path.findParent(function (path) {
270
+ return path.isLoop();
271
+ });
272
+ if (loop) {
273
+ var callee = this.get("callee");
274
+
275
+ var uid = callee.scope.generateDeclaredUidIdentifier("ret");
276
+ callee.get("body").pushContainer("body", t.returnStatement(uid));
277
+
278
+ path.get("expression").replaceWith(t.assignmentExpression("=", uid, path.node.expression));
279
+ } else {
280
+ path.replaceWith(t.returnStatement(path.node.expression));
281
+ }
282
+ }
283
+
284
+ return this.node;
285
+ }
286
+ }
287
+
288
+ function replaceInline(nodes) {
289
+ this.resync();
290
+
291
+ if (Array.isArray(nodes)) {
292
+ if (Array.isArray(this.container)) {
293
+ nodes = this._verifyNodeList(nodes);
294
+ this._containerInsertAfter(nodes);
295
+ return this.remove();
296
+ } else {
297
+ return this.replaceWithMultiple(nodes);
298
+ }
299
+ } else {
300
+ return this.replaceWith(nodes);
301
+ }
302
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+
5
+ var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
6
+
7
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
8
+
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+
11
+ /**
12
+ * This class is responsible for a binding inside of a scope.
13
+ *
14
+ * It tracks the following:
15
+ *
16
+ * * Node path.
17
+ * * Amount of times referenced by other nodes.
18
+ * * Paths to nodes that reassign or modify this binding.
19
+ * * The kind of binding. (Is it a parameter, declaration etc)
20
+ */
21
+
22
+ var Binding = function () {
23
+ function Binding(_ref) {
24
+ var existing = _ref.existing;
25
+ var identifier = _ref.identifier;
26
+ var scope = _ref.scope;
27
+ var path = _ref.path;
28
+ var kind = _ref.kind;
29
+ (0, _classCallCheck3.default)(this, Binding);
30
+
31
+ this.identifier = identifier;
32
+ this.scope = scope;
33
+ this.path = path;
34
+ this.kind = kind;
35
+
36
+ this.constantViolations = [];
37
+ this.constant = true;
38
+
39
+ this.referencePaths = [];
40
+ this.referenced = false;
41
+ this.references = 0;
42
+
43
+ this.clearValue();
44
+
45
+ if (existing) {
46
+ this.constantViolations = [].concat(existing.path, existing.constantViolations, this.constantViolations);
47
+ }
48
+ }
49
+
50
+ Binding.prototype.deoptValue = function deoptValue() {
51
+ this.clearValue();
52
+ this.hasDeoptedValue = true;
53
+ };
54
+
55
+ Binding.prototype.setValue = function setValue(value) {
56
+ if (this.hasDeoptedValue) return;
57
+ this.hasValue = true;
58
+ this.value = value;
59
+ };
60
+
61
+ Binding.prototype.clearValue = function clearValue() {
62
+ this.hasDeoptedValue = false;
63
+ this.hasValue = false;
64
+ this.value = null;
65
+ };
66
+
67
+ /**
68
+ * Register a constant violation with the provided `path`.
69
+ */
70
+
71
+ Binding.prototype.reassign = function reassign(path) {
72
+ this.constant = false;
73
+ if (this.constantViolations.indexOf(path) !== -1) {
74
+ return;
75
+ }
76
+ this.constantViolations.push(path);
77
+ };
78
+
79
+ /**
80
+ * Increment the amount of references to this binding.
81
+ */
82
+
83
+ Binding.prototype.reference = function reference(path) {
84
+ if (this.referencePaths.indexOf(path) !== -1) {
85
+ return;
86
+ }
87
+ this.referenced = true;
88
+ this.references++;
89
+ this.referencePaths.push(path);
90
+ };
91
+
92
+ /**
93
+ * Decrement the amount of references to this binding.
94
+ */
95
+
96
+ Binding.prototype.dereference = function dereference() {
97
+ this.references--;
98
+ this.referenced = !!this.references;
99
+ };
100
+
101
+ return Binding;
102
+ }();
103
+
104
+ exports.default = Binding;
105
+ module.exports = exports["default"];