better let scoping CallExpression comments and layout

This commit is contained in:
Sebastian McKenzie 2014-10-13 04:48:44 +11:00
parent 7cc75587c1
commit 79f2dbb8d7

View File

@ -26,16 +26,16 @@ exports.VariableDeclaration = function (node, parent, file) {
// we're a property key // we're a property key
if (parent.type === "Property" && parent.key === node) return; if (parent.type === "Property" && parent.key === node) return;
if (parent.type !== "MemberExpression") { var isMemberExpression = parent.type === "MemberExpression";
// we aren't in a member expression
return id; // we're in a member expression and we're the computed property so we're referenced
} else if (parent.type === "MemberExpression" && parent.property === node && parent.computed) { var isComputedProperty = isMemberExpression && parent.property === node && parent.computed;
// we're in a member expression but we're a computed property so we're referenced
return id; // we're in a member expression and we're the object so we're referenced
} else if (parent.type === "MemberExpression" && parent.object === node) { var isObject = isMemberExpression && parent.object === node;
// we're in a member expression and we're the object so we're referenced
return id; // we are referenced
} if (!isMemberExpression || isComputedProperty || isObject) return id;
}; };
var replace = function (node, parent) { var replace = function (node, parent) {