[AA] Add synthetic properties scopes to scope context for position
This commit is contained in:
committed by
teamcity
parent
5d8e23e971
commit
116de97f54
+9
-5
@@ -269,18 +269,22 @@ class FirTowerDataElement(
|
||||
*
|
||||
* Note that a scope for a companion object is an implicit scope.
|
||||
*/
|
||||
fun getAvailableScopes(): List<FirScope> = when {
|
||||
fun getAvailableScopes(
|
||||
processTypeScope: FirTypeScope.(ConeKotlinType) -> FirTypeScope = { this },
|
||||
): List<FirScope> = when {
|
||||
scope != null -> listOf(scope)
|
||||
implicitReceiver != null -> listOf(implicitReceiver.getImplicitScope())
|
||||
contextReceiverGroup != null -> contextReceiverGroup.map { it.getImplicitScope() }
|
||||
implicitReceiver != null -> listOf(implicitReceiver.getImplicitScope(processTypeScope))
|
||||
contextReceiverGroup != null -> contextReceiverGroup.map { it.getImplicitScope(processTypeScope) }
|
||||
else -> error("Tower data element is expected to have either scope or implicit receivers.")
|
||||
}
|
||||
|
||||
private fun ImplicitReceiverValue<*>.getImplicitScope(): FirScope {
|
||||
private fun ImplicitReceiverValue<*>.getImplicitScope(
|
||||
processTypeScope: FirTypeScope.(ConeKotlinType) -> FirTypeScope,
|
||||
): FirScope {
|
||||
return when (type.fullyExpandedType(useSiteSession)) {
|
||||
is ConeErrorType,
|
||||
is ConeStubType -> FirTypeScope.Empty
|
||||
else -> implicitScope ?: error("Scope for type ${type::class.simpleName} is null.")
|
||||
else -> implicitScope?.processTypeScope(type) ?: error("Scope for type ${type::class.simpleName} is null.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user