Esempio n. 1
0
    @Override
    public IBinding[] getBindings(ScopeLookupData lookup) {
      if (lookup.getLookupName() instanceof ICPPASTTemplateId) return IBinding.EMPTY_BINDING_ARRAY;

      if (lookup.isPrefixLookup()) return getPrefixBindings(lookup.getLookupKey());
      return getBindings(lookup.getLookupKey());
    }
  @Override
  public IBinding[] getBindings(ScopeLookupData lookup) {
    try {
      if (lookup.getLookupName() instanceof ICPPASTConversionName) {
        BindingCollector visitor =
            new BindingCollector(
                fBinding.getLinkage(), Keywords.cOPERATOR, CONVERSION_FILTER, true, false, true);
        acceptViaCache(fBinding, visitor, true);
        return visitor.getBindings();
      }

      final char[] nameChars = lookup.getLookupKey();
      if (!lookup.isPrefixLookup()) {
        if (CharArrayUtils.equals(fBinding.getNameCharArray(), nameChars)) {
          if (CPPClassScope.shallReturnConstructors(lookup.getLookupName(), false)) {
            return ClassTypeHelper.getConstructors(fBinding, lookup.getLookupPoint());
          }
          return new IBinding[] {getClassNameBinding()};
        }
        return getBindingsViaCache(
            fBinding, nameChars, IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE);
      }

      // Prefix lookup.
      BindingCollector visitor =
          new BindingCollector(
              fBinding.getLinkage(),
              nameChars,
              IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE,
              true,
              true,
              false);
      if (ContentAssistMatcherFactory.getInstance().match(nameChars, fBinding.getNameCharArray())) {
        // Add the class itself, constructors will be found during the visit.
        visitor.visit((IPDOMNode) getClassNameBinding());
      }
      acceptViaCache(fBinding, visitor, true);
      return visitor.getBindings();
    } catch (CoreException e) {
      CCorePlugin.log(e);
    }
    return null;
  }