[messages] Refactor DiagnosticClassInfo.typeCode.

`DiagnosticClassInfo.typeCode` is replaced with a `code` getter on the
`AnalyzerDiagnosticType` enum.

This is part of a longer term effort to remove the
`DiagnosticCode`-derived classes entirely.

Change-Id: I6a6a69641b013d7c2ce8af3f4d54c82a9980bdb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462320
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer_utilities/lib/analyzer_messages.dart b/pkg/analyzer_utilities/lib/analyzer_messages.dart
index 3882e67..6dbfc27 100644
--- a/pkg/analyzer_utilities/lib/analyzer_messages.dart
+++ b/pkg/analyzer_utilities/lib/analyzer_messages.dart
@@ -466,6 +466,9 @@
   final DiagnosticBaseClasses baseClasses;
 
   const AnalyzerDiagnosticType({this.baseClasses = analyzerBaseClasses});
+
+  /// The representation of this type in analyzer source code.
+  String get code => 'DiagnosticType.${name.toSnakeCase().toUpperCase()}';
 }
 
 /// In-memory representation of diagnostic information obtained from the
@@ -599,10 +602,6 @@
     this.comment = '',
   });
 
-  /// Generates the code to compute the type of diagnostics of this class.
-  String get typeCode =>
-      'DiagnosticType.${type.name.toSnakeCase().toUpperCase()}';
-
   static DiagnosticClassInfo byName(String name) =>
       _diagnosticClassesByName[name] ??
       (throw 'No diagnostic class named ${json.encode(name)}. Possible names: '
@@ -730,7 +729,7 @@
       constant.writeln('isUnresolvedIdentifier:true,');
     }
     if (baseClasses.requiresTypeArgument) {
-      constant.writeln('type: ${diagnosticClassInfo.typeCode},');
+      constant.writeln('type: ${diagnosticClassInfo.type.code},');
     }
     String uniqueName = analyzerCode.toString().replaceFirst(
       'LinterLintCode.',