use of org.elasticsearch.painless.node.EVariable in project elasticsearch by elastic.
the class Walker method visitConstructorfuncref.
@Override
public ANode visitConstructorfuncref(ConstructorfuncrefContext ctx) {
if (!ctx.decltype().LBRACE().isEmpty()) {
// array constructors are special: we need to make a synthetic method
// taking integer as argument and returning a new instance, and return a ref to that.
Location location = location(ctx);
String arrayType = ctx.decltype().getText();
SReturn code = new SReturn(location, new ENewArray(location, arrayType, Arrays.asList(new EVariable(location, "size")), false));
String name = nextLambda();
globals.addSyntheticMethod(new SFunction(new FunctionReserved(), location, arrayType, name, Arrays.asList("int"), Arrays.asList("size"), Arrays.asList(code), true));
return new EFunctionRef(location(ctx), "this", name);
}
return new EFunctionRef(location(ctx), ctx.decltype().getText(), ctx.NEW().getText());
}
use of org.elasticsearch.painless.node.EVariable in project elasticsearch by elastic.
the class Walker method visitVariable.
@Override
public ANode visitVariable(VariableContext ctx) {
String name = ctx.ID().getText();
reserved.peek().markUsedVariable(name);
return new EVariable(location(ctx), name);
}
Aggregations