Package com.google.caja.parser.js

Examples of com.google.caja.parser.js.RealLiteral


            }
          } else {
            Expression lhs = operands.get(0);
            Expression rhs = operands.get(1);
            if (ParseTreeNodes.deepEquals(lhs, rhs)) {
              addFactInt(lhs, Fact.is(new RealLiteral(UNK, Double.NaN)));
            }
          }
          addFactInt(
              Operation.create(
                  UNK, Operator.STRICTLY_NOT_EQUAL,
View Full Code Here


    return normNum(e.fold(isFn));
  }

  private static Expression normNum(Expression e) {
    if (!(e instanceof RealLiteral)) { return e; }
    RealLiteral rl = (RealLiteral) e;
    Number n = rl.getValue();
    double dv = n.doubleValue();
    long lv = n.longValue();
    // Convert 1.0 to 1, but do not convert -0.0 to 0.
    if (dv == lv && (dv != 0d || (1 / dv) > 0)) {
      return new IntegerLiteral(rl.getFilePosition(), lv);
    }
    return rl;
  }
View Full Code Here

            }
          } else {
            Expression lhs = operands.get(0);
            Expression rhs = operands.get(1);
            if (ParseTreeNodes.deepEquals(lhs, rhs)) {
              addFactInt(lhs, Fact.is(new RealLiteral(UNK, Double.NaN)));
            }
          }
          addFactInt(
              Operation.create(
                  UNK, Operator.STRICTLY_NOT_EQUAL,
View Full Code Here

    return normNum(e.fold(isFn));
  }

  private static Expression normNum(Expression e) {
    if (!(e instanceof RealLiteral)) { return e; }
    RealLiteral rl = (RealLiteral) e;
    Number n = rl.getValue();
    double dv = n.doubleValue();
    long lv = n.longValue();
    // Convert 1.0 to 1, but do not convert -0.0 to 0.
    if (dv == lv && (dv != 0d || (1 / dv) > 0)) {
      return new IntegerLiteral(rl.getFilePosition(), lv);
    }
    return rl;
  }
View Full Code Here

TOP

Related Classes of com.google.caja.parser.js.RealLiteral

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.