Package com.google.gwt.dev.jjs.ast

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


    private final Stack<JMethodBody> currentMethodBody = new Stack<JMethodBody>();

    @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


      }
    }

    @Override
    public void endVisit(JClassLiteral x, Context ctx) {
      JType newType = translate(x.getRefType());
      if (newType != x.getRefType()) {
        ctx.replaceMe(program.getLiteralClass(newType));
      }
    }
View Full Code Here

     * be invoked. Otherwise, a polymorphic dispatch to the Java-derived object
     * is made.
     */
    @Override
    public void endVisit(JMethodCall x, Context ctx) {
      JType targetClass = x.getTarget().getEnclosingType();
      if (jsoSingleImpls.containsKey(targetClass)) {

        SourceInfo info = x.getSourceInfo().makeChild(
            JavaScriptObjectNormalizer.class,
            "Polymorphic invocation of SingleJsoImpl interface");
View Full Code Here

        // Optimization: narrow to JSO if it's not a dual impl.
        return program.getJavaScriptObject();

      } else if (type instanceof JArrayType) {
        JArrayType arrayType = (JArrayType) type;
        JType leafType = arrayType.getLeafType();
        JType replacement = translate(leafType);
        if (leafType != replacement) {
          return program.getTypeArray(replacement, arrayType.getDims());
        }
      }
      return type;
View Full Code Here

   *         <code>errorReporter</code> will have been invoked.
   */
  public static HasEnclosingType findJsniRefTarget(JsniRef ref,
      JProgram program, JsniRefLookup.ErrorReporter errorReporter) {
    String className = ref.className();
    JType type = null;
    if (!className.equals("null")) {
      type = program.getTypeFromJsniRef(className);
      if (type == null) {
        errorReporter.reportError("Unresolvable native reference to type '"
            + className + "'");
View Full Code Here

  private static String getAssertMethodSuffix(JExpression arg) {
    if (arg == null) {
      return "";
    }
    JType argType = arg.getType();
    if (argType instanceof JReferenceType) {
      return "_Object";
    }

    assert (argType instanceof JPrimitiveType);
    return "_" + argType.getName();
  }
View Full Code Here

      if (op != JBinaryOperator.EQ && op != JBinaryOperator.NEQ) {
        return;
      }
      JExpression lhs = x.getLhs();
      JExpression rhs = x.getRhs();
      JType lhsType = lhs.getType();
      JType rhsType = rhs.getType();
      if (!(lhsType instanceof JReferenceType)) {
        assert !(rhsType instanceof JReferenceType);
        return;
      }
View Full Code Here

    @Override
    public boolean visit(JMethod x, Context ctx) {
      // Let's do it!
      JClassType enclosingType = (JClassType) x.getEnclosingType();
      JType returnType = x.getType();
      SourceInfo sourceInfo = x.getSourceInfo();
      int myIndexInClass = enclosingType.getMethods().indexOf(x);
      assert (myIndexInClass > 0);

      // Create the new static method
View Full Code Here

    private JMethod currentMethod;

    // @Override
    public void endVisit(JBinaryOperation x, Context ctx) {
      if (x.isAssignment()) {
        JType lhsType = x.getLhs().getType();
        JExpression newRhs = checkAndReplaceJso(x.getRhs(), lhsType);
        if (newRhs == x.getRhs()) {
          // There's another case to check: if we have an array store that may
          // trigger a type check, we need to wrap the rhs.
          if (x.getLhs() instanceof JArrayRef) {
View Full Code Here

    /**
     * Wraps a JSO-typed argument if the target type is a different type.
     */
    private JExpression checkAndReplaceJso(JExpression arg, JType targetType) {
      JType argType = arg.getType();
      if (argType == targetType) {
        return arg;
      }
      if (!(targetType instanceof JReferenceType)) {
        return arg;
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.jjs.ast.JType

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.