Removed unused methods from KtScope.
This commit is contained in:
@@ -28,7 +28,6 @@ import org.jetbrains.kotlin.resolve.DescriptorFactory
|
|||||||
import org.jetbrains.kotlin.resolve.calls.tasks.collectors.CallableDescriptorCollector
|
import org.jetbrains.kotlin.resolve.calls.tasks.collectors.CallableDescriptorCollector
|
||||||
import org.jetbrains.kotlin.resolve.calls.tasks.collectors.CallableDescriptorCollectors
|
import org.jetbrains.kotlin.resolve.calls.tasks.collectors.CallableDescriptorCollectors
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||||
import org.jetbrains.kotlin.resolve.scopes.KtScope
|
|
||||||
import org.jetbrains.kotlin.resolve.scopes.KtScopeImpl
|
import org.jetbrains.kotlin.resolve.scopes.KtScopeImpl
|
||||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver
|
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver
|
||||||
|
|||||||
+5
-8
@@ -19,14 +19,16 @@ package org.jetbrains.kotlin.load.java.lazy.descriptors
|
|||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||||
import org.jetbrains.kotlin.descriptors.impl.*
|
import org.jetbrains.kotlin.descriptors.impl.ConstructorDescriptorImpl
|
||||||
|
import org.jetbrains.kotlin.descriptors.impl.EnumEntrySyntheticClassDescriptor
|
||||||
|
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
import org.jetbrains.kotlin.load.java.*
|
import org.jetbrains.kotlin.load.java.*
|
||||||
import org.jetbrains.kotlin.load.java.BuiltinSpecialProperties.getBuiltinSpecialPropertyGetterName
|
|
||||||
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithDifferentJvmName.sameAsRenamedInJvmBuiltin
|
|
||||||
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithDifferentJvmName.isRemoveAtByIndex
|
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithDifferentJvmName.isRemoveAtByIndex
|
||||||
|
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithDifferentJvmName.sameAsRenamedInJvmBuiltin
|
||||||
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature.sameAsBuiltinMethodWithErasedValueParameters
|
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature.sameAsBuiltinMethodWithErasedValueParameters
|
||||||
|
import org.jetbrains.kotlin.load.java.BuiltinSpecialProperties.getBuiltinSpecialPropertyGetterName
|
||||||
import org.jetbrains.kotlin.load.java.components.DescriptorResolverUtils
|
import org.jetbrains.kotlin.load.java.components.DescriptorResolverUtils
|
||||||
import org.jetbrains.kotlin.load.java.components.TypeUsage
|
import org.jetbrains.kotlin.load.java.components.TypeUsage
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaConstructorDescriptor
|
import org.jetbrains.kotlin.load.java.descriptors.JavaConstructorDescriptor
|
||||||
@@ -38,7 +40,6 @@ import org.jetbrains.kotlin.load.java.lazy.child
|
|||||||
import org.jetbrains.kotlin.load.java.lazy.resolveAnnotations
|
import org.jetbrains.kotlin.load.java.lazy.resolveAnnotations
|
||||||
import org.jetbrains.kotlin.load.java.lazy.types.RawSubstitution
|
import org.jetbrains.kotlin.load.java.lazy.types.RawSubstitution
|
||||||
import org.jetbrains.kotlin.load.java.lazy.types.toAttributes
|
import org.jetbrains.kotlin.load.java.lazy.types.toAttributes
|
||||||
import org.jetbrains.kotlin.load.java.sources.JavaSourceElement
|
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaArrayType
|
import org.jetbrains.kotlin.load.java.structure.JavaArrayType
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaConstructor
|
import org.jetbrains.kotlin.load.java.structure.JavaConstructor
|
||||||
@@ -630,10 +631,6 @@ public class LazyJavaClassMemberScope(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> = listOf()
|
|
||||||
|
|
||||||
|
|
||||||
override fun getContainingDeclaration() = super.getContainingDeclaration() as ClassDescriptor
|
override fun getContainingDeclaration() = super.getContainingDeclaration() as ClassDescriptor
|
||||||
|
|
||||||
// namespaces should be resolved elsewhere
|
// namespaces should be resolved elsewhere
|
||||||
|
|||||||
-3
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.load.java.lazy.descriptors
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassOrPackageFragmentDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassOrPackageFragmentDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||||
import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext
|
import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaMethod
|
import org.jetbrains.kotlin.load.java.structure.JavaMethod
|
||||||
@@ -37,8 +36,6 @@ public abstract class LazyJavaStaticScope(
|
|||||||
override fun getPackage(name: Name) = null
|
override fun getPackage(name: Name) = null
|
||||||
abstract fun getSubPackages(): Collection<FqName>
|
abstract fun getSubPackages(): Collection<FqName>
|
||||||
|
|
||||||
override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> = listOf()
|
|
||||||
|
|
||||||
override fun resolveMethodSignature(
|
override fun resolveMethodSignature(
|
||||||
method: JavaMethod, methodTypeParameters: List<TypeParameterDescriptor>, returnType: KotlinType,
|
method: JavaMethod, methodTypeParameters: List<TypeParameterDescriptor>, returnType: KotlinType,
|
||||||
valueParameters: LazyJavaScope.ResolvedValueParameters
|
valueParameters: LazyJavaScope.ResolvedValueParameters
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.resolve.scopes
|
|||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,10 +33,6 @@ public abstract class AbstractScopeAdapter : KtScope {
|
|||||||
else
|
else
|
||||||
workerScope
|
workerScope
|
||||||
|
|
||||||
override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> {
|
|
||||||
return workerScope.getImplicitReceiversHierarchy()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
|
override fun getFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
|
||||||
return workerScope.getFunctions(name, location)
|
return workerScope.getFunctions(name, location)
|
||||||
}
|
}
|
||||||
@@ -54,34 +49,10 @@ public abstract class AbstractScopeAdapter : KtScope {
|
|||||||
return workerScope.getProperties(name, location)
|
return workerScope.getProperties(name, location)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<PropertyDescriptor> {
|
|
||||||
return workerScope.getSyntheticExtensionProperties(receiverTypes, name, location)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
|
|
||||||
return workerScope.getSyntheticExtensionFunctions(receiverTypes, name, location)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor> {
|
|
||||||
return workerScope.getSyntheticExtensionProperties(receiverTypes)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor> {
|
|
||||||
return workerScope.getSyntheticExtensionFunctions(receiverTypes)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getLocalVariable(name: Name): VariableDescriptor? {
|
|
||||||
return workerScope.getLocalVariable(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getContainingDeclaration(): DeclarationDescriptor {
|
override fun getContainingDeclaration(): DeclarationDescriptor {
|
||||||
return workerScope.getContainingDeclaration()
|
return workerScope.getContainingDeclaration()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor> {
|
|
||||||
return workerScope.getDeclarationsByLabel(labelName)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getDescriptors(kindFilter: DescriptorKindFilter,
|
override fun getDescriptors(kindFilter: DescriptorKindFilter,
|
||||||
nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> {
|
nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> {
|
||||||
return workerScope.getDescriptors(kindFilter, nameFilter)
|
return workerScope.getDescriptors(kindFilter, nameFilter)
|
||||||
|
|||||||
@@ -19,11 +19,9 @@ package org.jetbrains.kotlin.resolve.scopes
|
|||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
|
||||||
import org.jetbrains.kotlin.util.collectionUtils.getFirstMatch
|
import org.jetbrains.kotlin.util.collectionUtils.getFirstMatch
|
||||||
import org.jetbrains.kotlin.util.collectionUtils.getFromAllScopes
|
import org.jetbrains.kotlin.util.collectionUtils.getFromAllScopes
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
import java.util.ArrayList
|
|
||||||
|
|
||||||
public open class ChainedScope(
|
public open class ChainedScope(
|
||||||
private val containingDeclaration: DeclarationDescriptor?/* it's nullable as a hack for TypeUtils.intersect() */,
|
private val containingDeclaration: DeclarationDescriptor?/* it's nullable as a hack for TypeUtils.intersect() */,
|
||||||
@@ -31,7 +29,6 @@ public open class ChainedScope(
|
|||||||
vararg scopes: KtScope
|
vararg scopes: KtScope
|
||||||
) : KtScope {
|
) : KtScope {
|
||||||
private val scopeChain = scopes.clone()
|
private val scopeChain = scopes.clone()
|
||||||
private var implicitReceiverHierarchy: List<ReceiverParameterDescriptor>? = null
|
|
||||||
|
|
||||||
override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor?
|
override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor?
|
||||||
= getFirstMatch(scopeChain) { it.getClassifier(name, location) }
|
= getFirstMatch(scopeChain) { it.getClassifier(name, location) }
|
||||||
@@ -42,38 +39,11 @@ public open class ChainedScope(
|
|||||||
override fun getProperties(name: Name, location: LookupLocation): Collection<VariableDescriptor>
|
override fun getProperties(name: Name, location: LookupLocation): Collection<VariableDescriptor>
|
||||||
= getFromAllScopes(scopeChain) { it.getProperties(name, location) }
|
= getFromAllScopes(scopeChain) { it.getProperties(name, location) }
|
||||||
|
|
||||||
override fun getLocalVariable(name: Name): VariableDescriptor?
|
|
||||||
= getFirstMatch(scopeChain) { it.getLocalVariable(name) }
|
|
||||||
|
|
||||||
override fun getFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
override fun getFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
||||||
= getFromAllScopes(scopeChain) { it.getFunctions(name, location) }
|
= getFromAllScopes(scopeChain) { it.getFunctions(name, location) }
|
||||||
|
|
||||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<PropertyDescriptor>
|
|
||||||
= getFromAllScopes(scopeChain) { it.getSyntheticExtensionProperties(receiverTypes, name, location) }
|
|
||||||
|
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
|
||||||
= getFromAllScopes(scopeChain) { it.getSyntheticExtensionFunctions(receiverTypes, name, location) }
|
|
||||||
|
|
||||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor>
|
|
||||||
= getFromAllScopes(scopeChain) { it.getSyntheticExtensionProperties(receiverTypes) }
|
|
||||||
|
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor>
|
|
||||||
= getFromAllScopes(scopeChain) { it.getSyntheticExtensionFunctions(receiverTypes) }
|
|
||||||
|
|
||||||
override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> {
|
|
||||||
if (implicitReceiverHierarchy == null) {
|
|
||||||
val result = ArrayList<ReceiverParameterDescriptor>()
|
|
||||||
scopeChain.flatMapTo(result) { it.getImplicitReceiversHierarchy() }
|
|
||||||
result.trimToSize()
|
|
||||||
implicitReceiverHierarchy = result
|
|
||||||
}
|
|
||||||
return implicitReceiverHierarchy!!
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getContainingDeclaration(): DeclarationDescriptor = containingDeclaration!!
|
override fun getContainingDeclaration(): DeclarationDescriptor = containingDeclaration!!
|
||||||
|
|
||||||
override fun getDeclarationsByLabel(labelName: Name) = scopeChain.flatMap { it.getDeclarationsByLabel(labelName) }
|
|
||||||
|
|
||||||
override fun getDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean)
|
override fun getDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean)
|
||||||
= getFromAllScopes(scopeChain) { it.getDescriptors(kindFilter, nameFilter) }
|
= getFromAllScopes(scopeChain) { it.getDescriptors(kindFilter, nameFilter) }
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,8 @@
|
|||||||
package org.jetbrains.kotlin.resolve.scopes
|
package org.jetbrains.kotlin.resolve.scopes
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
|
|
||||||
public class FilteringScope(private val workerScope: KtScope, private val predicate: (DeclarationDescriptor) -> Boolean) : KtScope {
|
public class FilteringScope(private val workerScope: KtScope, private val predicate: (DeclarationDescriptor) -> Boolean) : KtScope {
|
||||||
@@ -39,27 +36,9 @@ public class FilteringScope(private val workerScope: KtScope, private val predic
|
|||||||
|
|
||||||
override fun getProperties(name: Name, location: LookupLocation) = workerScope.getProperties(name, location).filter(predicate)
|
override fun getProperties(name: Name, location: LookupLocation) = workerScope.getProperties(name, location).filter(predicate)
|
||||||
|
|
||||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<PropertyDescriptor>
|
|
||||||
= workerScope.getSyntheticExtensionProperties(receiverTypes, name, location).filter(predicate)
|
|
||||||
|
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
|
||||||
= workerScope.getSyntheticExtensionFunctions(receiverTypes, name, location).filter(predicate)
|
|
||||||
|
|
||||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor>
|
|
||||||
= workerScope.getSyntheticExtensionProperties(receiverTypes).filter(predicate)
|
|
||||||
|
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor>
|
|
||||||
= workerScope.getSyntheticExtensionFunctions(receiverTypes).filter(predicate)
|
|
||||||
|
|
||||||
override fun getLocalVariable(name: Name) = filterDescriptor(workerScope.getLocalVariable(name))
|
|
||||||
|
|
||||||
override fun getDescriptors(kindFilter: DescriptorKindFilter,
|
override fun getDescriptors(kindFilter: DescriptorKindFilter,
|
||||||
nameFilter: (Name) -> Boolean) = workerScope.getDescriptors(kindFilter, nameFilter).filter(predicate)
|
nameFilter: (Name) -> Boolean) = workerScope.getDescriptors(kindFilter, nameFilter).filter(predicate)
|
||||||
|
|
||||||
override fun getImplicitReceiversHierarchy() = workerScope.getImplicitReceiversHierarchy()
|
|
||||||
|
|
||||||
override fun getDeclarationsByLabel(labelName: Name) = workerScope.getDeclarationsByLabel(labelName).filter(predicate)
|
|
||||||
|
|
||||||
override fun getOwnDeclaredDescriptors() = workerScope.getOwnDeclaredDescriptors().filter(predicate)
|
override fun getOwnDeclaredDescriptors() = workerScope.getOwnDeclaredDescriptors().filter(predicate)
|
||||||
|
|
||||||
override fun printScopeStructure(p: Printer) {
|
override fun printScopeStructure(p: Printer) {
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.resolve.scopes
|
|||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||||
import java.lang.reflect.Modifier
|
import java.lang.reflect.Modifier
|
||||||
@@ -28,24 +27,15 @@ public interface KtScope {
|
|||||||
|
|
||||||
public fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor?
|
public fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor?
|
||||||
|
|
||||||
|
@Deprecated("Should be removed soon")
|
||||||
public fun getPackage(name: Name): PackageViewDescriptor?
|
public fun getPackage(name: Name): PackageViewDescriptor?
|
||||||
|
|
||||||
public fun getProperties(name: Name, location: LookupLocation): Collection<VariableDescriptor>
|
public fun getProperties(name: Name, location: LookupLocation): Collection<VariableDescriptor>
|
||||||
|
|
||||||
public fun getLocalVariable(name: Name): VariableDescriptor?
|
|
||||||
|
|
||||||
public fun getFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
public fun getFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
||||||
|
|
||||||
public fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<PropertyDescriptor>
|
|
||||||
public fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
|
||||||
|
|
||||||
public fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor>
|
|
||||||
public fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor>
|
|
||||||
|
|
||||||
public fun getContainingDeclaration(): DeclarationDescriptor
|
public fun getContainingDeclaration(): DeclarationDescriptor
|
||||||
|
|
||||||
public fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All visible descriptors from current scope.
|
* All visible descriptors from current scope.
|
||||||
*
|
*
|
||||||
@@ -62,11 +52,7 @@ public interface KtScope {
|
|||||||
nameFilter: (Name) -> Boolean = ALL_NAME_FILTER
|
nameFilter: (Name) -> Boolean = ALL_NAME_FILTER
|
||||||
): Collection<DeclarationDescriptor>
|
): Collection<DeclarationDescriptor>
|
||||||
|
|
||||||
/**
|
// todo merge with getAllDescriptors()
|
||||||
* Adds receivers to the list in order of locality, so that the closest (the most local) receiver goes first
|
|
||||||
*/
|
|
||||||
public fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor>
|
|
||||||
|
|
||||||
public fun getOwnDeclaredDescriptors(): Collection<DeclarationDescriptor>
|
public fun getOwnDeclaredDescriptors(): Collection<DeclarationDescriptor>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.resolve.scopes
|
|||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
|
|
||||||
abstract class KtScopeImpl : KtScope {
|
abstract class KtScopeImpl : KtScope {
|
||||||
@@ -27,25 +26,13 @@ abstract class KtScopeImpl : KtScope {
|
|||||||
|
|
||||||
override fun getProperties(name: Name, location: LookupLocation): Collection<VariableDescriptor> = emptyList()
|
override fun getProperties(name: Name, location: LookupLocation): Collection<VariableDescriptor> = emptyList()
|
||||||
|
|
||||||
override fun getLocalVariable(name: Name): VariableDescriptor? = null
|
|
||||||
|
|
||||||
override fun getPackage(name: Name): PackageViewDescriptor? = null
|
override fun getPackage(name: Name): PackageViewDescriptor? = null
|
||||||
|
|
||||||
override fun getFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor> = emptyList()
|
override fun getFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor> = emptyList()
|
||||||
|
|
||||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<PropertyDescriptor> = emptyList()
|
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor> = emptyList()
|
|
||||||
|
|
||||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor> = emptyList()
|
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor> = emptyList()
|
|
||||||
|
|
||||||
override fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor> = emptyList()
|
|
||||||
|
|
||||||
override fun getDescriptors(kindFilter: DescriptorKindFilter,
|
override fun getDescriptors(kindFilter: DescriptorKindFilter,
|
||||||
nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> = emptyList()
|
nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> = emptyList()
|
||||||
|
|
||||||
override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> = emptyList()
|
|
||||||
|
|
||||||
override fun getOwnDeclaredDescriptors(): Collection<DeclarationDescriptor> = emptyList()
|
override fun getOwnDeclaredDescriptors(): Collection<DeclarationDescriptor> = emptyList()
|
||||||
|
|
||||||
// This method should not be implemented here by default: every scope class has its unique structure pattern
|
// This method should not be implemented here by default: every scope class has its unique structure pattern
|
||||||
|
|||||||
@@ -17,16 +17,12 @@
|
|||||||
package org.jetbrains.kotlin.resolve.scopes
|
package org.jetbrains.kotlin.resolve.scopes
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
|
||||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
import org.jetbrains.kotlin.utils.newHashSetWithExpectedSize
|
import org.jetbrains.kotlin.utils.newHashSetWithExpectedSize
|
||||||
import java.util.HashMap
|
import java.util.*
|
||||||
|
|
||||||
public class SubstitutingScope(private val workerScope: KtScope, private val substitutor: TypeSubstitutor) : KtScope {
|
public class SubstitutingScope(private val workerScope: KtScope, private val substitutor: TypeSubstitutor) : KtScope {
|
||||||
|
|
||||||
@@ -65,36 +61,14 @@ public class SubstitutingScope(private val workerScope: KtScope, private val sub
|
|||||||
|
|
||||||
override fun getProperties(name: Name, location: LookupLocation) = substitute(workerScope.getProperties(name, location))
|
override fun getProperties(name: Name, location: LookupLocation) = substitute(workerScope.getProperties(name, location))
|
||||||
|
|
||||||
override fun getLocalVariable(name: Name) = substitute(workerScope.getLocalVariable(name))
|
|
||||||
|
|
||||||
override fun getClassifier(name: Name, location: LookupLocation) = substitute(workerScope.getClassifier(name, location))
|
override fun getClassifier(name: Name, location: LookupLocation) = substitute(workerScope.getClassifier(name, location))
|
||||||
|
|
||||||
override fun getFunctions(name: Name, location: LookupLocation) = substitute(workerScope.getFunctions(name, location))
|
override fun getFunctions(name: Name, location: LookupLocation) = substitute(workerScope.getFunctions(name, location))
|
||||||
|
|
||||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<PropertyDescriptor>
|
|
||||||
= substitute(workerScope.getSyntheticExtensionProperties(receiverTypes, name, location))
|
|
||||||
|
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
|
||||||
= substitute(workerScope.getSyntheticExtensionFunctions(receiverTypes, name, location))
|
|
||||||
|
|
||||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor>
|
|
||||||
= substitute(workerScope.getSyntheticExtensionProperties(receiverTypes))
|
|
||||||
|
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor>
|
|
||||||
= substitute(workerScope.getSyntheticExtensionFunctions(receiverTypes))
|
|
||||||
|
|
||||||
override fun getPackage(name: Name) = workerScope.getPackage(name)
|
override fun getPackage(name: Name) = workerScope.getPackage(name)
|
||||||
|
|
||||||
override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> {
|
|
||||||
throw UnsupportedOperationException() // TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getContainingDeclaration() = workerScope.getContainingDeclaration()
|
override fun getContainingDeclaration() = workerScope.getContainingDeclaration()
|
||||||
|
|
||||||
override fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor> {
|
|
||||||
throw UnsupportedOperationException() // TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getDescriptors(kindFilter: DescriptorKindFilter,
|
override fun getDescriptors(kindFilter: DescriptorKindFilter,
|
||||||
nameFilter: (Name) -> Boolean) = _allDescriptors
|
nameFilter: (Name) -> Boolean) = _allDescriptors
|
||||||
|
|
||||||
|
|||||||
@@ -179,54 +179,11 @@ public class ErrorUtils {
|
|||||||
return ERROR_VARIABLE_GROUP;
|
return ERROR_VARIABLE_GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<PropertyDescriptor> getSyntheticExtensionProperties(
|
|
||||||
@NotNull Collection<? extends KotlinType> receiverTypes, @NotNull Name name,
|
|
||||||
@NotNull LookupLocation location
|
|
||||||
) {
|
|
||||||
return ERROR_PROPERTY_GROUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<FunctionDescriptor> getSyntheticExtensionFunctions(
|
|
||||||
@NotNull Collection<? extends KotlinType> receiverTypes, @NotNull Name name,
|
|
||||||
@NotNull LookupLocation location
|
|
||||||
) {
|
|
||||||
return Collections.<FunctionDescriptor>singleton(createErrorFunction(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<PropertyDescriptor> getSyntheticExtensionProperties(@NotNull Collection<? extends KotlinType> receiverTypes) {
|
|
||||||
return ERROR_PROPERTY_GROUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<FunctionDescriptor> getSyntheticExtensionFunctions(
|
|
||||||
@NotNull Collection<? extends KotlinType> receiverTypes
|
|
||||||
) {
|
|
||||||
return Collections.<FunctionDescriptor>singleton(createErrorFunction(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VariableDescriptor getLocalVariable(@NotNull Name name) {
|
|
||||||
return ERROR_PROPERTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PackageViewDescriptor getPackage(@NotNull Name name) {
|
public PackageViewDescriptor getPackage(@NotNull Name name) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public List<ReceiverParameterDescriptor> getImplicitReceiversHierarchy() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Set<FunctionDescriptor> getFunctions(@NotNull Name name, @NotNull LookupLocation location) {
|
public Set<FunctionDescriptor> getFunctions(@NotNull Name name, @NotNull LookupLocation location) {
|
||||||
@@ -239,12 +196,6 @@ public class ErrorUtils {
|
|||||||
return ERROR_MODULE;
|
return ERROR_MODULE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<DeclarationDescriptor> getDescriptors(
|
public Collection<DeclarationDescriptor> getDescriptors(
|
||||||
@@ -301,62 +252,18 @@ public class ErrorUtils {
|
|||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public VariableDescriptor getLocalVariable(@NotNull Name name) {
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name, @NotNull LookupLocation location) {
|
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name, @NotNull LookupLocation location) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<PropertyDescriptor> getSyntheticExtensionProperties(
|
|
||||||
@NotNull Collection<? extends KotlinType> receiverTypes, @NotNull Name name,
|
|
||||||
@NotNull LookupLocation location
|
|
||||||
) {
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<FunctionDescriptor> getSyntheticExtensionFunctions(
|
|
||||||
@NotNull Collection<? extends KotlinType> receiverTypes, @NotNull Name name,
|
|
||||||
@NotNull LookupLocation location
|
|
||||||
) {
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<PropertyDescriptor> getSyntheticExtensionProperties(@NotNull Collection<? extends KotlinType> receiverTypes) {
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<FunctionDescriptor> getSyntheticExtensionFunctions(
|
|
||||||
@NotNull Collection<? extends KotlinType> receiverTypes
|
|
||||||
) {
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public DeclarationDescriptor getContainingDeclaration() {
|
public DeclarationDescriptor getContainingDeclaration() {
|
||||||
return ERROR_MODULE;
|
return ERROR_MODULE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<DeclarationDescriptor> getDescriptors(
|
public Collection<DeclarationDescriptor> getDescriptors(
|
||||||
@@ -371,12 +278,6 @@ public class ErrorUtils {
|
|||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public List<ReceiverParameterDescriptor> getImplicitReceiversHierarchy() {
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<DeclarationDescriptor> getOwnDeclaredDescriptors() {
|
public Collection<DeclarationDescriptor> getOwnDeclaredDescriptors() {
|
||||||
@@ -461,7 +362,6 @@ public class ErrorUtils {
|
|||||||
private static final PropertyDescriptor ERROR_PROPERTY = createErrorProperty();
|
private static final PropertyDescriptor ERROR_PROPERTY = createErrorProperty();
|
||||||
|
|
||||||
private static final Set<VariableDescriptor> ERROR_VARIABLE_GROUP = Collections.<VariableDescriptor>singleton(ERROR_PROPERTY);
|
private static final Set<VariableDescriptor> ERROR_VARIABLE_GROUP = Collections.<VariableDescriptor>singleton(ERROR_PROPERTY);
|
||||||
private static final Set<PropertyDescriptor> ERROR_PROPERTY_GROUP = Collections.singleton(ERROR_PROPERTY);
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static PropertyDescriptorImpl createErrorProperty() {
|
private static PropertyDescriptorImpl createErrorProperty() {
|
||||||
|
|||||||
-2
@@ -242,8 +242,6 @@ public class DeserializedClassDescriptor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getImplicitReceiver() = classDescriptor.getThisAsReceiverParameter()
|
|
||||||
|
|
||||||
override fun getClassDescriptor(name: Name): ClassifierDescriptor? =
|
override fun getClassDescriptor(name: Name): ClassifierDescriptor? =
|
||||||
classDescriptor.enumEntries.findEnumEntry(name) ?: classDescriptor.nestedClasses.findNestedClass(name)
|
classDescriptor.enumEntries.findEnumEntry(name) ?: classDescriptor.nestedClasses.findNestedClass(name)
|
||||||
|
|
||||||
|
|||||||
-7
@@ -175,13 +175,6 @@ public abstract class DeserializedMemberScope protected constructor(
|
|||||||
|
|
||||||
protected abstract fun addEnumEntryDescriptors(result: MutableCollection<DeclarationDescriptor>, nameFilter: (Name) -> Boolean)
|
protected abstract fun addEnumEntryDescriptors(result: MutableCollection<DeclarationDescriptor>, nameFilter: (Name) -> Boolean)
|
||||||
|
|
||||||
override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> {
|
|
||||||
val receiver = getImplicitReceiver()
|
|
||||||
return if (receiver != null) listOf(receiver) else listOf()
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract fun getImplicitReceiver(): ReceiverParameterDescriptor?
|
|
||||||
|
|
||||||
override fun getOwnDeclaredDescriptors() = getAllDescriptors()
|
override fun getOwnDeclaredDescriptors() = getAllDescriptors()
|
||||||
|
|
||||||
override fun printScopeStructure(p: Printer) {
|
override fun printScopeStructure(p: Printer) {
|
||||||
|
|||||||
-3
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.serialization.deserialization.descriptors
|
|||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
import org.jetbrains.kotlin.name.ClassId
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
@@ -69,6 +68,4 @@ public open class DeserializedPackageMemberScope(
|
|||||||
override fun addEnumEntryDescriptors(result: MutableCollection<DeclarationDescriptor>, nameFilter: (Name) -> Boolean) {
|
override fun addEnumEntryDescriptors(result: MutableCollection<DeclarationDescriptor>, nameFilter: (Name) -> Boolean) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getImplicitReceiver(): ReceiverParameterDescriptor? = null
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user