Skip to content

Commit

Permalink
Fix for issue eclipse-cognicrypt#457
Browse files Browse the repository at this point in the history
The previous parsing code was actually a dublicate of the getPredicate() method, but it had no check for the “consPred” field, in which ‘alg(’, ‘mode(’ and ‘pad(’ is defined.
  • Loading branch information
marvinvo committed Jan 22, 2022
1 parent e379ff1 commit 5078267
Showing 1 changed file with 2 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ private List<CrySLPredicate> retrieveReqPredFromAltPreds(ReqPred left) {
}

private CrySLPredicate extractReqPred(final ReqPred pred) {
final List<ICrySLPredicateParameter> variables = new ArrayList<>();
PredLit innerPred = (PredLit) pred;
EObject cons = innerPred.getCons();
ISLConstraint conditional = null;
Expand All @@ -348,27 +347,8 @@ private CrySLPredicate extractReqPred(final ReqPred pred) {
} else if (cons instanceof Pred) {
conditional = getPredicate((Pred) cons);
}
if (innerPred.getPred().getParList() != null) {
for (final SuPar var : innerPred.getPred().getParList().getParameters()) {
if (var.getVal() != null) {
final LiteralExpression lit = var.getVal();

final ObjectImpl object = (ObjectImpl) ((LiteralExpression) lit.getLit().getName()).getValue();
final String type = ((ObjectDecl) object.eContainer()).getObjectType().getQualifiedName();
final String variable = object.getName();

final String part = var.getVal().getPart();
if (part != null) {
variables.add(new CrySLObject(variable, type, new CrySLSplitter(Integer.parseInt(lit.getInd()), Utils.filterQuotes(lit.getSplit()))));
} else {
variables.add(new CrySLObject(variable, type));
}
} else {
variables.add(new CrySLObject(UNDERSCORE, NULL));
}
}
}
return new CrySLPredicate(null, innerPred.getPred().getPredName(), variables, (innerPred.getNot() != null ? true : false), conditional);
CrySLPredicate islc = (CrySLPredicate) getPredicate(innerPred.getPred());
return new CrySLPredicate(islc.getBaseObject(), islc.getPredName(), islc.getParameters(), islc.isNegated(), conditional);
}

private ISLConstraint getPredicate(Pred pred) {
Expand Down

0 comments on commit 5078267

Please sign in to comment.