Permalink
Browse files

Fix regression with executable class bodies and prototypal attachment.

  • Loading branch information...
jashkenas committed Apr 6, 2013
1 parent 78d10f3 commit 0cadcdc097b64e97a74f5ea1a7b150b1e3e4da13
Showing with 18 additions and 5 deletions.
  1. +4 −3 lib/coffee-script/nodes.js
  2. +2 −2 src/nodes.coffee
  3. +12 −0 test/classes.coffee

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -146,8 +146,8 @@ exports.Base = class Base
traverseChildren: (crossScope, func) ->
@eachChild (child) ->
- return false if func(child) is false
- child.traverseChildren crossScope, func
+ recur = func(child)
+ child.traverseChildren(crossScope, func) unless recur is no
invert: ->
new Op '!', this
View
@@ -337,6 +337,18 @@ test "#2502: parenthesizing inner object values", ->
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", ->
class Base

0 comments on commit 0cadcdc

Please sign in to comment.