use of com.rockwellcollins.atc.agree.agree.Expr in project AGREE by loonwerks.
the class AgreeValidator method checkWheneverOccursStatement.
@Check(CheckType.FAST)
public void checkWheneverOccursStatement(WheneverOccursStatement whenever) {
Expr cause = whenever.getCause();
Expr effect = whenever.getEffect();
checkExprIsIdentifier(cause);
checkExprIsIdentifier(effect);
TypeDef type = AgreeTypeSystem.infer(cause);
if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.BoolTypeDef, type)) {
error(cause, "The cause of the 'whenever' statement is of type '" + type + "' " + "but must be of type 'bool'");
}
type = AgreeTypeSystem.infer(effect);
if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.BoolTypeDef, type)) {
error(effect, "The effect of the 'whenever' statement is of type '" + type + "' " + "but must be of type 'bool'");
}
}
use of com.rockwellcollins.atc.agree.agree.Expr in project AGREE by loonwerks.
the class AgreeValidator method checkArrayLiteralExpr.
@Check(CheckType.FAST)
public void checkArrayLiteralExpr(ArrayLiteralExpr alit) {
// =======
// public void checkRecordType(RecordType recType) {
// DoubleDotRef recId = recType.getRecord();
// NamedElement finalId = recId.getElm();
// >>>>>>> origin/develop
List<Expr> exprs = alit.getElems();
if (exprs.size() == 0) {
error(alit, "Array literal must have at least one element");
}
Expr target = exprs.get(0);
checkTypeExists(target);
TypeDef t1 = AgreeTypeSystem.infer(target);
for (Expr e : exprs) {
checkTypeExists(e);
TypeDef t2 = AgreeTypeSystem.infer(e);
if (!AgreeTypeSystem.typesEqual(t1, t2)) {
error(e, "type of element must be " + nameOfTypeDef(t1) + ", but has type " + nameOfTypeDef(t2));
}
}
}
use of com.rockwellcollins.atc.agree.agree.Expr in project AGREE by loonwerks.
the class WheneverImpliesStatementImpl method basicSetLhs.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLhs(Expr newLhs, NotificationChain msgs) {
Expr oldLhs = lhs;
lhs = newLhs;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgreePackage.WHENEVER_IMPLIES_STATEMENT__LHS, oldLhs, newLhs);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of com.rockwellcollins.atc.agree.agree.Expr in project AGREE by loonwerks.
the class WheneverStatementImpl method basicSetCause.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCause(Expr newCause, NotificationChain msgs) {
Expr oldCause = cause;
cause = newCause;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgreePackage.WHENEVER_STATEMENT__CAUSE, oldCause, newCause);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of com.rockwellcollins.atc.agree.agree.Expr in project AGREE by loonwerks.
the class UnaryExprImpl method basicSetExpr.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExpr(Expr newExpr, NotificationChain msgs) {
Expr oldExpr = expr;
expr = newExpr;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgreePackage.UNARY_EXPR__EXPR, oldExpr, newExpr);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
Aggregations