[LL API] Migrate 'getKtModule()' usages to 'ProjectStructureProvider'

Ensure the contextual module is passed wherever possible.

^KT-57559 Fixed
This commit is contained in:
Yan Zhulanow
2023-04-18 17:25:34 +09:00
committed by Space Team
parent c90d094af6
commit e9c077220f
31 changed files with 187 additions and 133 deletions
@@ -5,12 +5,14 @@
package org.jetbrains.kotlin.analysis.api
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.analysis.api.components.*
import org.jetbrains.kotlin.analysis.api.lifetime.KtLifetimeOwner
import org.jetbrains.kotlin.analysis.api.lifetime.KtLifetimeToken
import org.jetbrains.kotlin.analysis.api.symbols.*
import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer
import org.jetbrains.kotlin.analysis.project.structure.KtModule
import org.jetbrains.kotlin.analysis.project.structure.ProjectStructureProvider
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtFile
@@ -178,3 +180,7 @@ public abstract class KtAnalysisSession(final override val token: KtLifetimeToke
get() = typesCreatorImpl
protected abstract val typesCreatorImpl: KtTypeCreator
}
public fun KtAnalysisSession.getModule(element: PsiElement): KtModule {
return ProjectStructureProvider.getModule(element, useSiteModule)
}