[Analysis API] Allow handling scopes from KtScopeContext separately
^KT-55527
This commit is contained in:
committed by
teamcity
parent
d89d774411
commit
4b7164a557
+5
-4
@@ -177,17 +177,18 @@ abstract class AbstractAnalysisApiBasedTest : TestWithDisposable() {
|
||||
private fun isFirDisabledForTheTest(): Boolean =
|
||||
AnalysisApiTestDirectives.IGNORE_FIR in testServices.moduleStructure.allDirectives
|
||||
|
||||
protected fun <R> analyseForTest(contextElement: KtElement, action: KtAnalysisSession.() -> R): R {
|
||||
protected fun <R> analyseForTest(contextElement: KtElement, action: KtAnalysisSession.(KtElement) -> R): R {
|
||||
return if (configurator.analyseInDependentSession) {
|
||||
val originalContainingFile = contextElement.containingKtFile
|
||||
val fileCopy = originalContainingFile.copy() as KtFile
|
||||
val sameElementInCopy = PsiTreeUtil.findSameElementInCopy(contextElement, fileCopy)
|
||||
analyzeInDependedAnalysisSession(
|
||||
originalContainingFile,
|
||||
PsiTreeUtil.findSameElementInCopy(contextElement, fileCopy),
|
||||
action = action
|
||||
sameElementInCopy,
|
||||
action = { action(sameElementInCopy) }
|
||||
)
|
||||
} else {
|
||||
analyze(contextElement, action = action)
|
||||
analyze(contextElement, action = { action(contextElement) })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user