use of org.drools.mvelcompiler.ast.ForEachStmtT in project drools by kiegroup.
the class StatementVisitor method visit.
@Override
public TypedExpression visit(ForEachStmt n, Void arg) {
Expression iterable = n.getIterable();
Optional<TypedExpression> convertedToDowncastStmt = iterable.toNameExpr().map(PrintUtil::printNode).flatMap(mvelCompilerContext::findDeclarations).filter(this::isDeclarationIterable).map(d -> toForEachDowncastStmtT(n, arg));
if (convertedToDowncastStmt.isPresent()) {
return convertedToDowncastStmt.get();
}
TypedExpression variableDeclarationExpr = new LHSPhase(mvelCompilerContext, Optional.empty()).invoke(n.getVariable());
TypedExpression typedIterable = new RHSPhase(mvelCompilerContext).invoke(n.getIterable());
TypedExpression body = n.getBody().accept(this, arg);
return new ForEachStmtT(variableDeclarationExpr, typedIterable, body);
}
Aggregations