use of org.sireum.hamr.ir.BTSExp in project osate-plugin by sireum.
the class BAVisitor method caseSimpleExpression.
@Override
public Boolean caseSimpleExpression(SimpleExpression object) {
assert (object.getTerms().size() > 0);
List<BinaryAddingOperator> binOps = object.getBinaryAddingOperators();
UnaryAddingOperator unaryOp = object.getUnaryAddingOperator();
List<BTSExp> expressions = new ArrayList<>();
for (Term t : object.getTerms()) {
visit(t);
expressions.add(pop());
}
if (expressions.size() > 1) {
push(convertToBinaryExp(expressions, binOps));
} else {
if (BAUtils.isNoneEnumerator(unaryOp)) {
push(expressions.get(0));
} else {
push(BAUtils.convertToUnaryExp(expressions.get(0), unaryOp));
}
}
return false;
}
use of org.sireum.hamr.ir.BTSExp in project osate-plugin by sireum.
the class BAVisitor method casePortSendAction.
@Override
public Boolean casePortSendAction(PortSendAction object) {
Name name = toName(object.getPort().getPort().getName());
Option<BTSExp> exp = toNone();
if (object.getValueExpression() != null) {
visit(object.getValueExpression());
exp = toSome(pop());
}
push(BTSPortOutAction$.MODULE$.apply(name, exp));
return false;
}
use of org.sireum.hamr.ir.BTSExp in project osate-plugin by sireum.
the class BAVisitor method caseAssignmentAction.
@Override
public Boolean caseAssignmentAction(AssignmentAction object) {
visit(object.getTarget());
BTSExp lhs = pop();
visit(object.getValueExpression());
BTSExp rhs = pop();
push(BTSAssignmentAction$.MODULE$.apply(lhs, rhs));
return false;
}
use of org.sireum.hamr.ir.BTSExp in project osate-plugin by sireum.
the class BAVisitor method caseBehaviorVariable.
@Override
public Boolean caseBehaviorVariable(BehaviorVariable object) {
Option<BTSVariableCategory.Type> category = toNone();
List<BTSVariableDeclaration> names = new ArrayList<>();
DataClassifier dc = object.getDataClassifier();
this.v.processDataType(dc);
Classifier c = Classifier$.MODULE$.apply(dc.getQualifiedName());
BTSType varType = BTSClassifier$.MODULE$.apply(c);
Name name = toSimpleName(object.getName());
Option<BTSExp> assignExpression = toNone();
assert object.getOwnedValueConstant() == null : "Need to handle ba variable const init " + object;
Option<BLESSIntConst> arraySize = toNone();
// NA for BA
Option<BTSAssertion> variableAssertion = toNone();
BTSVariableDeclaration vd = BTSVariableDeclaration$.MODULE$.apply(name, category, varType, assignExpression, arraySize, variableAssertion);
names.add(vd);
push(names);
return false;
}
use of org.sireum.hamr.ir.BTSExp in project osate-plugin by sireum.
the class BAVisitor method caseValueExpression.
@Override
public Boolean caseValueExpression(ValueExpression object) {
assert (object.getRelations().size() >= 1);
List<BTSExp> expressions = new ArrayList<>();
for (Relation r : object.getRelations()) {
visit(r);
expressions.add(pop());
}
if (expressions.size() > 1) {
push(convertToBinaryExp(expressions, object.getLogicalOperators()));
} else {
push(expressions.get(0));
}
return false;
}
Aggregations