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

Expressions.ifThenElse does not work #15

Closed
vlsi opened this Issue Apr 9, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@vlsi
Contributor

vlsi commented Apr 9, 2014

Here's the exception when trying to print such an expression

Caused by: java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
    at java.util.ArrayList.rangeCheck(ArrayList.java:604)
    at java.util.ArrayList.get(ArrayList.java:382)
    at net.hydromatic.linq4j.expressions.ConditionalStatement.accept0(ConditionalStatement.java:55)

This might be a fix:

  void accept0(ExpressionWriter writer) {
    int ifBranches = expressionList.size();
    ifBranches -= ifBranches & 1;
    for (int i = 0; i < ifBranches; i += 2) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment