Skip to content

Commit 7ac7b4d

Browse files
stereotype441Commit Queue
authored andcommitted
[messages] Use analyzerCodeReference more.
Updates some of the logic in `analyzer_messages.dart` to make use of the getter `AnalyzerCode.analyzerCodeReference`. There is no change in the generated code. This paves the way for a follow-up CL that will move the declarations of the analyzer diagnostic constants out of classes like `CompileTimeErrorCode` and to top level constants. When that move happens, references to these constants will need to be changed. Consolidating more of the logic in `analyzer_messages.dart` to use `analyzerCodeReference` reduces the number of places in the code generator that will need to be updated in order to change these references. Change-Id: I6a6a6964534cb68074f316c4f2c914e957b37528 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461144 Commit-Queue: Paul Berry <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent d6f6e52 commit 7ac7b4d

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

pkg/analyzer/tool/messages/generate.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,7 @@ part of 'diagnostic_code_values.dart';
160160
for (var message
161161
in diagnosticTables.activeMessagesByPackage[AnalyzerDiagnosticPackage
162162
.analyzer]!) {
163-
var analyzerCode = message.analyzerCode;
164-
var diagnosticName = analyzerCode.camelCaseName;
165-
out.writeln(' ${analyzerCode.diagnosticClass.name}.$diagnosticName,');
163+
out.writeln(' ${message.analyzerCode.analyzerCodeReference},');
166164
}
167165
out.writeln('];');
168166
out.writeln();

pkg/analyzer_utilities/lib/analyzer_messages.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ mixin MessageWithAnalyzerCode on Message {
632632
'''
633633
static LocatableDiagnostic $withArgumentsName({$withArgumentsParams}) {
634634
return LocatableDiagnosticImpl(
635-
${diagnosticClassInfo.name}.$constantName, [$argumentNames]);
635+
${analyzerCode.analyzerCodeReference}, [$argumentNames]);
636636
}''';
637637
}
638638

0 commit comments

Comments
 (0)