use of org.drools.mvel.parser.ast.expr.ModifyStatement in project drools by kiegroup.
the class PreprocessPhase method modifyPreprocessor.
private PreprocessPhaseResult modifyPreprocessor(ModifyStatement modifyStatement) {
PreprocessPhaseResult result = new PreprocessedResult();
final Expression scope = modifyStatement.getModifyObject();
modifyStatement.findAll(AssignExpr.class).replaceAll(assignExpr -> assignToFieldAccess(result, scope, assignExpr));
// Do not use findAll as we should only process top level expressions
modifyStatement.getExpressions().replaceAll(e -> addScopeToMethodCallExpr(result, scope, e));
NodeList<Statement> statements = wrapToExpressionStmt(modifyStatement.getExpressions());
// delete modify statement and replace its own block of statements
modifyStatement.replace(new BlockStmt(statements));
return result;
}
Aggregations