Search in sources :

Example 1 with FunctionContext

use of org.elasticsearch.painless.antlr.PainlessParser.FunctionContext in project elasticsearch by elastic.

the class Walker method visitSource.

@Override
public ANode visitSource(SourceContext ctx) {
    reserved.push(new MainMethodReserved());
    List<SFunction> functions = new ArrayList<>();
    for (FunctionContext function : ctx.function()) {
        functions.add((SFunction) visit(function));
    }
    List<AStatement> statements = new ArrayList<>();
    for (StatementContext statement : ctx.statement()) {
        statements.add((AStatement) visit(statement));
    }
    return new SSource(scriptInterface, settings, sourceName, sourceText, debugStream, (MainMethodReserved) reserved.pop(), location(ctx), functions, globals, statements);
}
Also used : MainMethodReserved(org.elasticsearch.painless.node.SSource.MainMethodReserved) AStatement(org.elasticsearch.painless.node.AStatement) SFunction(org.elasticsearch.painless.node.SFunction) SSource(org.elasticsearch.painless.node.SSource) ArrayList(java.util.ArrayList) FunctionContext(org.elasticsearch.painless.antlr.PainlessParser.FunctionContext) StatementContext(org.elasticsearch.painless.antlr.PainlessParser.StatementContext)

Aggregations

ArrayList (java.util.ArrayList)1 FunctionContext (org.elasticsearch.painless.antlr.PainlessParser.FunctionContext)1 StatementContext (org.elasticsearch.painless.antlr.PainlessParser.StatementContext)1 AStatement (org.elasticsearch.painless.node.AStatement)1 SFunction (org.elasticsearch.painless.node.SFunction)1 SSource (org.elasticsearch.painless.node.SSource)1 MainMethodReserved (org.elasticsearch.painless.node.SSource.MainMethodReserved)1