Ejemplo n.º 1
0
 /** Returns definitions of bindings referenced by implicit name at the given location. */
 private IName[] findImplicitTargets(
     IASTTranslationUnit ast, IASTNodeSelector nodeSelector, int offset, int length)
     throws CoreException {
   IName[] definitions = IName.EMPTY_ARRAY;
   IASTName firstName = nodeSelector.findEnclosingImplicitName(offset, length);
   if (firstName != null) {
     IASTImplicitNameOwner owner = (IASTImplicitNameOwner) firstName.getParent();
     for (IASTImplicitName name : owner.getImplicitNames()) {
       if (((ASTNode) name).getOffset() == ((ASTNode) firstName).getOffset()) {
         IBinding binding = name.resolveBinding(); // Guaranteed to resolve.
         IName[] declNames = findDeclNames(ast, NameKind.REFERENCE, binding);
         definitions = ArrayUtil.addAll(definitions, declNames);
       }
     }
   }
   return ArrayUtil.trim(definitions);
 }