Reland "if chains → switch expressions" (#148634)
I did a goof a while back:

Now that [the bug is fixed](e9d403541f), I think we're good to re-implement the if-chains cleanup!
Related:
- https://github.com/flutter/flutter/pull/147793
- https://github.com/flutter/flutter/pull/148556
- https://github.com/flutter/flutter/issues/148548
This commit is contained in:
@@ -118,19 +118,12 @@ List<TimelineEvent>? _parseEvents(Map<String, dynamic> json) {
|
||||
.toList();
|
||||
|
||||
timelineEvents.sort((TimelineEvent e1, TimelineEvent e2) {
|
||||
final int? ts1 = e1.timestampMicros;
|
||||
final int? ts2 = e2.timestampMicros;
|
||||
if (ts1 == null) {
|
||||
if (ts2 == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else if (ts2 == null) {
|
||||
return 1;
|
||||
} else {
|
||||
return ts1.compareTo(ts2);
|
||||
}
|
||||
return switch ((e1.timestampMicros, e2.timestampMicros)) {
|
||||
(null, null) => 0,
|
||||
(_, null) => 1,
|
||||
(null, _) => -1,
|
||||
(final int ts1, final int ts2) => ts1.compareTo(ts2),
|
||||
};
|
||||
});
|
||||
|
||||
return timelineEvents;
|
||||
|
||||
Reference in New Issue
Block a user