case ASSIGN:
case GREATER:
case LESSER:
case GEQ:
case LEQ:
Computation computation = new Computation();
computation.add(reduceNode(list.children().get(1)));
// Add binary op chain.
for (int i = 2; i < list.children().size(); i++) {
BinaryOp op = new BinaryOp(new Token(var.name, kind, var.sourceLine, var.sourceColumn));
op.add(reduceNode(list.children().get(i)));
computation.add(op);
}
return computation;
}
TernaryIfExpression ifExpression = new TernaryIfExpression();
Computation test = new Computation();
test.add(var);
test.add(new BinaryOp(new Token("in", Token.Kind.IN, var.sourceLine, var.sourceColumn))
.add(new JavaLiteral('"' + Closure.class.getName() + '"')));
ifExpression.add(test); // test := var instanceof closure
ifExpression.add(toFunctionCall(var, list)); // then call
ifExpression.add(var); // else return as is