use of com.dexels.navajo.parser.compiled.api.ReactiveParseItem in project navajo by Dexels.
the class ASTFunctionNode method interpretToLambda.
@Override
public ContextExpression interpretToLambda(List<String> problems, String expression, Function<String, FunctionClassification> functionClassifier, Function<String, Optional<Node>> mapResolver) {
List<ContextExpression> unnamed = new LinkedList<>();
// TODO make lazy?
Map<String, ContextExpression> named = new HashMap<>();
for (int i = 0; i < jjtGetNumChildren(); i++) {
Node sn = jjtGetChild(i);
ContextExpression cn = sn.interpretToLambda(problems, expression, functionClassifier, mapResolver);
if (cn instanceof NamedExpression) {
NamedExpression ne = (NamedExpression) cn;
named.put(ne.name, ne.expression);
} else {
unnamed.add(cn);
}
}
FunctionClassification mode = functionClassifier.apply(functionName);
switch(mode) {
case REACTIVE_HEADER:
break;
case REACTIVE_SOURCE:
return new ReactiveParseItem(functionName, Reactive.ReactiveItemType.REACTIVE_SOURCE, named, unnamed, expression, this);
case REACTIVE_TRANSFORMER:
return new ReactiveParseItem(functionName, Reactive.ReactiveItemType.REACTIVE_TRANSFORMER, named, unnamed, expression, this);
case REACTIVE_REDUCER:
return new ReactiveParseItem(functionName, Reactive.ReactiveItemType.REACTIVE_MAPPER, named, unnamed, expression, this);
case DEFAULT:
default:
}
return resolveNormalFunction(unnamed, named, problems, expression);
}
Aggregations