Skip to content

Commit

Permalink
Simplify fix for jashkenas#4464
Browse files Browse the repository at this point in the history
This uses more of the existing machinery for moving class body
expressions into the initializer.
  • Loading branch information
connec committed Sep 20, 2017
1 parent becdf50 commit 4ec0db4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions lib/coffeescript/nodes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions src/nodes.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4ec0db4

Please sign in to comment.