Examples of JReferenceType


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

            program.getTypeNull());
        call.addArg(expr);
        replaceExpr = call;
      } else if (toType instanceof JReferenceType) {
        JExpression curExpr = expr;
        JReferenceType refType = (JReferenceType) toType;
        JReferenceType argType = (JReferenceType) expr.getType();
        if (program.typeOracle.canTriviallyCast(argType, refType)) {
          // just remove the cast
          replaceExpr = curExpr;
        } else {
View Full Code Here

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

      ctx.replaceMe(replaceExpr);
    }

    @Override
    public void endVisit(JInstanceOf x, Context ctx) {
      JReferenceType argType = (JReferenceType) x.getExpr().getType();
      JReferenceType toType = x.getTestType();
      if (program.typeOracle.canTriviallyCast(argType, toType)) {
        // trivially true if non-null; replace with a null test
        JNullLiteral nullLit = program.getLiteralNull();
        JBinaryOperation eq = new JBinaryOperation(x.getSourceInfo(),
            program.getTypePrimitiveBoolean(), JBinaryOperator.NEQ,
View Full Code Here

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

    Queue<JReferenceType> typesToCheck = new ArrayBlockingQueue<JReferenceType>(
        jprogram.getDeclaredTypes().size());
    typesToCheck.addAll(jprogram.getDeclaredTypes());

    while (!typesToCheck.isEmpty()) {
      JReferenceType type = typesToCheck.remove();
      if (type.getSuperClass() != null) {
        int typeFrag = getOrZero(fragmentMap.types, type);
        int supertypeFrag = getOrZero(fragmentMap.types, type.getSuperClass());
        if (typeFrag != supertypeFrag && supertypeFrag != 0) {
          numFixups++;
          fragmentMap.types.put(type.getSuperClass(), 0);
          typesToCheck.add(type.getSuperClass());
        }
      }
    }

    logger.log(TreeLogger.DEBUG,
View Full Code Here

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

    private <T extends HasEnclosingType & CanBeStatic> boolean isPruned(T node) {
      if (!referencedNonTypes.contains(node)) {
        return true;
      }
      JReferenceType enclosingType = node.getEnclosingType();
      return !node.isStatic() && enclosingType != null
          && !program.typeOracle.isInstantiatedType(enclosingType);
    }
View Full Code Here

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

      if (!x.canBePolymorphic()) {
        return;
      }

      JType instanceType = instance.getType();
      JReferenceType enclosingType = method.getEnclosingType();

      if (instanceType == enclosingType
          || instanceType instanceof JInterfaceType) {
        // This method call is as tight as it can be for the type of the
        // qualifier
View Full Code Here

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

      JType leafType = type.getLeafType();
      int dims = type.getDims();

      // Rescue my super array type
      if (leafType instanceof JReferenceType) {
        JReferenceType rLeafType = (JReferenceType) leafType;
        if (rLeafType.getSuperClass() != null) {
          JArrayType superArray = program.getTypeArray(
              rLeafType.getSuperClass(), dims);
          rescue(superArray, true, isInstantiated);
        }
      }

      if (leafType instanceof JDeclaredType) {
View Full Code Here

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

      return true;
    }

    @Override
    public boolean visit(final JMethod x, Context ctx) {
      JReferenceType enclosingType = x.getEnclosingType();
      if (program.isJavaScriptObject(enclosingType)) {
        // Calls to JavaScriptObject types rescue those types.
        boolean instance = !x.isStatic() || program.isStaticImpl(x);
        rescue(enclosingType, true, instance);
      } else if (x.isStatic()) {
View Full Code Here

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

      x.setType(translate(x.getType()));
    }

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

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

      // compiling should prevent this case from ever happening in real life.
      //
      throw new InternalCompilerException("Unexpected failure to rebind '"
          + reqType + "'");
    }
    JReferenceType result = program.getFromTypeMap(reboundClassName);
    assert (result != null);
    return (JClassType) result;
  }
View Full Code Here

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

          exVar));
      for (int i = x.getCatchBlocks().size() - 1; i >= 0; --i) {
        JBlock block = x.getCatchBlocks().get(i);
        JLocalRef arg = x.getCatchArgs().get(i);
        catchInfo = block.getSourceInfo();
        JReferenceType argType = (JReferenceType) arg.getType();
        // if ($e instanceof ArgType) { var userVar = $e; <user code> }
        JExpression ifTest = new JInstanceOf(catchInfo, argType, new JLocalRef(
            catchInfo, exVar));
        JDeclarationStatement declaration = new JDeclarationStatement(
            catchInfo, arg, new JLocalRef(catchInfo, exVar));
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.