Extension point for synthetic function names contributions
This commit is contained in:
+5
@@ -42,6 +42,9 @@ interface SyntheticResolveExtension {
|
||||
override fun getSyntheticNestedClassNames(thisDescriptor: ClassDescriptor): List<Name> =
|
||||
instances.flatMap { it.getSyntheticNestedClassNames(thisDescriptor) }
|
||||
|
||||
override fun getSyntheticFunctionNames(thisDescriptor: ClassDescriptor): List<Name> =
|
||||
instances.flatMap { it.getSyntheticFunctionNames(thisDescriptor) }
|
||||
|
||||
override fun generateSyntheticClasses(thisDescriptor: ClassDescriptor, name: Name,
|
||||
ctx: LazyClassContext, declarationProvider: ClassMemberDeclarationProvider,
|
||||
result: MutableSet<ClassDescriptor>) =
|
||||
@@ -69,6 +72,8 @@ interface SyntheticResolveExtension {
|
||||
|
||||
fun getSyntheticCompanionObjectNameIfNeeded(thisDescriptor: ClassDescriptor): Name? = null
|
||||
|
||||
fun getSyntheticFunctionNames(thisDescriptor: ClassDescriptor): List<Name> = emptyList()
|
||||
|
||||
fun getSyntheticNestedClassNames(thisDescriptor: ClassDescriptor): List<Name> = emptyList()
|
||||
|
||||
fun addSyntheticSupertypes(thisDescriptor: ClassDescriptor, supertypes: MutableList<KotlinType>) {}
|
||||
|
||||
+5
@@ -80,6 +80,7 @@ open class LazyClassMemberScope(
|
||||
}
|
||||
|
||||
addDataClassMethods(result, location)
|
||||
addSyntheticFunctions(result, location)
|
||||
addSyntheticCompanionObject(result, location)
|
||||
addSyntheticNestedClasses(result, location)
|
||||
|
||||
@@ -220,6 +221,10 @@ open class LazyClassMemberScope(
|
||||
result.add(descriptor)
|
||||
}
|
||||
|
||||
private fun addSyntheticFunctions(result: MutableCollection<DeclarationDescriptor>, location: LookupLocation) {
|
||||
result.addAll(c.syntheticResolveExtension.getSyntheticFunctionNames(thisDescriptor).flatMap { getContributedFunctions(it, location) }.toList())
|
||||
}
|
||||
|
||||
private fun addSyntheticNestedClasses(result: MutableCollection<DeclarationDescriptor>, location: LookupLocation) {
|
||||
result.addAll(c.syntheticResolveExtension.getSyntheticNestedClassNames(thisDescriptor).mapNotNull { getContributedClassifier(it, location) }.toList())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user