[record_use] Use operator + on Recordings instead of custom merge method (#191291)
(We added the method upstream.)
diff --git a/packages/flutter_tools/lib/src/build_system/targets/icon_tree_shaker.dart b/packages/flutter_tools/lib/src/build_system/targets/icon_tree_shaker.dart
index 4e66092..6439756 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/icon_tree_shaker.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/icon_tree_shaker.dart
@@ -130,7 +130,7 @@
final Recordings recordings = await _readRecordings(file);
combinedRecordings = combinedRecordings == null
? recordings
- : combinedRecordings.merge(recordings);
+ : combinedRecordings + recordings;
}
final Map<String, List<int>> iconData = _parseRecordings(combinedRecordings!);
@@ -479,30 +479,3 @@
'To disable icon tree shaking, pass --no-tree-shake-icons to the requested '
'flutter build command';
}
-
-extension on Recordings {
- /// Returns a new [Recordings] containing all usages from both `this` and
- /// [other].
- ///
- /// If a definition is present in both recordings, its usages from both
- /// are combined in the returned [Recordings].
- Recordings merge(Recordings other) {
- final newCalls = <DefinitionWithStaticCalls, List<CallReference>>{};
- for (final MapEntry(:key, :value) in calls.entries) {
- newCalls[key] = <CallReference>[...value];
- }
- for (final MapEntry(:key, :value) in other.calls.entries) {
- newCalls.putIfAbsent(key, () => <CallReference>[]).addAll(value);
- }
-
- final newInstances = <DefinitionWithInstances, List<InstanceReference>>{};
- for (final MapEntry(:key, :value) in instances.entries) {
- newInstances[key] = <InstanceReference>[...value];
- }
- for (final MapEntry(:key, :value) in other.instances.entries) {
- newInstances.putIfAbsent(key, () => <InstanceReference>[]).addAll(value);
- }
-
- return Recordings(calls: newCalls, instances: newInstances);
- }
-}