use of org.drools.modelcompiler.builder.generator.drlxparse.MultipleDrlxParseSuccess in project drools by kiegroup.
the class PatternExpressionBuilder method buildExpressionWithIndexing.
@Override
public MethodCallExpr buildExpressionWithIndexing(DrlxParseSuccess drlxParseResult) {
if (drlxParseResult instanceof MultipleDrlxParseSuccess) {
MultipleDrlxParseSuccess multi = (MultipleDrlxParseSuccess) drlxParseResult;
MethodCallExpr exprDSL = new MethodCallExpr(null, multi.getOperator() == BinaryExpr.Operator.OR ? EXPR_OR_CALL : EXPR_AND_CALL);
for (DrlxParseSuccess child : multi.getResults()) {
MethodCallExpr childExpr = buildExpressionWithIndexing(child);
childExpr.setScope(exprDSL);
exprDSL = childExpr;
if (child instanceof SingleDrlxParseSuccess && child.getExprBinding() != null) {
SingleDrlxParseSuccess singleDrlxChild = (SingleDrlxParseSuccess) child;
context.addDeclaration(child.getExprBinding(), singleDrlxChild.getLeftExprRawClass());
Expression dslExpr = buildBinding(singleDrlxChild);
context.addExpression(dslExpr);
}
}
return new MethodCallExpr(exprDSL, multi.getOperator() == BinaryExpr.Operator.OR ? EXPR_END_OR_CALL : EXPR_END_AND_CALL);
}
return buildSingleExpressionWithIndexing((SingleDrlxParseSuccess) drlxParseResult);
}
Aggregations