analyzeCopy¶
inline fun <R> analyzeCopy(
useSiteElement: KtElement,
resolutionMode: KaDanglingFileResolutionMode,
crossinline action: context(KaSession) () -> R
): R
Executes the given action in a KaSession context.
The KaSession is provided as a context parameter, so members of the Analysis API are available inside action without an explicit receiver.
The useSiteElement must be inside a dangling file copy (specifically, PsiFile.copyOrigin must point to the copy source). Depending on the passed resolutionMode, declarations inside the file copy will be treated in a specific way.
The project will be analyzed from the perspective of useSiteElement's module, also called the use-site module.
Neither the analysis session nor any other lifetime owners may be leaked outside the analyze block. Please consult the documentation of KaSession for important information about lifetime management.