Frontend plugins to upstream
Change-Id: Id9203c92d0a711e4f21565bd225a465bd41db476
This commit is contained in:
+8
-3
@@ -16,9 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve.calls.tower
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithVisibility
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.calls.model.DiagnosticReporter
|
||||
@@ -45,6 +43,13 @@ interface ImplicitScopeTower {
|
||||
val isNewInferenceEnabled: Boolean
|
||||
|
||||
val typeApproximator: TypeApproximator
|
||||
|
||||
fun interceptCandidates(
|
||||
resolutionScope: ResolutionScope,
|
||||
name: Name,
|
||||
initialResults: Collection<FunctionDescriptor>,
|
||||
location: LookupLocation
|
||||
): Collection<FunctionDescriptor>
|
||||
}
|
||||
|
||||
interface ScopeTowerLevel {
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
package org.jetbrains.kotlin.resolve.calls.tower
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.impl.FunctionDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.getReceiverValueWithSmartCast
|
||||
@@ -207,7 +210,7 @@ internal class QualifierScopeTowerLevel(scopeTower: ImplicitScopeTower, val qual
|
||||
.getContributedFunctionsAndConstructors(
|
||||
name,
|
||||
location,
|
||||
scopeTower.syntheticScopes
|
||||
scopeTower
|
||||
).map {
|
||||
createCandidateDescriptor(it, dispatchReceiver = null)
|
||||
}
|
||||
@@ -255,7 +258,7 @@ internal open class ScopeBasedTowerLevel protected constructor(
|
||||
): Collection<CandidateWithBoundDispatchReceiver> {
|
||||
val result: ArrayList<CandidateWithBoundDispatchReceiver> = ArrayList()
|
||||
|
||||
resolutionScope.getContributedFunctionsAndConstructors(name, location, scopeTower.syntheticScopes).mapTo(result) {
|
||||
resolutionScope.getContributedFunctionsAndConstructors(name, location, scopeTower).mapTo(result) {
|
||||
createCandidateDescriptor(
|
||||
it,
|
||||
dispatchReceiver = null,
|
||||
@@ -366,7 +369,7 @@ private fun KotlinType?.getInnerConstructors(name: Name, location: LookupLocatio
|
||||
private fun ResolutionScope.getContributedFunctionsAndConstructors(
|
||||
name: Name,
|
||||
location: LookupLocation,
|
||||
syntheticScopes: SyntheticScopes
|
||||
scopeTower: ImplicitScopeTower
|
||||
): Collection<FunctionDescriptor> {
|
||||
val result = ArrayList<FunctionDescriptor>(getContributedFunctions(name, location))
|
||||
|
||||
@@ -374,10 +377,10 @@ private fun ResolutionScope.getContributedFunctionsAndConstructors(
|
||||
result.addAll(getConstructorsOfClassifier(it))
|
||||
}
|
||||
|
||||
result.addAll(syntheticScopes.collectSyntheticStaticFunctions(this, name, location))
|
||||
result.addAll(syntheticScopes.collectSyntheticConstructors(this, name, location))
|
||||
result.addAll(scopeTower.syntheticScopes.collectSyntheticStaticFunctions(this, name, location))
|
||||
result.addAll(scopeTower.syntheticScopes.collectSyntheticConstructors(this, name, location))
|
||||
|
||||
return result.toList()
|
||||
return scopeTower.interceptCandidates(this, name, result, location).toList()
|
||||
}
|
||||
|
||||
private fun getConstructorsOfClassifier(classifier: ClassifierDescriptor?): List<ConstructorDescriptor> {
|
||||
|
||||
Reference in New Issue
Block a user