示例#1
0
 @NotNull
 @Override
 public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
   ArrayList<DeclarationDescriptor> result = new ArrayList<DeclarationDescriptor>();
   for (JetScope jetScope : scopeChain) {
     result.addAll(jetScope.getDeclarationsByLabel(labelName));
   }
   result.trimToSize();
   return result;
 }
  @NotNull
  @Override
  public Set<VariableDescriptor> getProperties(@NotNull Name name) {
    checkMayRead();

    Set<VariableDescriptor> properties = Sets.newLinkedHashSet();
    for (JetScope imported : getImports()) {
      properties.addAll(imported.getProperties(name));
    }
    return properties;
  }
示例#3
0
 @NotNull
 @Override
 public Collection<DeclarationDescriptor> getAllDescriptors() {
   if (allDescriptors == null) {
     allDescriptors = new HashSet<DeclarationDescriptor>();
     for (JetScope scope : scopeChain) {
       allDescriptors.addAll(scope.getAllDescriptors());
     }
   }
   return allDescriptors;
 }
示例#4
0
  @Override
  public void printScopeStructure(@NotNull Printer p) {
    p.println(getClass().getSimpleName(), ": ", debugName, " {");
    p.pushIndent();

    for (JetScope scope : scopeChain) {
      scope.printScopeStructure(p);
    }

    p.popIndent();
    p.println("}");
  }
  @Override
  public NamespaceDescriptor getNamespace(@NotNull Name name) {
    checkMayRead();

    for (JetScope imported : getImports()) {
      NamespaceDescriptor importedDescriptor = imported.getNamespace(name);
      if (importedDescriptor != null) {
        return importedDescriptor;
      }
    }
    return null;
  }
  @Override
  public ClassifierDescriptor getClassifier(@NotNull Name name) {
    checkMayRead();

    for (JetScope imported : getImports()) {
      ClassifierDescriptor importedClassifier = imported.getClassifier(name);
      if (importedClassifier != null) {
        return importedClassifier;
      }
    }
    return null;
  }
  @Override
  public ClassDescriptor getObjectDescriptor(@NotNull Name name) {
    checkMayRead();

    for (JetScope imported : getImports()) {
      ClassDescriptor objectDescriptor = imported.getObjectDescriptor(name);
      if (objectDescriptor != null) {
        return objectDescriptor;
      }
    }
    return null;
  }
示例#8
0
 @NotNull
 @Override
 public List<ReceiverParameterDescriptor> getImplicitReceiversHierarchy() {
   if (implicitReceiverHierarchy == null) {
     ArrayList<ReceiverParameterDescriptor> result = new ArrayList<ReceiverParameterDescriptor>();
     for (JetScope jetScope : scopeChain) {
       result.addAll(jetScope.getImplicitReceiversHierarchy());
     }
     result.trimToSize();
     implicitReceiverHierarchy = result;
   }
   return implicitReceiverHierarchy;
 }
  @Override
  public VariableDescriptor getLocalVariable(@NotNull Name name) {
    checkMayRead();

    // Meaningful lookup goes here
    for (JetScope imported : getImports()) {
      VariableDescriptor importedDescriptor = imported.getLocalVariable(name);
      if (importedDescriptor != null) {
        return importedDescriptor;
      }
    }
    return null;
  }
  @NotNull
  @Override
  public Set<FunctionDescriptor> getFunctions(@NotNull Name name) {
    checkMayRead();

    if (getImports().isEmpty()) {
      return Collections.emptySet();
    }
    Set<FunctionDescriptor> result = Sets.newLinkedHashSet();
    for (JetScope imported : getImports()) {
      result.addAll(imported.getFunctions(name));
    }
    return result;
  }
  @Override
  public void getImplicitReceiversHierarchy(@NotNull List<ReceiverDescriptor> result) {
    checkMayRead();

    super.getImplicitReceiversHierarchy(result);
    // Imported scopes come with their receivers
    // Example: class member resolution scope imports a scope of it's class object
    //          members of the class object must be able to find it as an implicit receiver
    for (JetScope scope : getImports()) {
      ReceiverDescriptor definedReceiver = scope.getImplicitReceiver();
      if (definedReceiver.exists()) {
        result.add(0, definedReceiver);
      }
    }
  }
示例#12
0
 @NotNull
 @Override
 public Collection<DeclarationDescriptor> getAllDescriptors() {
   if (allDescriptors == null) {
     allDescriptors = substitute(workerScope.getAllDescriptors());
   }
   return allDescriptors;
 }
示例#13
0
  @TestOnly
  @Override
  public void printScopeStructure(@NotNull Printer p) {
    p.println(getClass().getSimpleName(), " {");
    p.pushIndent();

    p.println("substitutor = ");
    p.pushIndent();
    p.println(substitutor);
    p.popIndent();

    p.print("workerScope = ");
    workerScope.printScopeStructure(p.withholdIndentOnce());

    p.popIndent();
    p.println("}");
  }
示例#14
0
 @Override
 public PackageViewDescriptor getPackage(@NotNull Name name) {
   return workerScope.getPackage(name);
 }
示例#15
0
 @Override
 public ClassifierDescriptor getClassifier(@NotNull Name name) {
   return substitute(workerScope.getClassifier(name));
 }
示例#16
0
 @Override
 public VariableDescriptor getLocalVariable(@NotNull Name name) {
   return substitute(workerScope.getLocalVariable(name));
 }
示例#17
0
 @NotNull
 @Override
 public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
   return substitute(workerScope.getProperties(name));
 }
示例#18
0
 @NotNull
 @Override
 public Collection<DeclarationDescriptor> getOwnDeclaredDescriptors() {
   return substitute(workerScope.getOwnDeclaredDescriptors());
 }
示例#19
0
 @NotNull
 @Override
 public Collection<FunctionDescriptor> getFunctions(@NotNull Name name) {
   return substitute(workerScope.getFunctions(name));
 }
示例#20
0
 @NotNull
 @Override
 public DeclarationDescriptor getContainingDeclaration() {
   return workerScope.getContainingDeclaration();
 }