CoffeeScriptRedux
CoffeeScriptRedux copied to clipboard
Switch doesn't work with the ternary operator
This:
switch (if a then b else c)
when d
e()
is expected to become:
switch (a ? b : c) {
case d:
e();
break;
}
but instead gives you:
-
Unknown expression type: IfStatement
Just tried on 1.8.0, it generates the ternary as expected, runs fine (after initialization of course) no errors.
On Mon, Sep 1, 2014 at 7:40 AM, Rico Sta. Cruz [email protected] wrote:
This:
switch (if a then b else c) when d e()
is expected to become:
switch (a ? b : c) { case d: e(); break;}
but instead gives you:
- Unknown expression type: IfStatement
— Reply to this email directly or view it on GitHub https://github.com/michaelficarra/CoffeeScriptRedux/issues/329.
It fails in coffeescriptredux 2.0.0-beta8.
http://michaelficarra.github.io/CoffeeScriptRedux/#try:switch%20%28if%20a%20then%20b%20else%20c%29%0A%20%20when%20d%0A%20%20%20%20e%28%29