Package org.eclipse.jdt.internal.compiler

Examples of org.eclipse.jdt.internal.compiler.ASTVisitor


  public static Map<AbstractMethodDeclaration, JsniMethod> collectJsniMethods(
      final CompilationUnitDeclaration cud, final String source,
      final JsProgram program) {
    final Map<AbstractMethodDeclaration, JsniMethod> jsniMethods = new IdentityHashMap<AbstractMethodDeclaration, JsniMethod>();
    cud.traverse(new ASTVisitor() {
      @Override
      public void endVisit(TypeDeclaration type, BlockScope scope) {
        collectJsniMethods(cud, type, source, program, jsniMethods);
      }
View Full Code Here


    if (!this.options.performMethodsFullRecovery && !this.options.performStatementsRecovery) {
      return null;
    }
    // collect all body declaration inside the compilation unit except the default constructor
    final List bodyDeclarations = new ArrayList();
    ASTVisitor visitor = new ASTVisitor() {
      public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
        if (!methodDeclaration.isDefaultConstructor()) {
          bodyDeclarations.add(methodDeclaration);
        }
        return false;
View Full Code Here

      this.value.resolveType(scope);
      valueType = null; // no need to pursue
    } else {
      valueType = this.value.resolveType(scope);
      // https://bugs.eclipse.org/bugs/show_bug.cgi?id=248897
      ASTVisitor visitor = new ASTVisitor() {
        public boolean visit(SingleNameReference reference, BlockScope scop) {
          if (reference.binding instanceof LocalVariableBinding) {
            ((LocalVariableBinding) reference.binding).useFlag = LocalVariableBinding.USED;
          }
          return true;
View Full Code Here

   * Collect data about interesting methods in one compilation unit.
   *
   * @param cud
   */
  public final void collect(final CompilationUnitDeclaration cud) {
    cud.traverse(new ASTVisitor() {
      @Override
      public void endVisit(TypeDeclaration type, BlockScope scope) {
        collectMethods(cud, type);
      }

View Full Code Here

   *
   * <p>Anonymous inner classes are represented inside expressions. Traverse the JDT AST removing
   * anonymous inner classes in one go.
   */
  private static void processAllAnonymousInnerClasses(CompilationUnitDeclaration cud) {
    ASTVisitor visitor = new ASTVisitor() {
      // Anonymous types are represented within the AST expression that creates the it.
      @Override
      public void endVisit(QualifiedAllocationExpression qualifiedAllocationExpression,
          BlockScope scope) {
        if (qualifiedAllocationExpression.anonymousType != null) {
View Full Code Here

    //
    final CacheManager.Mapper identityMapper = cacheManager.getIdentityMapper();
    for (Iterator iter = cudsByFileName.values().iterator(); iter.hasNext();) {
      CompilationUnitDeclaration cud = (CompilationUnitDeclaration) iter.next();

      cud.traverse(new ASTVisitor() {
        public boolean visit(TypeDeclaration typeDecl, BlockScope scope) {
          JClassType enclosingType = identityMapper.get((SourceTypeBinding) typeDecl.binding.enclosingType());
          processType(typeDecl, enclosingType, true);
          return true;
        }

        public boolean visit(TypeDeclaration typeDecl, ClassScope scope) {
          JClassType enclosingType = identityMapper.get((SourceTypeBinding) typeDecl.binding.enclosingType());
          processType(typeDecl, enclosingType, false);
          return true;
        }

        public boolean visit(TypeDeclaration typeDecl,
            CompilationUnitScope scope) {
          processType(typeDecl, null, false);
          return true;
        }
      }, cud.scope);
    }

    // Perform a deep pass to resolve all types in terms of our types.
    //
    for (Iterator iter = cudsByFileName.values().iterator(); iter.hasNext();) {
      CompilationUnitDeclaration cud = (CompilationUnitDeclaration) iter.next();
      String loc = String.valueOf(cud.getFileName());
      String processing = "Processing types in compilation unit: " + loc;
      final TreeLogger cudLogger = logger.branch(TreeLogger.SPAM, processing,
          null);
      final char[] source = cud.compilationResult.compilationUnit.getContents();

      cud.traverse(new ASTVisitor() {
        public boolean visit(TypeDeclaration typeDecl, BlockScope scope) {
          if (!resolveTypeDeclaration(cudLogger, source, typeDecl)) {
            String name = String.valueOf(typeDecl.binding.readableName());
            String msg = "Unexpectedly unable to fully resolve type " + name;
            logger.log(TreeLogger.WARN, msg, null);
View Full Code Here

    if (!this.options.performMethodsFullRecovery && !this.options.performStatementsRecovery) {
      return null;
    }
    // collect all body declaration inside the compilation unit except the default constructor
    final List bodyDeclarations = new ArrayList();
    ASTVisitor visitor = new ASTVisitor() {
      public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
        if (!methodDeclaration.isDefaultConstructor()) {
          bodyDeclarations.add(methodDeclaration);
        }
        return false;
View Full Code Here

    if (!this.options.performMethodsFullRecovery && !this.options.performStatementsRecovery) {
      return null;
    }
    // collect all body declaration inside the compilation unit except the default constructor
    final List bodyDeclarations = new ArrayList();
    ASTVisitor visitor = new ASTVisitor() {
      public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
        if (!methodDeclaration.isDefaultConstructor()) {
          bodyDeclarations.add(methodDeclaration);
        }
        return false;
View Full Code Here

    if (!this.options.performMethodsFullRecovery && !this.options.performStatementsRecovery) {
      return null;
    }
    // collect all body declaration inside the compilation unit except the default constructor
    final List bodyDeclarations = new ArrayList();
    ASTVisitor visitor = new ASTVisitor() {
      public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
        if (!methodDeclaration.isDefaultConstructor()) {
          bodyDeclarations.add(methodDeclaration);
        }
        return false;
View Full Code Here

          Statement body = lambda.body();
          if (body instanceof Expression) {
            variables.addAll(new ConstraintExpressionFormula((Expression) body, r, COMPATIBLE).inputVariables(context));
          } else {
            // TODO: should I use LambdaExpression.resultExpressions? (is currently private).
            body.traverse(new ASTVisitor() {
              public boolean visit(ReturnStatement returnStatement, BlockScope scope) {
                variables.addAll(new ConstraintExpressionFormula(returnStatement.expression, r, COMPATIBLE).inputVariables(context));
                return false;
              }
            }, (BlockScope)null);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ASTVisitor

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.