big milestone. examples/code.coffee now compiles correctly under the new whitespace regime

This commit is contained in:
Jeremy Ashkenas 2009-12-30 18:59:33 -05:00
parent e6cd32f2fc
commit cd68f02981
3 changed files with 7 additions and 2 deletions

View File

@ -150,7 +150,7 @@ Snake.prototype.move: =>
alert('Slithering...') alert('Slithering...')
super(5) super(5)
Horse: name => this.name: name. Horse: name => this.name: name
Horse extends Animal Horse extends Animal
Horse.prototype.move: => Horse.prototype.move: =>
alert('Galloping...') alert('Galloping...')

View File

@ -353,7 +353,7 @@ rule
# An elsif portion of an if-else block. # An elsif portion of an if-else block.
ElsIf: ElsIf:
ELSE IfBlock { result = val[1] } ELSE IfBlock { result = val[1].force_statement }
; ;
# Multiple elsifs can be chained together. # Multiple elsifs can be chained together.

View File

@ -684,6 +684,11 @@ module CoffeeScript
@else_body ? @else_body << eb : @else_body = eb @else_body ? @else_body << eb : @else_body = eb
self self
end end
def force_statement
@tags[:statement] = true
self
end
# Rewrite a chain of IfNodes with their switch condition for equality. # Rewrite a chain of IfNodes with their switch condition for equality.
def rewrite_condition(expression) def rewrite_condition(expression)