relax key aliases for plain methods - fixes #1649

This commit is contained in:
Sebastian McKenzie
2015-05-30 23:53:39 -04:00
parent 2f7743cafb
commit f642c2baa8
3 changed files with 35 additions and 2 deletions

View File

@@ -102,17 +102,26 @@ export function toSequenceExpression(nodes: Array<Object>, scope: Scope): Object
export function toKeyAlias(node: Object, key: Object = node.key) {
var alias;
if (t.isIdentifier(key)) {
if (node.kind === "method") {
return toKeyAlias.uid++;
} else if (t.isIdentifier(key)) {
alias = key.name;
} else if (t.isLiteral(key)) {
alias = JSON.stringify(key.value);
} else {
alias = JSON.stringify(traverse.removeProperties(t.cloneDeep(key)));
}
if (node.computed) alias = `[${alias}]`;
if (node.computed) {
alias = `[${alias}]`;
}
return alias;
}
toKeyAlias.uid = 0;
/*
* Description
*/