Search in sources :

Example 1 with SIfElse

use of org.elasticsearch.painless.node.SIfElse in project elasticsearch by elastic.

the class Walker method visitIf.

@Override
public ANode visitIf(IfContext ctx) {
    AExpression expression = (AExpression) visit(ctx.expression());
    SBlock ifblock = (SBlock) visit(ctx.trailer(0));
    if (ctx.trailer().size() > 1) {
        SBlock elseblock = (SBlock) visit(ctx.trailer(1));
        return new SIfElse(location(ctx), expression, ifblock, elseblock);
    } else {
        return new SIf(location(ctx), expression, ifblock);
    }
}
Also used : SIf(org.elasticsearch.painless.node.SIf) AExpression(org.elasticsearch.painless.node.AExpression) SIfElse(org.elasticsearch.painless.node.SIfElse) SBlock(org.elasticsearch.painless.node.SBlock)

Aggregations

AExpression (org.elasticsearch.painless.node.AExpression)1 SBlock (org.elasticsearch.painless.node.SBlock)1 SIf (org.elasticsearch.painless.node.SIf)1 SIfElse (org.elasticsearch.painless.node.SIfElse)1