use of org.eclipse.n4js.n4JS.EqualityOperator in project n4js by eclipse.
the class EqualityExpressionImpl method setOp.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOp(EqualityOperator newOp) {
EqualityOperator oldOp = op;
op = newOp == null ? OP_EDEFAULT : newOp;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, N4JSPackage.EQUALITY_EXPRESSION__OP, oldOp, op));
}
use of org.eclipse.n4js.n4JS.EqualityOperator in project n4js by eclipse.
the class GuardFactory method create.
/**
* @return a {@link Guard} from a given {@link Expression} that is used as condition.
*/
static Guard create(EObject topContainer, Expression expr, boolean negateTree) {
if (expr instanceof EqualityExpression) {
EqualityExpression eqe = (EqualityExpression) expr;
EqualityOperator operation = eqe.getOp();
boolean sameEqual = operation == EqualityOperator.EQ || operation == EqualityOperator.SAME;
boolean sameEqualNot = operation == EqualityOperator.NEQ || operation == EqualityOperator.NSAME;
if (sameEqual || sameEqualNot) {
return createGuardForEquality(topContainer, negateTree, eqe, sameEqualNot);
}
} else if (expr instanceof RelationalExpression) {
RelationalExpression re = (RelationalExpression) expr;
if (re.getOp() == RelationalOperator.INSTANCEOF) {
return createGuardForInstanceof(topContainer, negateTree, re);
}
} else if (expr instanceof ParameterizedCallExpression) {
// TODO: implement GuardType.InState here
} else {
// if (a) {...}
return createGuardForTruthy(topContainer, expr, negateTree);
}
return null;
}
Aggregations