use of org.drools.javaparser.ast.nodeTypes.NodeWithSimpleName in project drools by kiegroup.
the class DrlxParseUtil method createExpressionCall.
private static Expression createExpressionCall(Expression expr, Deque<ParsedMethod> expressions) {
if (expr instanceof NodeWithSimpleName) {
NodeWithSimpleName fae = (NodeWithSimpleName) expr;
expressions.push(new ParsedMethod(expr, fae.getName().asString()));
}
if (expr instanceof NodeWithOptionalScope) {
final NodeWithOptionalScope<?> exprWithScope = (NodeWithOptionalScope) expr;
exprWithScope.getScope().map((Expression scope) -> createExpressionCall(scope, expressions));
} else if (expr instanceof FieldAccessExpr) {
// Cannot recurse over getScope() as FieldAccessExpr doesn't support the NodeWithOptionalScope,
// it will support a new interface to traverse among scopes called NodeWithTraversableScope so
// we can merge this and the previous branch
createExpressionCall(((FieldAccessExpr) expr).getScope(), expressions);
}
return expr;
}
Aggregations