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.default = function (_ref) {
|
10
|
var messages = _ref.messages;
|
11
|
|
12
|
return {
|
13
|
visitor: {
|
14
|
Scope: function Scope(_ref2) {
|
15
|
var scope = _ref2.scope;
|
16
|
|
17
|
for (var name in scope.bindings) {
|
18
|
var binding = scope.bindings[name];
|
19
|
if (binding.kind !== "const" && binding.kind !== "module") continue;
|
20
|
|
21
|
for (var _iterator = binding.constantViolations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
|
22
|
var _ref3;
|
23
|
|
24
|
if (_isArray) {
|
25
|
if (_i >= _iterator.length) break;
|
26
|
_ref3 = _iterator[_i++];
|
27
|
} else {
|
28
|
_i = _iterator.next();
|
29
|
if (_i.done) break;
|
30
|
_ref3 = _i.value;
|
31
|
}
|
32
|
|
33
|
var violation = _ref3;
|
34
|
|
35
|
throw violation.buildCodeFrameError(messages.get("readOnly", name));
|
36
|
}
|
37
|
}
|
38
|
}
|
39
|
}
|
40
|
};
|
41
|
};
|
42
|
|
43
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
44
|
|
45
|
module.exports = exports["default"];
|