use of org.drools.mvelcompiler.ast.ListAccessExprT in project drools by kiegroup.
the class RHSPhase method visit.
@Override
public TypedExpression visit(ArrayAccessExpr n, Context arg) {
TypedExpression name = n.getName().accept(this, arg);
Optional<Type> type = name.getType();
if (type.filter(TypeUtils::isCollection).isPresent()) {
return new ListAccessExprT(name, n.getIndex(), type.get());
}
return new UnalteredTypedExpression(n, type.orElse(null));
}
use of org.drools.mvelcompiler.ast.ListAccessExprT in project drools by kiegroup.
the class LHSPhase method visit.
@Override
public TypedExpression visit(ArrayAccessExpr n, Void arg) {
if (parentIsExpressionStmt(n)) {
return rhsOrError();
}
TypedExpression name = n.getName().accept(this, arg);
Optional<Type> type = name.getType();
if (type.filter(TypeUtils::isCollection).isPresent()) {
Expression index = n.getIndex();
if (index.isStringLiteralExpr() || index.isNameExpr()) {
return new MapPutExprT(name, index, rhsOrNull(), name.getType());
} else {
return new ListAccessExprT(name, index, type.get());
}
}
return new UnalteredTypedExpression(n, type.orElse(null));
}
Aggregations