Package org.eclipse.cdt.core.dom.ast

Examples of org.eclipse.cdt.core.dom.ast.IASTName


          return CANCEL_STATUS;
        }
        IASTNodeSelector nodeSelector= ast.getNodeSelector(null);
        IASTNode selectedNode = nodeSelector.findEnclosingNode(offset, 1);
        if (selectedNode instanceof IASTName) {
          IASTName selectedName = (IASTName) selectedNode;
          IBinding binding = selectedName.resolveBinding();
          CppToProtobufMapping info = delegate.createMappingFrom(binding);
          mappingReference.set(info);
          return OK_STATUS;
        }
        return CANCEL_STATUS;
View Full Code Here


    try{
      IASTTranslationUnit ast = src.getAST(index,
          ITranslationUnit.AST_CONFIGURE_USING_SOURCE_CONTEXT |
          ITranslationUnit.AST_SKIP_INDEXED_HEADERS);
      IASTNodeSelector selector = ast.getNodeSelector(null);
      IASTName name = selector.findEnclosingName(offset, length);
      if (name != null){
        IBinding binding = name.resolveBinding();

        int flags = IIndex.SEARCH_ACROSS_LANGUAGE_BOUNDARIES;
        if (context == FIND_CONTEXT){
          if (!name.isDeclaration() && !name.isDefinition()){
            flags |= IIndex.FIND_DEFINITIONS;
          } else {
            // if on the declaration, search for the definition and vice verca
            flags |= (name.isDefinition() ?
                IIndex.FIND_DECLARATIONS : IIndex.FIND_DEFINITIONS);
          }
        } else if (context == CSearchQuery.FIND_ALL_OCCURRENCES){
          flags |= IIndex.FIND_ALL_OCCURRENCES;
        } else if (context == CSearchQuery.FIND_REFERENCES){
View Full Code Here

    return newDecl;
  }

  @Override
  protected IASTName getParameterName(final IASTDeclarator declarator) {
    IASTName newName = declarator.getName();
    if (stack.getModifiedNodes().contains(newName)) {
      for (final ASTModification currentModification : stack.getModificationsForNode(newName)) {
        if ((currentModification.getKind() == ASTModification.ModificationKind.REPLACE) && (currentModification.getTargetNode() == newName)) {
          newName = (IASTName) currentModification.getNewNode();
        }
View Full Code Here

    }
  }

  private IASTDeclaration buildEnumDeclaration(final EnumDeclarationInfo enumDeclarationInfo) {
    // Ugly hack because ASTWriter doesn't support "new enums"
    final IASTName enumerationName = f.newName(("class " + enumDeclarationInfo.getName().getIdentifier()).toCharArray());
    final ICPPASTEnumerationSpecifier enumerationSpecifier = f.newEnumerationSpecifier(enumerationName);

    enumerationSpecifier.setIsScoped(true);
    for (final EnumConstantDeclarationInfo enumConstantDeclaration : enumDeclarationInfo.enumConstantDeclarations()) {
      enumerationSpecifier.addEnumerator(buildEnumConstantDeclaration(enumConstantDeclaration));
View Full Code Here

  }

  protected void writeDefaultDeclarator(final IASTDeclarator declarator) {
    final IASTPointerOperator[] pointOps = declarator.getPointerOperators();
    writePointerOperators(declarator, pointOps);
    final IASTName name = declarator.getName();
    name.accept(visitor);
    writeNestedDeclarator(declarator);
    final IASTInitializer init = getInitializer(declarator);
    if (init != null) {
      init.accept(visitor);
    }
View Full Code Here

  }

  private void writeArrayDeclarator(final IASTArrayDeclarator arrDecl) {
    final IASTPointerOperator[] pointOps = arrDecl.getPointerOperators();
    writePointerOperators(arrDecl, pointOps);
    final IASTName name = arrDecl.getName();
    name.accept(visitor);

    writeNestedDeclarator(arrDecl);

    final IASTArrayModifier[] arrMods = arrDecl.getArrayModifiers();
    writeArrayModifiers(arrDecl, arrMods);
View Full Code Here

TOP

Related Classes of org.eclipse.cdt.core.dom.ast.IASTName

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.