Skip to content

Commit 7e1d23b

Browse files
dcharkescommit-bot@chromium.org
authored andcommitted
[vm/ffi] Deprecate Struct.addressOf
Now that we have nested structs, objects a subtype of `Struct` can be backed by either a `Pointer` or a `TypedData`. Having this accessor is misleading. Instead of passing a struct around (which could be backed by either), the `Pointer<T extends Struct>` should be passed around and `.ref` should be used everywhere when access to the backing pointer is required. Issue: #40667 Related issues: * Optimize .ref #38648 * Support tree shaking of structs #38721 Change-Id: I3c73423480b91c00639df886bf1d6ac2e444beab Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177581 Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Daco Harkes <[email protected]>
1 parent 11b3e34 commit 7e1d23b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sdk/lib/ffi/struct.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@ abstract class Struct extends NativeType {
6262
/// Extension on [Struct] specialized for its subtypes.
6363
extension StructAddressOf<T extends Struct> on T {
6464
/// Returns the address backing the reference.
65+
@Deprecated('Hold on to the pointer backing a struct instead.')
6566
Pointer<T> get addressOf => _addressOf as Pointer<T>;
6667
}

0 commit comments

Comments
 (0)