use of org.kie.dmn.feel.lang.ast.FormalParameterNode in project drools by kiegroup.
the class ASTCompilerVisitor method visit.
@Override
public DirectCompilerResult visit(FunctionDefNode n) {
MethodCallExpr list = Expressions.list();
n.getFormalParameters().stream().map(fp -> fp.accept(this)).map(DirectCompilerResult::getExpression).forEach(list::addArgument);
if (n.isExternal()) {
List<String> paramNames = n.getFormalParameters().stream().map(FormalParameterNode::getName).map(BaseNode::getText).collect(Collectors.toList());
return Functions.declaration(n, list, Functions.external(paramNames, n.getBody()));
} else {
DirectCompilerResult body = n.getBody().accept(this);
return Functions.declaration(n, list, body.getExpression()).withFD(body);
}
}
use of org.kie.dmn.feel.lang.ast.FormalParameterNode in project drools by kiegroup.
the class ASTTemporalConstantVisitor method visit.
@Override
public ASTNode visit(FunctionDefNode n) {
scopeHelper.pushScope();
for (FormalParameterNode fp : n.getFormalParameters()) {
scopeHelper.addInScope(EvalHelper.normalizeVariableName(fp.getName().getText()), MASKED);
}
n.getBody().accept(this);
scopeHelper.popScope();
return n;
}
Aggregations