Provide location parameter in delegations
This commit is contained in:
@@ -43,15 +43,15 @@ class AllUnderImportsScope : JetScope {
|
||||
}
|
||||
|
||||
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? {
|
||||
return scopes.asSequence().map { it.getClassifier(name) }.filterNotNull().singleOrNull()
|
||||
return scopes.asSequence().map { it.getClassifier(name, location) }.filterNotNull().singleOrNull()
|
||||
}
|
||||
|
||||
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor> {
|
||||
return scopes.flatMap { it.getProperties(name) }
|
||||
return scopes.flatMap { it.getProperties(name, location) }
|
||||
}
|
||||
|
||||
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> {
|
||||
return scopes.flatMap { it.getFunctions(name) }
|
||||
return scopes.flatMap { it.getFunctions(name, location) }
|
||||
}
|
||||
|
||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor> {
|
||||
|
||||
@@ -236,7 +236,7 @@ class LazyImportScope(
|
||||
|
||||
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? {
|
||||
return importResolver.selectSingleFromImports(name, LookupMode.ONLY_CLASSES_AND_PACKAGES) { scope, name ->
|
||||
val descriptor = scope.getClassifier(name)
|
||||
val descriptor = scope.getClassifier(name, location)
|
||||
if (descriptor != null && isClassVisible(descriptor as ClassDescriptor/*no type parameter can be imported*/)) descriptor else null
|
||||
}
|
||||
}
|
||||
@@ -248,14 +248,14 @@ class LazyImportScope(
|
||||
|
||||
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor> {
|
||||
if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf()
|
||||
return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getProperties(name) }
|
||||
return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getProperties(name, location) }
|
||||
}
|
||||
|
||||
override fun getLocalVariable(name: Name) = null
|
||||
|
||||
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> {
|
||||
if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf()
|
||||
return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getFunctions(name) }
|
||||
return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getFunctions(name, location) }
|
||||
}
|
||||
|
||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor> {
|
||||
|
||||
+2
-2
@@ -117,7 +117,7 @@ public open class LazyClassMemberScope(
|
||||
|
||||
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> {
|
||||
// TODO: this should be handled by lazy function descriptors
|
||||
val functions = super.getFunctions(name)
|
||||
val functions = super.getFunctions(name, location)
|
||||
resolveUnknownVisibilitiesForMembers(functions)
|
||||
return functions
|
||||
}
|
||||
@@ -175,7 +175,7 @@ public open class LazyClassMemberScope(
|
||||
|
||||
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor> {
|
||||
// TODO: this should be handled by lazy property descriptors
|
||||
val properties = super.getProperties(name)
|
||||
val properties = super.getProperties(name, location)
|
||||
resolveUnknownVisibilitiesForMembers(properties as Collection<CallableMemberDescriptor>)
|
||||
return properties
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class WritableScopeImpl @jvmOverloads constructor(
|
||||
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> {
|
||||
checkMayRead()
|
||||
|
||||
return concatInOrder(functionsByName(name), workerScope.getFunctions(name))
|
||||
return concatInOrder(functionsByName(name), workerScope.getFunctions(name, location))
|
||||
}
|
||||
|
||||
override fun addClassifierDescriptor(classifierDescriptor: ClassifierDescriptor) {
|
||||
@@ -170,7 +170,7 @@ public class WritableScopeImpl @jvmOverloads constructor(
|
||||
checkMayRead()
|
||||
|
||||
return variableOrClassDescriptorByName(name) as? ClassifierDescriptor
|
||||
?: workerScope.getClassifier(name)
|
||||
?: workerScope.getClassifier(name, location)
|
||||
}
|
||||
|
||||
override fun getImplicitReceiversHierarchy() = implicitReceiverHierarchy
|
||||
@@ -273,14 +273,14 @@ public class WritableScopeImpl @jvmOverloads constructor(
|
||||
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> {
|
||||
checkMayRead()
|
||||
|
||||
return concatInOrder(functionsByName(name, descriptorLimit), workerScope.getFunctions(name))
|
||||
return concatInOrder(functionsByName(name, descriptorLimit), workerScope.getFunctions(name, location))
|
||||
}
|
||||
|
||||
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? {
|
||||
checkMayRead()
|
||||
|
||||
return variableOrClassDescriptorByName(name, descriptorLimit) as? ClassifierDescriptor
|
||||
?: workerScope.getClassifier(name)
|
||||
?: workerScope.getClassifier(name, location)
|
||||
}
|
||||
|
||||
override fun getOwnDeclaredDescriptors(): Collection<DeclarationDescriptor> = addedDescriptors.truncated(descriptorLimit)
|
||||
|
||||
Reference in New Issue
Block a user