[Frontend] Make DiagnosticSuppressor a project-level extension
Originally it was an application-level component, which caused non-trivial
logic and cognitive load to carefully handle those extensions to avoid
memory leaks.
6740a596 introduced a way to easily register `DiagnosticSuppressor` to
project, and this commit continues this work, making it a proper
project-level extension
A lot of changes caused by the fact, that this extension is needed to be
obtained from `BindingContext` (see `BindingContextSuppressCache` and
its usages), so almost all changes are introducing `Project` to
`BindingContext`
^KT-66449 Fixed
This commit is contained in:
committed by
Space Team
parent
a552238874
commit
d352cc9d96
+1
-1
@@ -49,7 +49,7 @@ internal fun constructAnnotation(psi: KtAnnotationEntry, targetClass: KClass<out
|
||||
DefaultBuiltIns.Instance
|
||||
)
|
||||
val evaluator = ConstantExpressionEvaluator(module, LanguageVersionSettingsImpl.DEFAULT, project)
|
||||
val trace = BindingTraceContext()
|
||||
val trace = BindingTraceContext(project)
|
||||
|
||||
val valueArguments = psi.valueArguments.map { arg ->
|
||||
val expression = arg.getArgumentExpression()!!
|
||||
|
||||
+1
-1
@@ -267,7 +267,7 @@ private fun analyze(sourceFiles: Collection<KtFile>, environment: KotlinCoreEnvi
|
||||
TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
|
||||
project,
|
||||
sourceFiles,
|
||||
NoScopeRecordCliBindingTrace(),
|
||||
NoScopeRecordCliBindingTrace(project),
|
||||
environment.configuration,
|
||||
environment::createPackagePartProvider
|
||||
)
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ import kotlin.script.experimental.jvm.util.SnippetsHistory
|
||||
|
||||
open class ReplCodeAnalyzerBase(
|
||||
environment: KotlinCoreEnvironment,
|
||||
val trace: BindingTraceContext = NoScopeRecordCliBindingTrace(),
|
||||
val trace: BindingTraceContext = NoScopeRecordCliBindingTrace(environment.project),
|
||||
implicitsResolutionFilter: ImplicitsExtensionsResolutionFilter? = null
|
||||
) {
|
||||
protected val scriptDeclarationFactory: ScriptMutableDeclarationProviderFactory
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.scripting.compiler.plugin.repl.ReplCodeAnalyzerBase
|
||||
class IdeLikeReplCodeAnalyzer(
|
||||
private val environment: KotlinCoreEnvironment,
|
||||
implicitsResolutionFilter: ImplicitsExtensionsResolutionFilter
|
||||
) : ReplCodeAnalyzerBase(environment, CliBindingTrace(), implicitsResolutionFilter) {
|
||||
) : ReplCodeAnalyzerBase(environment, CliBindingTrace(environment.project), implicitsResolutionFilter) {
|
||||
interface ReplLineAnalysisResultWithStateless : ReplLineAnalysisResult {
|
||||
// Result of stateless analyse, which may be used for reporting errors
|
||||
// without code generation
|
||||
|
||||
Reference in New Issue
Block a user