Skip to content

Commit bdd95fa

Browse files
stereotype441Commit Queue
authored andcommitted
[front_end] Use shared logic for interpreting messages.yaml file.
Reworks the logic in `pkg/front_end/tool/generate_messages_lib.dart` to take advantage of shared functionality in `pkg/analyzer_utilities/lib/messages.dart`. This reduces code duplication between the CFE and analyzer, and should help pave the way for sharing more diagnostic message generation logic over time. The following declarations are moved into `pkg/analyzer_utilities/lib/messages.dart` to avoid introducing a circular dependency between `pkg/analyzer_utilities` and `pkg/front_end`: - `severityEnumNames` - `_templateParameterNameToType` - `Conversion`, `LabelerConversion`, `NumericConversion`, and `SimpleConversion` - `ParsedPlaceholder` Also, the enum `_TemplateParameterType` is removed in favor of the shared enum `ErrorCodeParameterType`. To accommodate parameter types that haven't yet been fully harmonized between the analyzer and CFE representations, `ErrorCodeParameterType` is now capable of representing CFE-only and analyzer-only types. In the long run I expect to update the analyzer so that it fully supports all diagnostic parameter types. Change-Id: I6a6a6964928631a6f73a354f9f2d7275197f84b2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448249 Reviewed-by: Johnni Winther <[email protected]> Commit-Queue: Paul Berry <[email protected]>
1 parent 700a6e0 commit bdd95fa

File tree

3 files changed

+384
-375
lines changed

3 files changed

+384
-375
lines changed

pkg/_fe_analyzer_shared/lib/src/messages/severity.dart

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ library _fe_analyzer_shared.messages.severity;
66

77
enum CfeSeverity { context, error, ignored, internalProblem, warning, info }
88

9-
const Map<String, String> severityEnumNames = const <String, String>{
10-
'CONTEXT': 'context',
11-
'ERROR': 'error',
12-
'IGNORED': 'ignored',
13-
'INTERNAL_PROBLEM': 'internalProblem',
14-
'WARNING': 'warning',
15-
'INFO': 'info',
16-
};
17-
189
const Map<String, CfeSeverity> severityEnumValues = const <String, CfeSeverity>{
1910
'CONTEXT': CfeSeverity.context,
2011
'ERROR': CfeSeverity.error,

0 commit comments

Comments
 (0)