Skip to content

Commit

Permalink
Fix regression with executable class bodies and prototypal attachment.
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Apr 6, 2013
1 parent 78d10f3 commit 0cadcdc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
7 changes: 4 additions & 3 deletions lib/coffee-script/nodes.js

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

4 changes: 2 additions & 2 deletions src/nodes.coffee
Expand Up @@ -146,8 +146,8 @@ exports.Base = class Base


traverseChildren: (crossScope, func) -> traverseChildren: (crossScope, func) ->
@eachChild (child) -> @eachChild (child) ->
return false if func(child) is false recur = func(child)
child.traverseChildren crossScope, func child.traverseChildren(crossScope, func) unless recur is no


invert: -> invert: ->
new Op '!', this new Op '!', this
Expand Down
12 changes: 12 additions & 0 deletions test/classes.coffee
Expand Up @@ -337,6 +337,18 @@ test "#2502: parenthesizing inner object values", ->
eq (new A).sections.default, 0 eq (new A).sections.default, 0




test "conditional prototype property assignment", ->
debug = false

class Person
if debug
age: -> 10
else
age: -> 20

eq (new Person).age(), 20


test "mild metaprogramming", -> test "mild metaprogramming", ->


class Base class Base
Expand Down

0 comments on commit 0cadcdc

Please sign in to comment.