use of org.eclipse.n4js.n4JS.NumericLiteral in project n4js by eclipse.
the class GuardFactory method createGuardForVoid.
private static Guard createGuardForVoid(EObject topContainer, UnaryExpression ue, boolean negateTree, boolean negateEqe, Expression symbolExpr) {
Expression voidExpr = ue.getExpression();
if (voidExpr instanceof NumericLiteral) {
NumericLiteral nl = (NumericLiteral) voidExpr;
String numVal = nl.getValueAsString();
if (!"0".equals(numVal)) {
return null;
}
}
GuardAssertion asserts = FlowAssertionFactory.getGuard(topContainer, ue.eContainer(), negateTree, negateEqe);
Guard guard = createIsUndefinedGuard(ue, asserts, symbolExpr);
return guard;
}
use of org.eclipse.n4js.n4JS.NumericLiteral in project n4js by eclipse.
the class DivisionByZeroAnalyser method isZeroLiteral.
private static boolean isZeroLiteral(Expression expr) {
if (expr instanceof NumericLiteral) {
NumericLiteral numLit = (NumericLiteral) expr;
BigDecimal litValue = numLit.getValue();
return litValue.equals(0);
}
return false;
}
Aggregations