Examples of JCastOperation


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

    // no simplification made
    if (original != null) {
      return original;
    }
    return new JCastOperation(sourceInfo, type, exp);
  }
View Full Code Here

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

      if (triviallyTrue) {
        // remove the cast operation
        ctx.replaceMe(x.getExpr());
      } else if (triviallyFalse) {
        // replace with a magic NULL cast
        JCastOperation newOp = new JCastOperation(x.getSourceInfo(),
            program.getTypeNull(), x.getExpr());
        ctx.replaceMe(newOp);
      } else {
        // If possible, try to use a narrower cast
        JClassType concreteType = getSingleConcreteType(toType);
        if (concreteType != null) {
          JCastOperation newOp = new JCastOperation(x.getSourceInfo(),
              concreteType, x.getExpr());
          ctx.replaceMe(newOp);
        }
      }
    }
View Full Code Here

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

    }

    JExpression processExpression(CastExpression x) {
      SourceInfo info = makeSourceInfo(x);
      JType type = (JType) typeMap.get(x.resolvedType);
      JCastOperation cast = new JCastOperation(info, type,
          dispProcessExpression(x.expression));
      return cast;
    }
View Full Code Here

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

    private JExpression maybeCast(JType expected, JExpression expression) {
      if (expected != expression.getType()) {
        // Must be a generic; insert a cast operation.
        JReferenceType toType = (JReferenceType) expected;
        return new JCastOperation(expression.getSourceInfo(), toType,
            expression);
      } else {
        return expression;
      }
    }
View Full Code Here

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

  private JExpression box(JExpression toBox, JPrimitiveType primitiveType,
      JClassType wrapperType) {
    // Add a cast to toBox if need be
    if (toBox.getType() != primitiveType) {
      toBox = new JCastOperation(toBox.getSourceInfo(), primitiveType, toBox);
    }

    // Find the correct valueOf() method.
    JMethod valueOfMethod = null;
    for (JMethod method : wrapperType.getMethods()) {
View Full Code Here

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

    // no simplification made
    if (original != null) {
      return original;
    }
    return new JCastOperation(sourceInfo, type, exp);
  }
View Full Code Here

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

    }

    JExpression processExpression(CastExpression x) {
      SourceInfo info = makeSourceInfo(x);
      JType type = (JType) typeMap.get(x.resolvedType);
      JCastOperation cast = new JCastOperation(info, type,
          dispProcessExpression(x.expression));
      return cast;
    }
View Full Code Here

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

    private JExpression maybeCast(JType expected, JExpression expression) {
      if (expected != expression.getType()) {
        // Must be a generic; insert a cast operation.
        JReferenceType toType = (JReferenceType) expected;
        return new JCastOperation(expression.getSourceInfo(), toType,
            expression);
      } else {
        return expression;
      }
    }
View Full Code Here

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

    }

    if (lhs instanceof JCastOperation) {
      // Assignment-to-cast-operation, e.g.
      // (Foo) x = foo -> x = foo
      JCastOperation cast = (JCastOperation) lhs;
      JBinaryOperation newAsg = new JBinaryOperation(x.getSourceInfo(),
          x.getType(), JBinaryOperator.ASG, cast.getExpr(), x.getRhs());
      ctx.replaceMe(newAsg);
    }
  }
View Full Code Here

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

   * Insert an implicit cast if the types differ; it might get optimized out
   * later, but in some cases it will force correct math evaluation.
   */
  private static JExpression maybeCast(JExpression exp, JType targetType) {
    if (exp.getType() != targetType) {
      exp = new JCastOperation(exp.getSourceInfo(), targetType, exp);
    }
    return exp;
  }
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.