analysis_server_plugin: Use new DiagnosticCode name

Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: Ia021bc5a80f1e53407393454ab058f6b7c8a633a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Sam Rawlins
2025-04-30 09:35:02 -07:00
committed by Commit Queue
parent 3a9f4331dd
commit 508ad1359b
2 changed files with 11 additions and 10 deletions
@@ -28,22 +28,23 @@ class _RegisteredFixGenerators {
final Map<LintCode, List<MultiProducerGenerator>> lintMultiProducers = {};
/// A map from error codes to a list of generators used to create multiple
/// correction producers used to build fixes for those diagnostics.
/// A map from diagnostic codes to a list of generators used to create
/// multiple correction producers used to build fixes for those diagnostics.
///
/// The generators used for lint rules are in the [lintMultiProducers].
final Map<ErrorCode, List<MultiProducerGenerator>> nonLintMultiProducers = {};
final Map<DiagnosticCode, List<MultiProducerGenerator>>
nonLintMultiProducers = {};
/// A set of generators that are used to create correction producers that
/// produce corrections that ignore diagnostics locally.
final Set<ProducerGenerator> ignoreProducerGenerators = {};
/// A map from error codes to a list of the generators that are used to create
/// correction producers.
/// A map from diagnostic codes to a list of the generators that are used to
/// create correction producers.
///
/// The generators are then used to build fixes for those diagnostics. The
/// generators used for lint rules are in the [lintProducers].
final Map<ErrorCode, List<ProducerGenerator>> nonLintProducers = {};
final Map<DiagnosticCode, List<ProducerGenerator>> nonLintProducers = {};
/// A map from lint codes to a list of fix generators that work with only
/// parsed results.
@@ -124,12 +124,12 @@ final class FixInFileProcessor {
}
}
List<ProducerGenerator> _getGenerators(ErrorCode errorCode) {
if (errorCode is LintCode) {
return registeredFixGenerators.lintProducers[errorCode] ?? [];
List<ProducerGenerator> _getGenerators(DiagnosticCode diagnosticCode) {
if (diagnosticCode is LintCode) {
return registeredFixGenerators.lintProducers[diagnosticCode] ?? [];
} else {
// TODO(pq): consider support for multi-generators.
return registeredFixGenerators.nonLintProducers[errorCode] ?? [];
return registeredFixGenerators.nonLintProducers[diagnosticCode] ?? [];
}
}
}