Amjad Masad 3667527d04 Revert "Remove flow"
This reverts commit 2827ff6b01dcce69e9d3c0402e96b52b3a2a47ee.
2016-03-03 14:49:20 -08:00

17 lines
457 B
JavaScript

export default function ({ messages }) {
return {
visitor: {
Scope({ scope }) {
for (let name in scope.bindings) {
let binding = scope.bindings[name];
if (binding.kind !== "const" && binding.kind !== "module") continue;
for (let violation of (binding.constantViolations: Array)) {
throw violation.buildCodeFrameError(messages.get("readOnly", name));
}
}
},
}
};
}