Merge pull request #1385 from monsanto/fix-var-checker

fix reference check for shorthand properties
This commit is contained in:
Sebastian McKenzie
2015-04-30 16:43:36 +01:00
4 changed files with 18 additions and 3 deletions

View File

@@ -26,10 +26,11 @@ export function isReferenced(node: Object, parent: Object): boolean {
return false;
// yes: { [NODE]: "" }
// yes: { NODE }
// no: { NODE: "" }
case "Property":
if (parent.key === node) {
return parent.computed;
return parent.computed || parent.shorthand;
}
// no: var NODE = init;

View File

@@ -4,9 +4,19 @@ var _i = function i() {
_i = 5;
};
var j = function j() {
var j = (function (_j) {
function j() {
return _j.apply(this, arguments);
}
j.toString = function () {
return _j.toString();
};
return j;
})(function () {
var _ = 5;
j = _.j;
;
};
});

View File

@@ -0,0 +1,3 @@
{
"throws": "Reference to undeclared variable"
}