turn method literal keys into assignments in loose mode - fixes #1797
This commit is contained in:
parent
aa0f3ac5d0
commit
4b0f624fb3
@ -477,7 +477,7 @@ class ClassTransformer {
|
||||
|
||||
var classRef = this.classRef;
|
||||
if (!node.static) classRef = t.memberExpression(classRef, t.identifier("prototype"));
|
||||
var methodName = t.memberExpression(classRef, node.key, node.computed);
|
||||
var methodName = t.memberExpression(classRef, node.key, node.computed || t.isLiteral(node.key));
|
||||
|
||||
var expr = t.expressionStatement(t.assignmentExpression("=", methodName, node.value));
|
||||
t.inheritsComments(expr, node);
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
"bar"() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
Foo.prototype["bar"] = function bar() {};
|
||||
|
||||
return Foo;
|
||||
})();
|
||||
Loading…
x
Reference in New Issue
Block a user