better let scoping CallExpression comments and layout
This commit is contained in:
parent
7cc75587c1
commit
79f2dbb8d7
@ -26,16 +26,16 @@ exports.VariableDeclaration = function (node, parent, file) {
|
||||
// we're a property key
|
||||
if (parent.type === "Property" && parent.key === node) return;
|
||||
|
||||
if (parent.type !== "MemberExpression") {
|
||||
// we aren't in a member expression
|
||||
return id;
|
||||
} else if (parent.type === "MemberExpression" && parent.property === node && parent.computed) {
|
||||
// we're in a member expression but we're a computed property so we're referenced
|
||||
return id;
|
||||
} else if (parent.type === "MemberExpression" && parent.object === node) {
|
||||
// we're in a member expression and we're the object so we're referenced
|
||||
return id;
|
||||
}
|
||||
var isMemberExpression = parent.type === "MemberExpression";
|
||||
|
||||
// we're in a member expression and we're the computed property so we're referenced
|
||||
var isComputedProperty = isMemberExpression && parent.property === node && parent.computed;
|
||||
|
||||
// we're in a member expression and we're the object so we're referenced
|
||||
var isObject = isMemberExpression && parent.object === node;
|
||||
|
||||
// we are referenced
|
||||
if (!isMemberExpression || isComputedProperty || isObject) return id;
|
||||
};
|
||||
|
||||
var replace = function (node, parent) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user