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

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


  }

  @Override
  public boolean visit(JProgram x, Context ctx) {
    for (int i = 0; i < x.getDeclaredTypes().size(); ++i) {
      JDeclaredType type = x.getDeclaredTypes().get(i);
      accept(type);
      newline();
      newline();
    }
    return false;
View Full Code Here


    verifyTypeRefsInModules();
  }

  private void maybeRecordTypeRef(JType toPossiblyNestedType) {
    if (toPossiblyNestedType instanceof JDeclaredType) {
      JDeclaredType toType = getOuterMostType((JDeclaredType) toPossiblyNestedType);
      maybeRecordTypeRef(fromTypeSourceName, toType.getName());
    }
  }
View Full Code Here

    if (!(referencedType instanceof JDeclaredType)) {
      return;
    }

    JDeclaredType toType = (JDeclaredType) referencedType;
    maybeRecordTypeRef(fromTypeName, toType.getName());
  }
View Full Code Here

        }
      }

      // Rescue super interface array types.
      if (leafType instanceof JDeclaredType) {
        JDeclaredType dLeafType = (JDeclaredType) leafType;
        for (JInterfaceType intfType : dLeafType.getImplements()) {
          JArrayType intfArray = program.getOrCreateArrayType(intfType, dims);
          rescue(intfArray, true, isInstantiated);
        }
      }
View Full Code Here

           * since if there is no @JsExport, the only way for JS code to get a
           * reference to the interface is by it being constructed in Java
           * and passed via JSNI into JS, and in that mechanism, the
           * rescue would happen automatically.
           */
        JDeclaredType dtype = (JDeclaredType) type;

        if (dtype.isJsType()) {
          for (JMethod method : dtype.getMethods()) {
            if (method.needsVtable()) {
              rescue(method);
            }
          }
        }
View Full Code Here

      public boolean visit(JCastOperation x, Context ctx) {
          accept(x.getExpr());

          CfgOptionalThrowNode node = addNode(new CfgOptionalThrowNode(parent, x));
          addNormalExit(node, CfgOptionalThrowNode.NO_THROW);
          JDeclaredType runtimeExceptionType =
                  program.getFromTypeMap("java.lang.RuntimeException");
          if (runtimeExceptionType != null) {
              addExit(Exit.createThrow(node, runtimeExceptionType,
                      CfgOptionalThrowNode.RUNTIME_EXCEPTION));
          }
View Full Code Here

      addNormalExit(node, CfgOptionalThrowNode.NO_THROW);
      for (JClassType exceptionType : x.getTarget().getThrownExceptions()) {
        addExit(Exit.createThrow(node, exceptionType, null));
      }
      JDeclaredType runtimeExceptionType =
        program.getFromTypeMap("java.lang.RuntimeException");
      if (runtimeExceptionType != null) {
        addExit(Exit.createThrow(node, runtimeExceptionType,
            CfgOptionalThrowNode.RUNTIME_EXCEPTION));
      }
      JDeclaredType errorExceptionType =
        program.getFromTypeMap("java.lang.Error");
      if (errorExceptionType != null) {
        addExit(Exit.createThrow(node, errorExceptionType,
            CfgOptionalThrowNode.ERROR));
      }
View Full Code Here

        + "     return 2;"
        + " } "
        + "}");
    Result result = optimize("void", "int i = B.f1; int[] a = new int[] {1, 2, 3}; a[B.f1] = 1;");
    result.into("int i = 1; int[] a = new int[] {1, 2, 3}; a[1] = 1;");
    JDeclaredType bType = result.findClass("test.EntryPoint.B");
    assertTrue("f1 not found as l-value of declaration statement",
        findMethod(bType, "$clinit").getBody().toString().contains("final static int f1 = 1"));
    assertTrue("f1 in condition was not replaced",
        findMethod(bType, "m").getBody().toString().contains("1 == 1"));
    assertEquals("incorrect modifiers for f1",
View Full Code Here

  public static JField findField(JProgram program, String qualifiedFieldName) {
    int pos = qualifiedFieldName.lastIndexOf('.');
    assertTrue(pos > 0);
    String typeName = qualifiedFieldName.substring(0, pos);
    String fieldName = qualifiedFieldName.substring(pos + 1);
    JDeclaredType type = findDeclaredType(program, typeName);
    JField field = findField(type, fieldName);
    return field;
  }
View Full Code Here

    return null;
  }

  public static JMethod findMethod(JProgram program, String methodName) {
    JDeclaredType mainType = program.getFromTypeMap("test.EntryPoint");
    return findMethod(mainType, methodName);
  }
View Full Code Here

TOP

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

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.