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

Support else if (...) #19

Closed
2 tasks done
ballercat opened this issue Dec 14, 2017 · 0 comments · Fixed by #27
Closed
2 tasks done

Support else if (...) #19

ballercat opened this issue Dec 14, 2017 · 0 comments · Fixed by #27

Comments

@ballercat
Copy link
Owner

ballercat commented Dec 14, 2017

Overview

The lack of else if is awkward, makes it difficult to write some code.

A quick solution might be to encode the node as a literal else block containing a single if.

Sample spec

export function test(x: i32): i32 {
   if (x == 0) {
     return 2;
  } else if (x == 1) {
     return 4;
  } else {
     return -1;
  }
}

That should do it.

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

Successfully merging a pull request may close this issue.

1 participant