[messages] Get rid of deprecatedSnakeCaseNames.

The only remaining deprecated snake-case name was
`ParserErrorCode.UNEXPECTED_TOKEN`, which is no longer being used by
`package:dart_style`.

Note that the commit that removed `package:dart_style`'s use of
`ParserErrorCode.UNEXPECTED_TOKEN`
(https://github.com/dart-lang/dart_style/commit/ade6076f731c39306e3dd32608dfd00622e4492f)
was also the commit that bumped `package:dart_style`'s pubspec
dependency to permit analyzer versions >= `9.0.0`. Since the current
version of `package:analyzer` is `9.0.1-dev`, this means that `pub
get` will never pair a future version of `dart:analyzer` with a
version of `package:dart_style` that uses
`ParserErrorCode.UNEXPECTED_TOKEN`, so this removal is safe.

Change-Id: I6a6a6964a6e1dde6d8c1f1420b39f998b8a4073a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462322
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Paul Berry
2025-11-15 19:09:04 -08:00
committed by Commit Queue
parent 622e079c88
commit 47e77939fc
3 changed files with 0 additions and 32 deletions
@@ -1116,9 +1116,6 @@ class ParserErrorCode {
static const DiagnosticWithoutArguments typeParameterOnOperator =
diag.typeParameterOnOperator;
@Deprecated("Please use unexpectedToken")
static const DiagnosticCode UNEXPECTED_TOKEN = unexpectedToken;
/// Parameters:
/// Object p0: the starting character that was missing
static const DiagnosticWithArguments<
@@ -16094,9 +16094,6 @@ undone = DiagnosticWithArguments(
expectedTypes: [ExpectedType.string],
);
@Deprecated("Please use unexpectedToken")
const DiagnosticCode UNEXPECTED_TOKEN = unexpectedToken;
/// No parameters.
const DiagnosticWithoutArguments
unexpectedDollarInString = DiagnosticWithoutArgumentsImpl(
@@ -81,9 +81,6 @@ const List<DiagnosticClassInfo> diagnosticClasses = [
file: syntacticErrorsFile,
name: 'ParserErrorCode',
type: AnalyzerDiagnosticType.syntacticError,
deprecatedSnakeCaseNames: {
'UNEXPECTED_TOKEN', // Referenced by `package:dart_style`.
},
),
DiagnosticClassInfo(
file: manifestWarningCodeFile,
@@ -584,11 +581,6 @@ class DiagnosticClassInfo {
/// The type of diagnostics in this class.
final AnalyzerDiagnosticType type;
/// The names of any diagnostics which are relied upon by analyzer clients,
/// and therefore will need their "snake case" form preserved (with a
/// deprecation notice) after migration to camel case diagnostic codes.
final Set<String> deprecatedSnakeCaseNames;
/// Documentation comment to generate for the diagnostic class.
///
/// If no documentation comment is needed, this should be the empty string.
@@ -598,7 +590,6 @@ class DiagnosticClassInfo {
required this.file,
required this.name,
required this.type,
this.deprecatedSnakeCaseNames = const {},
this.comment = '',
});
@@ -742,14 +733,6 @@ LocatableDiagnostic $withArgumentsName({$withArgumentsParams}) {
constant.writeln('expectedTypes: ${_computeExpectedTypes()},');
constant.writeln(');');
memberAccumulator.constants[constantName] = constant.toString();
if (diagnosticClassInfo.deprecatedSnakeCaseNames.contains(diagnosticCode)) {
memberAccumulator.constants[diagnosticCode] =
'''
@Deprecated("Please use $constantName")
const DiagnosticCode $diagnosticCode = $constantName;
''';
}
}
/// Generates doc comments for this error code.
@@ -799,21 +782,12 @@ const DiagnosticCode $diagnosticCode = $constantName;
/// diagnostic, imported from `diagnostic.g.dart` using the import prefix
/// `diag`.
void toAnalyzerRedirectCode({required MemberAccumulator memberAccumulator}) {
var diagnosticCode = analyzerCode.snakeCaseName;
var ConstantStyle(:staticType) = constantStyle;
var constant = StringBuffer();
outputConstantHeader(constant);
constant.writeln(' static const $staticType $constantName =');
constant.writeln(' diag.$constantName;');
memberAccumulator.constants[constantName] = constant.toString();
if (diagnosticClassInfo.deprecatedSnakeCaseNames.contains(diagnosticCode)) {
memberAccumulator.constants[diagnosticCode] =
'''
@Deprecated("Please use $constantName")
static const DiagnosticCode $diagnosticCode = $constantName;
''';
}
}
/// Generates the appropriate declaration for this diagnostic to include in