fix reference check for shorthand properties
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -14,9 +14,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;
|
||||
|
||||
;
|
||||
};
|
||||
});
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
({foo})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Reference to undeclared variable"
|
||||
}
|
||||
Reference in New Issue
Block a user