[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
@@ -59,7 +59,7 @@ object GenerationUtils {
|
||||
files: List<KtFile>,
|
||||
environment: KotlinCoreEnvironment,
|
||||
classBuilderFactory: ClassBuilderFactory = ClassBuilderFactories.TEST,
|
||||
trace: BindingTrace = NoScopeRecordCliBindingTrace()
|
||||
trace: BindingTrace = NoScopeRecordCliBindingTrace(environment.project)
|
||||
): GenerationState =
|
||||
compileFiles(files, environment.configuration, classBuilderFactory, environment::createPackagePartProvider, trace)
|
||||
|
||||
@@ -70,7 +70,7 @@ object GenerationUtils {
|
||||
configuration: CompilerConfiguration,
|
||||
classBuilderFactory: ClassBuilderFactory,
|
||||
packagePartProvider: (GlobalSearchScope) -> PackagePartProvider,
|
||||
trace: BindingTrace = NoScopeRecordCliBindingTrace()
|
||||
trace: BindingTrace = NoScopeRecordCliBindingTrace(files.first().project)
|
||||
): GenerationState {
|
||||
val project = files.first().project
|
||||
val state = if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) {
|
||||
@@ -128,7 +128,7 @@ object GenerationUtils {
|
||||
irGeneratorExtensions = emptyList()
|
||||
)
|
||||
|
||||
val dummyBindingContext = NoScopeRecordCliBindingTrace().bindingContext
|
||||
val dummyBindingContext = NoScopeRecordCliBindingTrace(project).bindingContext
|
||||
|
||||
val codegenFactory = JvmIrCodegenFactory(
|
||||
configuration,
|
||||
|
||||
Reference in New Issue
Block a user