mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-17 19:11:22 -05:00
one more bit to pass -- futzing with the if/else chains
This commit is contained in:
@@ -485,8 +485,12 @@
|
||||
// The most basic form of "if".
|
||||
IfBlock: [o("IF Expression Block", function() {
|
||||
return new IfNode($2, $3);
|
||||
}), o("IF Expression Block ElsIfs", function() {
|
||||
return (new IfNode($2, $3)).add_else($4);
|
||||
})
|
||||
],
|
||||
IfChain: [o("IfBlock", function() {
|
||||
return $1;
|
||||
}), o("IfBlock ElsIfs", function() {
|
||||
return $1.add_else($2);
|
||||
})
|
||||
],
|
||||
ElsIf: [o("ELSEIF Expression Block", function() {
|
||||
@@ -501,9 +505,9 @@
|
||||
})
|
||||
],
|
||||
// The full complement of if blocks, including postfix one-liner ifs and unlesses.
|
||||
If: [o("IfBlock", function() {
|
||||
If: [o("IfChain", function() {
|
||||
return $1;
|
||||
}), o("IfBlock ELSE Block", function() {
|
||||
}), o("IfChain ELSE Block", function() {
|
||||
return $1.add_else($3);
|
||||
}), o("Expression IF Expression", function() {
|
||||
return new IfNode($3, Expressions.wrap([$1]), null, {
|
||||
|
||||
Reference in New Issue
Block a user