relax key aliases for plain methods - fixes #1649
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// #1649
|
||||
|
||||
class Foo {
|
||||
[Symbol()]() {}
|
||||
[Symbol()]() {}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// #1649
|
||||
|
||||
"use strict";
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: Symbol(),
|
||||
value: function () {}
|
||||
}, {
|
||||
key: Symbol(),
|
||||
value: function () {}
|
||||
}]);
|
||||
return Foo;
|
||||
})();
|
||||
Reference in New Issue
Block a user