diff --git a/lib/coffeescript/nodes.js b/lib/coffeescript/nodes.js index a7b5c95107..e05419f456 100644 --- a/lib/coffeescript/nodes.js +++ b/lib/coffeescript/nodes.js @@ -2641,11 +2641,10 @@ } // Add an expression to the class initializer - - // NOTE Currently, only methods and static methods are valid in ES class initializers. - // When additional expressions become valid, this method should be updated to handle them. addInitializerExpression(node) { - if (this.validInitializerMethod(node)) { + if (node.unwrapAll() instanceof PassthroughLiteral) { + return node; + } else if (this.validInitializerMethod(node)) { return this.addInitializerMethod(node); } else { return null; diff --git a/src/nodes.coffee b/src/nodes.coffee index e6f1940421..a9c49ab65a 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -1760,11 +1760,10 @@ exports.Class = class Class extends Base # Add an expression to the class initializer - # - # NOTE Currently, only methods and static methods are valid in ES class initializers. - # When additional expressions become valid, this method should be updated to handle them. addInitializerExpression: (node) -> - if @validInitializerMethod node + if node.unwrapAll() instanceof PassthroughLiteral + node + else if @validInitializerMethod node @addInitializerMethod node else null