"use strict"; var _getIterator = require("babel-runtime/core-js/get-iterator")["default"]; exports.__esModule = true; exports["default"] = function (_ref3) { var messages = _ref3.messages; var t = _ref3.types; function check(node) { if (t.isVariableDeclaration(node, { kind: "const" })) { node.kind = "let"; } } return { visitor: { Scope: function Scope(_ref4) { var scope = _ref4.scope; for (var _name in scope.bindings) { var binding = scope.bindings[_name]; if (binding.kind !== "const" && binding.kind !== "module") continue; for (var _iterator = (binding.constantViolations /*: Array*/), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) { var _ref; if (_isArray) { if (_i >= _iterator.length) break; _ref = _iterator[_i++]; } else { _i = _iterator.next(); if (_i.done) break; _ref = _i.value; } var violation = _ref; throw violation.buildCodeFrameError(messages.get("readOnly", _name)); } } }, VariableDeclaration: function VariableDeclaration(_ref5) { var node = _ref5.node; check(node); }, ForXStatement: function ForXStatement(_ref6) { var left = _ref6.node.left; check(left); }, ForStatement: function ForStatement(_ref7) { var init = _ref7.node.init; check(init); }, "BlockStatement|Program": function BlockStatementProgram(_ref8) { var body = _ref8.node.body; for (var _iterator2 = body, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _getIterator(_iterator2);;) { var _ref2; if (_isArray2) { if (_i2 >= _iterator2.length) break; _ref2 = _iterator2[_i2++]; } else { _i2 = _iterator2.next(); if (_i2.done) break; _ref2 = _i2.value; } var node = _ref2; check(node); } } } }; }; module.exports = exports["default"];