fixup! Completion with FIR (prototype, work-in-progress)
This commit is contained in:
committed by
Ilya Kirillov
parent
d62500531b
commit
6596dc359b
-22
@@ -55,28 +55,6 @@ class FirSignatureEnhancement(
|
|||||||
FirJavaEnhancementContext(session) { null }.copyWithNewDefaultTypeQualifiers(typeQualifierResolver, jsr305State, owner.annotations)
|
FirJavaEnhancementContext(session) { null }.copyWithNewDefaultTypeQualifiers(typeQualifierResolver, jsr305State, owner.annotations)
|
||||||
|
|
||||||
private val enhancements = mutableMapOf<FirCallableSymbol<*>, FirCallableSymbol<*>>()
|
private val enhancements = mutableMapOf<FirCallableSymbol<*>, FirCallableSymbol<*>>()
|
||||||
private val overriddenFunctions = mutableMapOf<FirFunctionSymbol<*>, Collection<FirFunctionSymbol<*>>>()
|
|
||||||
|
|
||||||
override fun processPropertiesByName(name: Name, processor: (FirVariableSymbol<*>) -> Unit) {
|
|
||||||
useSiteMemberScope.processPropertiesByName(name) process@{ original ->
|
|
||||||
|
|
||||||
val field = enhancements.getOrPut(original) { enhance(original, name) }
|
|
||||||
processor(field as FirVariableSymbol<*>)
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.processPropertiesByName(name, processor)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getCallableNames(): Set<Name> {
|
|
||||||
return useSiteMemberScope.getCallableNames() + super.getCallableNames()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> Unit) {
|
|
||||||
useSiteMemberScope.processFunctionsByName(name) process@{ original ->
|
|
||||||
|
|
||||||
val function = enhancements.getOrPut(original) { enhance(original, name) }
|
|
||||||
processor(function as FirFunctionSymbol<*>)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun enhancedFunction(
|
fun enhancedFunction(
|
||||||
function: FirFunctionSymbol<*>,
|
function: FirFunctionSymbol<*>,
|
||||||
|
|||||||
+8
@@ -100,4 +100,12 @@ class JavaClassMembersEnhancementScope(
|
|||||||
propertySymbol, processor, overriddenProperties, useSiteMemberScope,
|
propertySymbol, processor, overriddenProperties, useSiteMemberScope,
|
||||||
FirTypeScope::processOverriddenPropertiesWithDepth
|
FirTypeScope::processOverriddenPropertiesWithDepth
|
||||||
)
|
)
|
||||||
|
|
||||||
|
override fun getCallableNames(): Set<Name> {
|
||||||
|
return useSiteMemberScope.getCallableNames()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun mayContainName(name: Name): Boolean {
|
||||||
|
return useSiteMemberScope.mayContainName(name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
@@ -48,4 +48,12 @@ class JavaClassStaticEnhancementScope(
|
|||||||
processor(function as FirConstructorSymbol)
|
processor(function as FirConstructorSymbol)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getCallableNames(): Set<Name> {
|
||||||
|
return useSiteStaticScope.getCallableNames()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun mayContainName(name: Name): Boolean {
|
||||||
|
return useSiteStaticScope.mayContainName(name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
@@ -79,4 +79,18 @@ class JavaClassStaticUseSiteScope internal constructor(
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalStdlibApi::class)
|
||||||
|
override fun getCallableNames(): Set<Name> {
|
||||||
|
return buildSet {
|
||||||
|
addAll(declaredMemberScope.getCallableNames())
|
||||||
|
for (superTypesScope in superTypesScopes) {
|
||||||
|
addAll(superTypesScope.getCallableNames())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun mayContainName(name: Name): Boolean {
|
||||||
|
return declaredMemberScope.mayContainName(name) || superTypesScopes.any { it.mayContainName(name) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user