don't use initializer property for decorators on concise methods in object literals
This commit is contained in:
@@ -26,7 +26,7 @@ export function ObjectExpression(node, parent, scope, file) {
|
||||
if (prop.decorators) memoiseDecorators(prop.decorators, scope);
|
||||
|
||||
|
||||
if (prop.kind === "init") {
|
||||
if (prop.kind === "init" && !prop.method) {
|
||||
prop.kind = "";
|
||||
prop.value = t.functionExpression(null, [], t.blockStatement([
|
||||
t.returnStatement(prop.value)
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
var obj = babelHelpers.createDecoratedObject([{
|
||||
key: "bar",
|
||||
decorators: [foo],
|
||||
initializer: function () {
|
||||
return function bar() {};
|
||||
}
|
||||
value: function bar() {}
|
||||
}, {
|
||||
key: "foo",
|
||||
decorators: [bar],
|
||||
|
||||
Reference in New Issue
Block a user