use of org.kie.dmn.feel.codegen.feel11.DirectCompilerResult.mergeFDs in project drools by kiegroup.
the class ASTCompilerVisitor method visit.
@Override
public DirectCompilerResult visit(ContextNode n) {
if (n.getEntries().isEmpty()) {
return DirectCompilerResult.of(FeelCtx.emptyContext(), BuiltInType.CONTEXT);
}
scopeHelper.pushScope();
// openContext(feelCtx)
MapBackedType resultType = new MapBackedType();
DirectCompilerResult openContext = DirectCompilerResult.of(FeelCtx.openContext(), resultType);
// .setEntry( k,v )
// .setEntry( k,v )
// ...
DirectCompilerResult entries = n.getEntries().stream().map(e -> {
DirectCompilerResult r = e.accept(this);
scopeHelper.addInScope(e.getName().getText(), r.resultType);
return r;
}).reduce(openContext, (l, r) -> DirectCompilerResult.of(r.getExpression().asMethodCallExpr().setScope(l.getExpression()), r.resultType, DirectCompilerResult.mergeFDs(l, r)));
scopeHelper.popScope();
// .closeContext()
return DirectCompilerResult.of(FeelCtx.closeContext(entries), resultType, entries.getFieldDeclarations());
}
Aggregations