Examples of JInstanceOf


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

        JBlock block = x.getCatchBlocks().get(i);
        JLocalRef arg = x.getCatchArgs().get(i);
        catchInfo = block.getSourceInfo();
        JReferenceType argType = (JReferenceType) arg.getType();
        // if ($e instanceof ArgType) { userVar = $e; <user code> }
        JExpression ifTest = new JInstanceOf(program, catchInfo, argType, exRef);
        asg = program.createAssignmentStmt(catchInfo, arg, exRef);
        if (!block.statements.isEmpty()) {
          // Only bother adding the assignment if the block is non-empty
          block.statements.add(0, asg);
        }
View Full Code Here

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

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

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

    return false;
  }

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

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

    return false;
  }

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

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

        // if ($e instanceof ArgType1 or $e instanceof ArgType2 ...) {
        //   var userVar = $e; <user code>
        // }

        // Handle the first Exception type.
        JExpression ifTest = new JInstanceOf(catchInfo, (JReferenceType) exceptionsTypes.get(0),
            new JLocalRef(catchInfo, exceptionVariable));
        // Handle the rest of the Exception types if any.
        for (int j = 1; j < exceptionsTypes.size(); j++) {
          JExpression orExp = new JInstanceOf(catchInfo, (JReferenceType) exceptionsTypes.get(j),
              new JLocalRef(catchInfo, exceptionVariable));
          ifTest = new JBinaryOperation(catchInfo, JPrimitiveType.BOOLEAN, JBinaryOperator.OR,
              ifTest, orExp);
        }
        JDeclarationStatement declaration =
View Full Code Here

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

    return false;
  }

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

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

        ctx.replaceMe(program.getLiteralBoolean(false));
      } else {
        // If possible, try to use a narrower cast
        JClassType concreteType = getSingleConcreteType(toType);
        if (concreteType != null) {
          JInstanceOf newOp = new JInstanceOf(program, x.getSourceInfo(),
              concreteType, x.getExpr());
          ctx.replaceMe(newOp);
        }
      }
    }
View Full Code Here

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

    public void endVisit(InstanceOfExpression x, BlockScope scope) {
      try {
        SourceInfo info = makeSourceInfo(x);
        JExpression expr = pop(x.expression);
        JReferenceType testType = (JReferenceType) typeMap.get(x.type.resolvedType);
        push(new JInstanceOf(info, testType, expr));
      } catch (Throwable e) {
        throw translateException(x, e);
      }
    }
View Full Code Here

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

        case UNKNOWN:
        default:
          // If possible, try to use a narrower cast
          JReferenceType concreteType = getSingleConcreteType(toType);
          if (concreteType != null) {
            JInstanceOf newOp = new JInstanceOf(x.getSourceInfo(), concreteType, x.getExpr());
            ctx.replaceMe(newOp);
          }
          break;
      }
    }
View Full Code Here

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

    public void endVisit(InstanceOfExpression x, BlockScope scope) {
      try {
        SourceInfo info = makeSourceInfo(x);
        JExpression expr = pop(x.expression);
        JReferenceType testType = (JReferenceType) typeMap.get(x.type.resolvedType);
        push(new JInstanceOf(info, testType, expr));
      } catch (Throwable e) {
        throw translateException(x, e);
      }
    }
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.