Allow to turn the first parameter of a SAM-converted lambda into the receiver (KT-12848)
This commit is contained in:
@@ -29,12 +29,11 @@ import org.jetbrains.kotlin.resolve.BindingContext
|
||||
class CliAllOpenDeclarationAttributeAltererExtension(
|
||||
private val allOpenAnnotationFqNames: List<String>
|
||||
) : AbstractAllOpenDeclarationAttributeAltererExtension() {
|
||||
override fun getAnnotationFqNames(modifierListOwner: KtModifierListOwner) = allOpenAnnotationFqNames
|
||||
override fun getAnnotationFqNames(modifierListOwner: KtModifierListOwner?) = allOpenAnnotationFqNames
|
||||
}
|
||||
|
||||
abstract class AbstractAllOpenDeclarationAttributeAltererExtension : DeclarationAttributeAltererExtension, AnnotationBasedExtension {
|
||||
companion object {
|
||||
@TestOnly
|
||||
val ANNOTATIONS_FOR_TESTS = listOf("AllOpen", "AllOpen2", "test.AllOpen")
|
||||
}
|
||||
|
||||
|
||||
@@ -40,11 +40,12 @@ class IdeAllOpenDeclarationAttributeAltererExtension(val project: Project) : Abs
|
||||
CachedValueProvider.Result.create(WeakHashMap<Module, List<String>>(), ProjectRootModificationTracker.getInstance(project))
|
||||
}
|
||||
|
||||
override fun getAnnotationFqNames(modifierListOwner: KtModifierListOwner): List<String> {
|
||||
override fun getAnnotationFqNames(modifierListOwner: KtModifierListOwner?): List<String> {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode) {
|
||||
return ANNOTATIONS_FOR_TESTS
|
||||
}
|
||||
|
||||
if (modifierListOwner == null) return emptyList()
|
||||
val module = ModuleUtilCore.findModuleForPsiElement(modifierListOwner) ?: return emptyList()
|
||||
|
||||
return cache.value.getOrPut(module) {
|
||||
|
||||
Reference in New Issue
Block a user