示例#1
0
  @NotNull
  public JetScope getScopeForClassHeaderResolution() {
    if (scopeForClassHeaderResolution == null) {
      WritableScopeImpl scope =
          new WritableScopeImpl(
              JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Class Header Resolution");
      for (TypeParameterDescriptor typeParameterDescriptor : getTypeConstructor().getParameters()) {
        scope.addClassifierDescriptor(typeParameterDescriptor);
      }
      scope.changeLockLevel(WritableScope.LockLevel.READING);

      scopeForClassHeaderResolution =
          new ChainedScope(
              this,
              scope,
              resolveSession.getResolutionScope(
                  declarationProvider.getOwnerInfo().getScopeAnchor()));
    }
    return scopeForClassHeaderResolution;
  }
示例#2
0
  @NotNull
  private JetScope computeScopeForClassHeaderResolution() {
    WritableScopeImpl scope =
        new WritableScopeImpl(
            JetScope.EMPTY,
            this,
            RedeclarationHandler.DO_NOTHING,
            "Scope with type parameters for " + getName());
    for (TypeParameterDescriptor typeParameterDescriptor : getTypeConstructor().getParameters()) {
      scope.addClassifierDescriptor(typeParameterDescriptor);
    }
    scope.changeLockLevel(WritableScope.LockLevel.READING);

    PsiElement scopeAnchor = declarationProvider.getOwnerInfo().getScopeAnchor();

    return new ChainedScope(
        this,
        "ScopeForClassHeaderResolution: " + getName(),
        scope,
        getScopeProvider().getResolutionScopeForDeclaration(scopeAnchor));
  }