use of jkind.lustre.FunctionCallExpr in project AGREE by loonwerks.
the class AgreeASTBuilder method caseCallExpr.
/*
* CallExpr could be a node call, a regular function call, or an uninterpreted function call.
* The former two cases will return a NodeCallExpr, the third case will return a FunctionCallExpr.
*/
@Override
public Expr caseCallExpr(CallExpr expr) {
NamedElement namedEl = expr.getRef().getElm();
String fnName = AgreeUtils.getNodeName(namedEl);
boolean found = false;
for (Node node : globalNodes) {
if (node.id.equals(fnName)) {
found = true;
break;
}
}
if (!found) {
for (Function function : uninterpretedFunc) {
if (function.id.equals(fnName)) {
found = true;
break;
}
}
}
if (!found) {
DoubleDotRef fn = expr.getRef();
doSwitch(fn.getElm());
// for dReal integration
if (fnName.substring(0, 7).equalsIgnoreCase("dreal__")) {
fnName = namedEl.getName();
}
}
List<Expr> argResults = new ArrayList<>();
for (com.rockwellcollins.atc.agree.agree.Expr argExpr : expr.getArgs()) {
argResults.add(doSwitch(argExpr));
}
if (functionNameExists(fnName)) {
FunctionCallExpr functionCall = new FunctionCallExpr(fnName.replace("::", "__"), argResults);
return functionCall;
}
NodeCallExpr nodeCall = new NodeCallExpr(fnName.replace("::", "__"), argResults);
return nodeCall;
}
Aggregations