コード例 #1
0
  @Override
  public boolean accept(ASTVisitor action) {
    if (action.shouldVisitParameterDeclarations) {
      switch (action.visit(this)) {
        case ASTVisitor.PROCESS_ABORT:
          return false;
        case ASTVisitor.PROCESS_SKIP:
          return true;
        default:
          break;
      }
    }

    if (declSpec != null) {
      if (!declSpec.accept(action)) {
        return false;
      }
    }
    if (declarator != null) {
      if (!declarator.accept(action)) {
        return false;
      }
    }
    if (action.shouldVisitParameterDeclarations) {
      switch (action.leave(this)) {
        case ASTVisitor.PROCESS_ABORT:
          return false;
        case ASTVisitor.PROCESS_SKIP:
          return true;
        default:
          break;
      }
    }
    return true;
  }
コード例 #2
0
 private void writeNestedDeclarator(IASTDeclarator funcDec) {
   IASTDeclarator nestedDeclarator = funcDec.getNestedDeclarator();
   if (nestedDeclarator != null) {
     scribe.print('(');
     nestedDeclarator.accept(visitor);
     scribe.print(')');
   }
 }
コード例 #3
0
ファイル: CPPASTDeclarator.java プロジェクト: zhaog/cdt
  @Override
  public boolean accept(ASTVisitor action) {
    if (action.shouldVisitDeclarators) {
      switch (action.visit(this)) {
        case ASTVisitor.PROCESS_ABORT:
          return false;
        case ASTVisitor.PROCESS_SKIP:
          return true;
        default:
          break;
      }
    }

    if (pointerOps != null) {
      for (IASTPointerOperator op : pointerOps) {
        if (op == null) break;
        if (!op.accept(action)) return false;
      }
    }

    if (!acceptByAttributeSpecifiers(action)) return false;

    if (nested == null && name != null) {
      IASTDeclarator outermost = ASTQueries.findOutermostDeclarator(this);
      if (outermost.getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR) {
        if (!name.accept(action)) return false;
        if (action.shouldVisitImplicitNames) {
          for (IASTImplicitName implicitName : getImplicitNames()) {
            if (!implicitName.accept(action)) return false;
          }
        }
      }
    }

    if (nested != null && !nested.accept(action)) return false;

    if (!postAccept(action)) return false;

    if (action.shouldVisitDeclarators && action.leave(this) == ASTVisitor.PROCESS_ABORT)
      return false;

    return true;
  }