babel/lib/6to5/transformation/transformers/optional-undeclared-variable-check.js
2015-01-21 10:17:52 +11:00

8 lines
211 B
JavaScript

exports.optional = true;
exports.Identifier = function (node, parent, scope, context, file) {
if (!scope.has(node.name, true)) {
throw file.errorWithNode(node, "Reference to undeclared variable");
}
};