Examples of JValueLiteral


Examples of com.google.gwt.dev.jjs.ast.JValueLiteral

      return false;
    }

    private boolean isLiteralZero(JExpression exp) {
      if (exp instanceof JValueLiteral) {
        JValueLiteral lit = (JValueLiteral) exp;
        if (toDouble(lit) == 0.0) {
          // Using toDouble only is safe even for integer types. All types but
          // long will keep full precision. Longs will lose precision, but
          // it will not affect whether the resulting double is zero or not.
          return true;
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JValueLiteral

        return exp;
      }
      if ((type instanceof JPrimitiveType) && (exp instanceof JValueLiteral)) {
        // Statically evaluate casting literals.
        JPrimitiveType typePrim = (JPrimitiveType) type;
        JValueLiteral expLit = (JValueLiteral) exp;
        JValueLiteral casted = typePrim.coerceLiteral(expLit);
        if (casted != null) {
          return casted;
        }
      }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JValueLiteral

        return arg;
      }
      if (arg instanceof JValueLiteral && targetType instanceof JPrimitiveType) {
        // Attempt to coerce the literal.
        JPrimitiveType primitiveType = (JPrimitiveType) targetType;
        JValueLiteral coerced = primitiveType.coerceLiteral((JValueLiteral) arg);
        if (coerced != null) {
          return coerced;
        }
      }
      // Synthesize a cast to long to force explicit conversion.
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JValueLiteral

    for (JParameter parameter : parameterValues.keySet()) {
      if (rescuedMethods.contains(parameter.getEnclosingMethod())) {
        continue;
      }
      JValueLiteral valueLiteral = parameterValues.get(parameter);
      if (valueLiteral != null) {
        SubstituteParameterVisitor substituteParameterVisitor =
            new SubstituteParameterVisitor(parameter, Simplifier.cast(parameter.getType(),
                valueLiteral));
        substituteParameterVisitor.accept(parameter.getEnclosingMethod());
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JValueLiteral

        if (!parameterValues.containsKey(param)) {
          parameterValues.put(param, (JValueLiteral) arg);
          continue;
        }

        JValueLiteral commonParamValue = parameterValues.get(param);
        if (commonParamValue == null) {
          continue;
        }

        if (!equalLiterals(commonParamValue, (JValueLiteral) arg)) {
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JValueLiteral

          return;
        }

        if (var instanceof JParameter || var instanceof JLocal) {
          if (expression != null) {
            JValueLiteral valueLiteral =
              ExpressionEvaluator.evaluate(expression, assumption.unwrap());
            if (valueLiteral != null &&
                (valueLiteral.getType() == var.getType() ||
                 valueLiteral instanceof JNullLiteral)) {
              assumption.set(var, valueLiteral);
            } else {
              // Don't bother to try to get conversions right.
              assumption.set(var, null);
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JValueLiteral

    public boolean visit(JBinaryOperation x, Context ctx) {
      accept(x.getRhs());
      if (result == null) {
        return false;
      }
      JValueLiteral rhs = result;
      accept(x.getLhs());
      if (result == null) {
        return false;
      }
      JValueLiteral lhs = result;
      result = evalBinOp(x, lhs, rhs);
      return false;
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JValueLiteral

  private JNode transform(JVariableRef ref) {
    if (nodeToFold.getJNode() != ref) {
      return null;
    }
    JVariable var = ref.getTarget();
    JValueLiteral literal = assumption.get(var);
    Preconditions.checkNotNull(literal);
    return cloner.cloneExpression(literal);
  }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JValueLiteral

    ConstantsAssumption result = new ConstantsAssumption();

    for (JVariable var : other.values.keySet()) {
      if (values.containsKey(var)) {
        // Var is present in both assumptions. Join their values.
        JValueLiteral value = join(values.get(var), other.values.get(var));
        if (value != null) {
          result.values.put(var, new LiteralWrapper(value));
        }
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JValueLiteral

      if (condition.hasSideEffects()) {
        return;
      }

      JValueLiteral evaluatedCondition =
        ExpressionEvaluator.evaluate(condition, assumption);

      if (evaluatedCondition == null ||
          !(evaluatedCondition instanceof JBooleanLiteral)) {
        super.visitConditionalNode(node);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.