Remove unnecessary fallback LigthClasses from UL
This commit is contained in:
+11
-10
@@ -62,16 +62,20 @@ import java.util.concurrent.ConcurrentMap
|
|||||||
|
|
||||||
class IDELightClassGenerationSupport(private val project: Project) : LightClassGenerationSupport() {
|
class IDELightClassGenerationSupport(private val project: Project) : LightClassGenerationSupport() {
|
||||||
|
|
||||||
private inner class KtUltraLightSupportImpl(private val element: KtElement, private val module: Module) : KtUltraLightSupport {
|
private inner class KtUltraLightSupportImpl(private val element: KtElement) : KtUltraLightSupport {
|
||||||
|
|
||||||
|
private val module = ModuleUtilCore.findModuleForPsiElement(element)
|
||||||
|
|
||||||
override val isReleasedCoroutine
|
override val isReleasedCoroutine
|
||||||
get() = module.languageVersionSettings.supportsFeature(LanguageFeature.ReleaseCoroutines)
|
get() = module?.languageVersionSettings?.supportsFeature(LanguageFeature.ReleaseCoroutines) ?: true
|
||||||
|
|
||||||
private fun KtDeclaration.mayBeModifiedByCompilerPlugins(): Boolean {
|
private fun KtDeclaration.mayBeModifiedByCompilerPlugins(): Boolean {
|
||||||
|
|
||||||
val facet = KotlinFacet.get(module)
|
module?.let {
|
||||||
val pluginClasspaths = facet?.configuration?.settings?.compilerArguments?.pluginClasspaths
|
val facet = KotlinFacet.get(it)
|
||||||
if (pluginClasspaths.isNullOrEmpty()) return false
|
val pluginClasspaths = facet?.configuration?.settings?.compilerArguments?.pluginClasspaths
|
||||||
|
if (pluginClasspaths.isNullOrEmpty()) return false
|
||||||
|
}
|
||||||
|
|
||||||
val resolvedDescriptor = lazy(LazyThreadSafetyMode.NONE) {
|
val resolvedDescriptor = lazy(LazyThreadSafetyMode.NONE) {
|
||||||
resolveToDescriptorIfAny(
|
resolveToDescriptorIfAny(
|
||||||
@@ -157,8 +161,7 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG
|
|||||||
if (files.any { it.isScript() }) return null
|
if (files.any { it.isScript() }) return null
|
||||||
|
|
||||||
val filesToSupports: List<Pair<KtFile, KtUltraLightSupport>> = files.map {
|
val filesToSupports: List<Pair<KtFile, KtUltraLightSupport>> = files.map {
|
||||||
val module = ModuleUtilCore.findModuleForPsiElement(it) ?: return null
|
it to KtUltraLightSupportImpl(it)
|
||||||
it to KtUltraLightSupportImpl(it, module)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return KtUltraLightClassForFacade(
|
return KtUltraLightClassForFacade(
|
||||||
@@ -178,9 +181,7 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
val module = ModuleUtilCore.findModuleForPsiElement(element) ?: return null
|
return KtUltraLightSupportImpl(element).let { support ->
|
||||||
|
|
||||||
return KtUltraLightSupportImpl(element, module).let { support ->
|
|
||||||
when {
|
when {
|
||||||
element is KtObjectDeclaration && element.isObjectLiteral() ->
|
element is KtObjectDeclaration && element.isObjectLiteral() ->
|
||||||
KtUltraLightClassForAnonymousDeclaration(element, support)
|
KtUltraLightClassForAnonymousDeclaration(element, support)
|
||||||
|
|||||||
Reference in New Issue
Block a user