Created common supertype for HierarchicalScope and MemberScope-- ResolutionScope

This commit is contained in:
Stanislav Erokhin
2015-11-04 15:44:54 +03:00
parent c4582d0e0c
commit b3e69a5f5d
3 changed files with 45 additions and 34 deletions
@@ -24,24 +24,9 @@ import org.jetbrains.kotlin.utils.Printer
// see utils/ScopeUtils.kt
interface HierarchicalScope {
interface HierarchicalScope : ResolutionScope {
val parent: HierarchicalScope?
/**
* All visible descriptors from current scope possibly filtered by the given name and kind filters
* (that means that the implementation is not obliged to use the filters but may do so when it gives any performance advantage).
*/
fun getContributedDescriptors(
kindFilter: DescriptorKindFilter = DescriptorKindFilter.ALL,
nameFilter: (Name) -> Boolean = MemberScope.ALL_NAME_FILTER
): Collection<DeclarationDescriptor>
fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor?
fun getContributedVariables(name: Name, location: LookupLocation): Collection<VariableDescriptor>
fun getContributedFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor>
fun printStructure(p: Printer)
}
@@ -23,27 +23,14 @@ import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.kotlin.utils.toReadOnlyList
import java.lang.reflect.Modifier
public interface MemberScope {
public fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor?
@Deprecated("Should be removed soon")
public fun getPackage(name: Name): PackageViewDescriptor?
public fun getContributedVariables(name: Name, location: LookupLocation): Collection<PropertyDescriptor>
public fun getContributedFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor>
public interface MemberScope : ResolutionScope {
val ownerDescriptor: DeclarationDescriptor
/**
* All visible descriptors from current scope possibly filtered by the given name and kind filters
* (that means that the implementation is not obliged to use the filters but may do so when it gives any performance advantage).
*/
public fun getContributedDescriptors(
kindFilter: DescriptorKindFilter = DescriptorKindFilter.ALL,
nameFilter: (Name) -> Boolean = ALL_NAME_FILTER
): Collection<DeclarationDescriptor>
public override fun getContributedVariables(name: Name, location: LookupLocation): Collection<PropertyDescriptor>
@Deprecated("Should be removed soon")
public fun getPackage(name: Name): PackageViewDescriptor?
/**
* Is supposed to be used in tests and debug only
@@ -0,0 +1,39 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.resolve.scopes
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.incremental.components.LookupLocation
import org.jetbrains.kotlin.name.Name
public interface ResolutionScope {
public fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor?
public fun getContributedVariables(name: Name, location: LookupLocation): Collection<VariableDescriptor>
public fun getContributedFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor>
/**
* All visible descriptors from current scope possibly filtered by the given name and kind filters
* (that means that the implementation is not obliged to use the filters but may do so when it gives any performance advantage).
*/
public fun getContributedDescriptors(
kindFilter: DescriptorKindFilter = DescriptorKindFilter.ALL,
nameFilter: (Name) -> Boolean = MemberScope.ALL_NAME_FILTER
): Collection<DeclarationDescriptor>
}