Skip to content

Commit

Permalink
SDK: take advantage of field promotion.
Browse files Browse the repository at this point in the history
Now that field promotion (language feature `inference-update-2`) has
been enabled, we can take advantage of it in the core SDK.

Fixes #52982.

Change-Id: I7144ec26a7b4428f758f4d876d0fdce54a4e30ee
Bug: #52982
CoreLibraryReviewExempt: VM-only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314640
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
  • Loading branch information
stereotype441 authored and Commit Queue committed Aug 7, 2023
1 parent 7a2f49a commit 13f4d95
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
12 changes: 4 additions & 8 deletions sdk/lib/_http/http_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -703,12 +703,10 @@ class _HttpClientResponse extends _HttpInboundMessageListInt
.transform(gzip.decoder)
.transform(const _ToUint8List());
}
// TODO(#52982): Make use of field promotion of `_profileData`.
var profileData = _profileData;
if (profileData != null) {
if (_profileData != null) {
// If _timeline is not set up, don't add unnecessary map() to the stream.
stream = stream.map((data) {
profileData.appendResponseData(data);
_profileData.appendResponseData(data);
return data;
});
}
Expand Down Expand Up @@ -1152,13 +1150,11 @@ abstract class _HttpOutboundMessage<T> extends _IOSinkImpl {
}

Future addStream(Stream<List<int>> s) {
// TODO(#52982): Make use of field promotion of `_profileData`.
var profileData = _profileData;
if (profileData == null) {
if (_profileData == null) {
return super.addStream(s);
}
return super.addStream(s.map((data) {
profileData.appendRequestData(Uint8List.fromList(data));
_profileData.appendRequestData(Uint8List.fromList(data));
return data;
}));
}
Expand Down
4 changes: 1 addition & 3 deletions sdk/lib/developer/timeline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,7 @@ final class TimelineTask {
map[key] = arguments[key];
}
}
// TODO(#52982): Make use of field promotion of `_parent`.
var parent = _parent;
if (parent != null) map['parentId'] = parent._taskId.toRadixString(16);
if (_parent != null) map['parentId'] = _parent._taskId.toRadixString(16);
if (_filterKey != null) map[_kFilterKey] = _filterKey;
block._start(map);
}
Expand Down

0 comments on commit 13f4d95

Please sign in to comment.