use of org.sireum.hamr.ir.BTSFormalExpPair in project osate-plugin by sireum.
the class BAVisitor method caseSubprogramCallAction.
@Override
public Boolean caseSubprogramCallAction(SubprogramCallAction object) {
Name name = null;
List<Feature> features = null;
CalledSubprogramHolder csh = object.getSubprogram();
assert csh.getArrayIndexes().isEmpty() : "has array indexes: " + csh.getArrayIndexes().size();
if (csh instanceof SubprogramSubcomponentHolder) {
SubprogramSubcomponentHolder ssh = (SubprogramSubcomponentHolder) csh;
assert (ssh.getArrayIndexes().isEmpty());
name = toName(ssh.getSubcomponent().getName());
features = ssh.getSubcomponent().getAllFeatures();
} else {
throw new RuntimeException("Currently only supporting subcomponent subprograms");
}
assert features.size() == object.getParameterLabels().size() : "feature size not equal to param labels size: " + features.size() + " vs " + object.getParameterLabels().size();
List<BTSFormalExpPair> params = new ArrayList<>();
for (int index = 0; index < object.getParameterLabels().size(); index++) {
Feature f = features.get(index);
visit(object.getParameterLabels().get(index));
BTSExp ne = pop();
// TODO:
Option<Name> paramName = toSome(toSimpleName(f.getName()));
params.add(BTSFormalExpPair$.MODULE$.apply(paramName, toSome(ne), toNone()));
}
push(BTSSubprogramCallAction$.MODULE$.apply(name, VisitorUtil.toISZ(params)));
return false;
}
Aggregations