diff --git a/src/babel/transformation/transformers/es7/decorators.js b/src/babel/transformation/transformers/es7/decorators.js index 6f927f3ee0..d875317c56 100644 --- a/src/babel/transformation/transformers/es7/decorators.js +++ b/src/babel/transformation/transformers/es7/decorators.js @@ -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) diff --git a/test/core/fixtures/transformation/es7.decorators/object/expected.js b/test/core/fixtures/transformation/es7.decorators/object/expected.js index 7a7cc30560..ae77a208df 100644 --- a/test/core/fixtures/transformation/es7.decorators/object/expected.js +++ b/test/core/fixtures/transformation/es7.decorators/object/expected.js @@ -3,9 +3,7 @@ var obj = babelHelpers.createDecoratedObject([{ key: "bar", decorators: [foo], - initializer: function () { - return function bar() {}; - } + value: function bar() {} }, { key: "foo", decorators: [bar],