@Override public DirectCompilerResult visitUenpmPrimary(FEEL_1_1Parser.UenpmPrimaryContext ctx) { DirectCompilerResult expr = visit(ctx.primary()); if (ctx.qualifiedName() != null) { List<String> names = ctx.qualifiedName().nameRef().stream().map(nameRefContext -> ParserHelper.getOriginalText(nameRefContext)).collect(Collectors.toList()); expr = telescopePathAccessor(expr, names); } if (ctx.parameters() != null) { expr = buildFunctionCall(ctx, expr, ctx.parameters()); } return expr; }
DirectCompilerResult telescope = telescopePathAccessor(DirectCompilerResult.of(exprCursor, typeCursor), Arrays.asList(accText)); exprCursor = telescope.getExpression(); typeCursor = telescope.resultType;
@Override public DirectCompilerResult visitFilterPathExpression(FEEL_1_1Parser.FilterPathExpressionContext ctx) { if (ctx.filter != null) { DirectCompilerResult expr = visit(ctx.filterPathExpression()); DirectCompilerResult filter = visit(ctx.expression()); MethodCallExpr filterCall = new MethodCallExpr(new NameExpr(CompiledFEELSupport.class.getSimpleName()), "filter"); filterCall.addArgument(new NameExpr("feelExprCtx")); filterCall.addArgument(expr.getExpression()); MethodCallExpr filterWithCall = new MethodCallExpr(filterCall, "with"); // if (filter.resultType != BuiltInType.BOOLEAN) { // // Then is the case Table 54: Semantics of lists, ROW: e1 is a list and e2 is an integer (0 scale number) // filterWithCall.addArgument(filter.getExpression()); // } else // { // Then is the case Table 54: Semantics of lists, ROW: e1 is a list and type(FEEL(e2 , s')) is boolean // currently delegated to runtime instead: Expression anonFunctionClass = anonFunctionEvaluationContext2Object(filter.getExpression()); filterWithCall.addArgument(anonFunctionClass); // } return DirectCompilerResult.of(filterWithCall, BuiltInType.UNKNOWN).withFD(expr).withFD(filter); } else if (ctx.qualifiedName() != null) { DirectCompilerResult expr = visit(ctx.filterPathExpression()); List<String> names = ctx.qualifiedName().nameRef().stream().map(nameRefContext -> ParserHelper.getOriginalText(nameRefContext)).collect(Collectors.toList()); return telescopePathAccessor(expr, names); } else { return visit(ctx.unaryExpression()); } }