Use whereType in status_file_linter.dart

Looks like since #32463 is resolved `whereType` can be supported here (I noted the `// TODO(whereType): When whereType is supported, use that.`)

Closes #35040
https://github.com/dart-lang/sdk/pull/35040

GitOrigin-RevId: 4c2ace7eed1c405dece7e8dd76151efbc2ab8088
Change-Id: Iec268d8c639e45dc0c42baf3a9aeb89652a5a30e
Reviewed-on: https://dart-review.googlesource.com/c/82707
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
This commit is contained in:
teresy 2018-11-15 07:58:39 +00:00 committed by commit-bot@chromium.org
parent ed48cfeb47
commit 59949a9201

View file

@ -61,7 +61,7 @@ Iterable<LintingError> lintCommentLinesInSection(StatusSection section) {
}
return lintingErrors;
}
return section.entries.where((entry) => entry is CommentEntry).map((entry) =>
return section.entries.whereType<CommentEntry>().map((entry) =>
new LintingError(entry.lineNumber, "Comment is on a line by itself."));
}
@ -97,7 +97,7 @@ Iterable<LintingError> lintDisjunctionsInHeader(StatusSection section) {
/// ordered alphabetically.
Iterable<LintingError> lintAlphabeticalOrderingOfPaths(StatusSection section) {
var entries = section.entries
.where((entry) => entry is StatusEntry)
.whereType<StatusEntry>()
.map((entry) => (entry as StatusEntry).path)
.toList();
var sortedList = entries.toList()..sort((a, b) => a.compareTo(b));
@ -132,10 +132,8 @@ Iterable<LintingError> lintNormalizedSection(StatusSection section) {
/// Checks for duplicate section entries in the body of a section.
Iterable<LintingError> lintSectionEntryDuplicates(StatusSection section) {
var errors = <LintingError>[];
// TODO(whereType): When whereType is supported, use that.
List<StatusEntry> statusEntries = section.entries
.where((entry) => entry is StatusEntry)
.cast<StatusEntry>()
.whereType<StatusEntry>()
.toList();
for (var i = 0; i < statusEntries.length; i++) {
var entry = statusEntries[i];