mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Merge branch 'master' of git://github.com/cehoffman/coffee-script
This commit is contained in:
commit
1f870911c9
3 changed files with 13 additions and 2 deletions
|
@ -1248,7 +1248,7 @@
|
|||
// Rewrite a chain of IfNodes to add a default case as the final else.
|
||||
add_else: function add_else(exprs, statement) {
|
||||
if (this.is_chain()) {
|
||||
this.else_body.add_else(exprs);
|
||||
this.else_body.add_else(exprs, statement);
|
||||
} else {
|
||||
if (!(statement)) {
|
||||
exprs = exprs.unwrap();
|
||||
|
|
|
@ -987,7 +987,7 @@ IfNode: exports.IfNode: inherit Node, {
|
|||
# Rewrite a chain of IfNodes to add a default case as the final else.
|
||||
add_else: (exprs, statement) ->
|
||||
if @is_chain()
|
||||
@else_body.add_else exprs
|
||||
@else_body.add_else exprs, statement
|
||||
else
|
||||
exprs: exprs.unwrap() unless statement
|
||||
@children.push @else_body: exprs
|
||||
|
|
|
@ -51,3 +51,14 @@ switch "word"
|
|||
result: true unless false
|
||||
|
||||
ok result
|
||||
|
||||
result: false
|
||||
switch "word"
|
||||
when "one thing"
|
||||
do_something()
|
||||
when "other thing"
|
||||
do_something()
|
||||
else
|
||||
result: true unless false
|
||||
|
||||
ok result
|
||||
|
|
Loading…
Add table
Reference in a new issue