Examples of JCastOperation


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

    @Override
    public void endVisit(JCastOperation x, Context ctx) {
      JType newType = translate(x.getCastType());
      if (newType != x.getCastType()) {
        ctx.replaceMe(new JCastOperation(x.getSourceInfo(), newType,
            x.getExpr()));
      }
    }
View Full Code Here

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

    return false;
  }

  @Override
  public boolean visit(JCastOperation x, Context ctx) {
    expression = new JCastOperation(x.getSourceInfo(), x.getCastType(),
        cloneExpression(x.getExpr()));
    return false;
  }
View Full Code Here

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

      }
      if (!program.isJavaScriptObject(argType)) {
        return arg;
      }
      // Synthesize a cast to the arg type to force a wrap
      JCastOperation cast = new JCastOperation(program, arg.getSourceInfo(),
          argType, arg);
      return cast;
    }
View Full Code Here

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

      }
      if (!program.isJavaScriptObject(arg.getType())) {
        return arg;
      }
      // Synthesize a cast to the target type
      JCastOperation cast = new JCastOperation(program, arg.getSourceInfo(),
          targetType, arg);
      return cast;
    }
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(program, x.getSourceInfo(),
            program.getTypeNull(), 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(program, info, type,
          dispProcessExpression(x.expression));
      return cast;
    }
View Full Code Here

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

      JType type = x.getType();
      if (x.getOp() == JBinaryOperator.DIV
          && type != program.getTypePrimitiveFloat()
          && type != program.getTypePrimitiveDouble()) {
        x.setType(program.getTypePrimitiveDouble());
        JCastOperation cast = new JCastOperation(program, x.getSourceInfo(),
            type, x);
        ctx.replaceMe(cast);
      }
    }
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(program, toBox.getSourceInfo(), primitiveType,
          toBox);
    }

    // Find the correct valueOf() method.
    JMethod valueOfMethod = null;
View Full Code Here

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

      // no simplification made
      if (original != null) {
        return original;
      }
      return new JCastOperation(program, exp.getSourceInfo(), 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(program, 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(program, x.getSourceInfo(),
              concreteType, x.getExpr());
          ctx.replaceMe(newOp);
        }
      }
    }
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.