Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch doesn't work with the ternary operator #329

Open
rstacruz opened this issue Sep 1, 2014 · 2 comments
Open

Switch doesn't work with the ternary operator #329

rstacruz opened this issue Sep 1, 2014 · 2 comments

Comments

@rstacruz
Copy link

rstacruz commented Sep 1, 2014

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

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/4150286-switch-doesn-t-work-with-the-ternary-operator?utm_campaign=plugin&utm_content=tracker%2F33145&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F33145&utm_medium=issues&utm_source=github).
@xyrius
Copy link

xyrius commented Sep 1, 2014

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
#329.

@rstacruz
Copy link
Author

rstacruz commented Sep 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants