Minor: no more use default value for location parameter in JetScope members
Temporary introduced overloads which emulated default value behavior
This commit is contained in:
+5
-2
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.resolve.calls.tasks.collectors
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.builtins.functions.FunctionInvokeDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.isStaticNestedClass
|
||||
@@ -101,7 +102,7 @@ private object FunctionCollector : CallableDescriptorCollector<FunctionDescripto
|
||||
override fun getExtensionsByName(scope: JetScope, name: Name, receiverTypes: Collection<JetType>, bindingTrace: BindingTrace): Collection<FunctionDescriptor> {
|
||||
val functions = scope.getFunctions(name)
|
||||
val (extensions, nonExtensions) = functions.partition { it.extensionReceiverParameter != null }
|
||||
val syntheticExtensions = scope.getSyntheticExtensionFunctions(receiverTypes, name)
|
||||
val syntheticExtensions = scope.getSyntheticExtensionFunctions(receiverTypes, name, LookupLocation.NO_LOCATION)
|
||||
|
||||
if (name == OperatorConventions.INVOKE) {
|
||||
// Create synthesized "invoke" extensions for each non-extension "invoke" found in the scope
|
||||
@@ -158,7 +159,9 @@ private object VariableCollector : CallableDescriptorCollector<VariableDescripto
|
||||
|
||||
override fun getExtensionsByName(scope: JetScope, name: Name, receiverTypes: Collection<JetType>, bindingTrace: BindingTrace): Collection<VariableDescriptor> {
|
||||
// property may have an extension function type, we check the applicability later to avoid an early computing of deferred types
|
||||
return scope.getLocalVariable(name).singletonOrEmptyList() + scope.getProperties(name) + scope.getSyntheticExtensionProperties(receiverTypes, name)
|
||||
return scope.getLocalVariable(name).singletonOrEmptyList() +
|
||||
scope.getProperties(name) +
|
||||
scope.getSyntheticExtensionProperties(receiverTypes, name, LookupLocation.NO_LOCATION)
|
||||
}
|
||||
|
||||
override fun toString() = "VARIABLES"
|
||||
|
||||
@@ -26,18 +26,18 @@ import java.lang.reflect.Modifier
|
||||
|
||||
public interface JetScope {
|
||||
|
||||
public fun getClassifier(name: Name, location: LookupLocation = LookupLocation.NO_LOCATION): ClassifierDescriptor?
|
||||
public fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor?
|
||||
|
||||
public fun getPackage(name: Name): PackageViewDescriptor?
|
||||
|
||||
public fun getProperties(name: Name, location: LookupLocation = LookupLocation.NO_LOCATION): Collection<VariableDescriptor>
|
||||
public fun getProperties(name: Name, location: LookupLocation): Collection<VariableDescriptor>
|
||||
|
||||
public fun getLocalVariable(name: Name): VariableDescriptor?
|
||||
|
||||
public fun getFunctions(name: Name, location: LookupLocation = LookupLocation.NO_LOCATION): Collection<FunctionDescriptor>
|
||||
public fun getFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
||||
|
||||
public fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name, location: LookupLocation = LookupLocation.NO_LOCATION): Collection<PropertyDescriptor>
|
||||
public fun getSyntheticExtensionFunctions(receiverTypes: Collection<JetType>, name: Name, location: LookupLocation = LookupLocation.NO_LOCATION): Collection<FunctionDescriptor>
|
||||
public fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name, location: LookupLocation): Collection<PropertyDescriptor>
|
||||
public fun getSyntheticExtensionFunctions(receiverTypes: Collection<JetType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
||||
|
||||
public fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>): Collection<PropertyDescriptor>
|
||||
public fun getSyntheticExtensionFunctions(receiverTypes: Collection<JetType>): Collection<FunctionDescriptor>
|
||||
@@ -46,6 +46,14 @@ public interface JetScope {
|
||||
|
||||
public fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor>
|
||||
|
||||
// Temporary overloads which will be dropped when all usages will be processed
|
||||
@deprecated("Provide `location` explicitly", replaceWith = ReplaceWith("getClassifier(name, LookupLocation.NO_LOCATION)"))
|
||||
public final fun getClassifier(name: Name): ClassifierDescriptor? = getClassifier(name, LookupLocation.NO_LOCATION)
|
||||
@deprecated("Provide `location` explicitly", replaceWith = ReplaceWith("getClassifier(name, LookupLocation.NO_LOCATION)"))
|
||||
public final fun getProperties(name: Name): Collection<VariableDescriptor> = getProperties(name, LookupLocation.NO_LOCATION)
|
||||
@deprecated("Provide `location` explicitly", replaceWith = ReplaceWith("getClassifier(name, LookupLocation.NO_LOCATION)"))
|
||||
public final fun getFunctions(name: Name): Collection<FunctionDescriptor> = getFunctions(name, LookupLocation.NO_LOCATION)
|
||||
|
||||
/**
|
||||
* All visible descriptors from current scope.
|
||||
*
|
||||
|
||||
@@ -73,8 +73,27 @@ public class ErrorUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static abstract class AbstractErrorScope implements JetScope {
|
||||
@Nullable
|
||||
@Override
|
||||
public ClassifierDescriptor getClassifier(@NotNull Name name) {
|
||||
return getClassifier(name, LookupLocation.NO_LOCATION);
|
||||
}
|
||||
|
||||
public static class ErrorScope implements JetScope {
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<VariableDescriptor> getProperties(@NotNull Name name) {
|
||||
return getProperties(name, LookupLocation.NO_LOCATION);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name) {
|
||||
return getFunctions(name, LookupLocation.NO_LOCATION);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ErrorScope extends AbstractErrorScope {
|
||||
private final String debugMessage;
|
||||
|
||||
private ErrorScope(@NotNull String debugMessage) {
|
||||
@@ -190,7 +209,7 @@ public class ErrorUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static class ThrowingScope implements JetScope {
|
||||
private static class ThrowingScope extends AbstractErrorScope {
|
||||
private final String debugMessage;
|
||||
|
||||
private ThrowingScope(@NotNull String message) {
|
||||
|
||||
Reference in New Issue
Block a user