Skip to content

Commit 0a81294

Browse files
stereotype441Commit Queue
authored andcommitted
[messages] Remove hacks that allowed for non-existent file.
Removes the following hacks: - The `allowNonExistent` parameter from `_loadCfeStyleMessages`. - The `!file.existsSync()` check from `messages_suite.dart`. These were temporary hacks to allow code generation (and presubmits, respectively) to succeed during the transition period before `pkg/_fe_analyzer_shared/messages.yaml` was introduced. Now that `pkg/_fe_analyzer_shared/messages.yaml` is present, the hacks are no longer needed. Change-Id: I6a6a69642565a8278a94b61912308bfdcbd04d50 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448661 Commit-Queue: Paul Berry <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
1 parent e188a31 commit 0a81294

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

pkg/analyzer_utilities/lib/messages.dart

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ const Map<String, String> severityEnumNames = <String, String>{
2323
/// Decoded messages from the `_fe_analyzer_shared` package's `messages.yaml`
2424
/// file.
2525
final Map<String, CfeStyleErrorCodeInfo> feAnalyzerSharedMessages =
26-
_loadCfeStyleMessages(
27-
feAnalyzerSharedPkgPath,
28-
allowNonExistent: true,
29-
isShared: true,
30-
);
26+
_loadCfeStyleMessages(feAnalyzerSharedPkgPath, isShared: true);
3127

3228
/// The path to the `fe_analyzer_shared` package.
3329
final String feAnalyzerSharedPkgPath = normalize(
@@ -107,19 +103,11 @@ Map<String, CfeStyleErrorCodeInfo> decodeCfeStyleMessagesYaml(
107103
}
108104

109105
/// Loads messages in CFE style `messages.yaml` format.
110-
///
111-
/// If [allowNonExistent] is `true`, and the `messages.yaml` file does not
112-
/// exist, an empty map is returned. This is a temporary measure to allow for an
113-
/// easier transition when the file `pkg/_fe_analyzer_shared/messages.yaml` is
114-
/// created.
115-
// TODO(paulberry): remove [allowNonExistent] once it's no longer needed.
116106
Map<String, CfeStyleErrorCodeInfo> _loadCfeStyleMessages(
117107
String packagePath, {
118-
bool allowNonExistent = false,
119108
required bool isShared,
120109
}) {
121110
var path = join(packagePath, 'messages.yaml');
122-
if (allowNonExistent && !File(path).existsSync()) return {};
123111
Object? messagesYaml = loadYaml(
124112
File(path).readAsStringSync(),
125113
sourceUrl: Uri.file(path),

pkg/front_end/test/messages_suite.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,6 @@ class MessageTestSuite extends ChainContext {
179179
List<MessageTestDescription> result = [];
180180
Uri uri = root.resolve("messages.yaml");
181181
File file = new File.fromUri(uri);
182-
// Allow for the possibility that the file might not exist yet.
183-
// TODO(paulberry): remove this hack once
184-
// `pkg/_fe_analyzer_shared/messages.yaml` exists
185-
if (!file.existsSync()) return const [];
186182
String fileContent = file.readAsStringSync();
187183
YamlMap messages = loadYamlNode(fileContent, sourceUrl: uri) as YamlMap;
188184
for (String name in messages.keys) {

0 commit comments

Comments
 (0)