Skip to content

Commit c2e15cf

Browse files
dcharkesCommit Queue
authored and
Commit Queue
committed
[vm/ffi] Introduce Struct.create and Union.create
Structs and unions can now be created from an existing typed data with the new `create` methods. The typed data argument to these `create` methods is optional. If the typed data argument is omitted, a new typed data of the right size will be allocated. Compound field reads and writes are unchecked. (These are TypedDataBase loads and stores, rather than TypedData loads and stores. And Pointers have no byte length.) Therefore the `create` method taking existing TypedData objects check whether the length in bytes it at least the size of the compound. TEST=pkg/analyzer/test/src/diagnostics/creation_of_struct_or_union_test.dart TEST=pkg/vm/testcases/transformations/ffi/struct_typed_data.dart TEST=tests/ffi/structs_typed_data_test.dart TEST=tests/ffi/vmspecific_static_checks_test.dart Closes: #45697 Closes: #53418 Change-Id: If12c56106c7ca56611bccfacbc1c680c2d4ce407 CoreLibraryReviewExempt: FFI is a VM and WASM only feature. Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64c-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342763 Commit-Queue: Daco Harkes <[email protected]> Reviewed-by: Johnni Winther <[email protected]> Reviewed-by: Lasse Nielsen <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
1 parent b6647fd commit c2e15cf

File tree

50 files changed

+938
-57
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+938
-57
lines changed

pkg/analyzer/lib/src/generated/ffi_verifier.dart

+48-8
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ class FfiVerifier extends RecursiveAstVisitor<void> {
219219
if (element is MethodElement) {
220220
var enclosingElement = element.enclosingElement;
221221
if (enclosingElement.isNativeStructPointerExtension ||
222-
enclosingElement.isNativeStructArrayExtension) {
222+
enclosingElement.isNativeStructArrayExtension ||
223+
enclosingElement.isNativeUnionPointerExtension ||
224+
enclosingElement.isNativeUnionArrayExtension) {
223225
if (element.name == '[]') {
224226
_validateRefIndexed(node);
225227
}
@@ -232,10 +234,12 @@ class FfiVerifier extends RecursiveAstVisitor<void> {
232234
var constructor = node.constructorName.staticElement;
233235
var class_ = constructor?.enclosingElement;
234236
if (class_.isStructSubclass || class_.isUnionSubclass) {
235-
_errorReporter.reportErrorForNode(
236-
FfiCode.CREATION_OF_STRUCT_OR_UNION,
237-
node.constructorName,
238-
);
237+
if (!constructor!.isFactory) {
238+
_errorReporter.reportErrorForNode(
239+
FfiCode.CREATION_OF_STRUCT_OR_UNION,
240+
node.constructorName,
241+
);
242+
}
239243
} else if (class_.isNativeCallable) {
240244
_validateNativeCallable(node);
241245
}
@@ -289,6 +293,10 @@ class FfiVerifier extends RecursiveAstVisitor<void> {
289293
} else if (element.name == 'elementAt') {
290294
_validateElementAt(node);
291295
}
296+
} else if (enclosingElement.isStruct || enclosingElement.isUnion) {
297+
if (element.name == 'create') {
298+
_validateCreate(node, enclosingElement.name!);
299+
}
292300
} else if (enclosingElement.isNative) {
293301
if (element.name == 'addressOf') {
294302
_validateNativeAddressOf(node);
@@ -320,7 +328,8 @@ class FfiVerifier extends RecursiveAstVisitor<void> {
320328
var element = node.staticElement;
321329
if (element != null) {
322330
var enclosingElement = element.enclosingElement;
323-
if (enclosingElement.isNativeStructPointerExtension) {
331+
if (enclosingElement.isNativeStructPointerExtension ||
332+
enclosingElement.isNativeUnionPointerExtension) {
324333
if (element.name == 'ref') {
325334
_validateRefPrefixedIdentifier(node);
326335
}
@@ -334,7 +343,8 @@ class FfiVerifier extends RecursiveAstVisitor<void> {
334343
var element = node.propertyName.staticElement;
335344
if (element != null) {
336345
var enclosingElement = element.enclosingElement;
337-
if (enclosingElement.isNativeStructPointerExtension) {
346+
if (enclosingElement.isNativeStructPointerExtension ||
347+
enclosingElement.isNativeUnionPointerExtension) {
338348
if (element.name == 'ref') {
339349
_validateRefPropertyAccess(node);
340350
}
@@ -1163,6 +1173,22 @@ class FfiVerifier extends RecursiveAstVisitor<void> {
11631173
}
11641174
}
11651175

1176+
void _validateCreate(MethodInvocation node, String errorClass) {
1177+
final typeArgumentTypes = node.typeArgumentTypes;
1178+
if (typeArgumentTypes == null || typeArgumentTypes.length != 1) {
1179+
return;
1180+
}
1181+
final DartType dartType = typeArgumentTypes[0];
1182+
if (!_isValidFfiNativeType(dartType)) {
1183+
final AstNode errorNode = node;
1184+
_errorReporter.reportErrorForNode(
1185+
FfiCode.NON_CONSTANT_TYPE_ARGUMENT,
1186+
errorNode,
1187+
['$errorClass.create'],
1188+
);
1189+
}
1190+
}
1191+
11661192
void _validateElementAt(MethodInvocation node) {
11671193
var targetType = node.realTarget?.staticType;
11681194
if (targetType is InterfaceType && targetType.isPointer) {
@@ -1625,7 +1651,7 @@ class FfiVerifier extends RecursiveAstVisitor<void> {
16251651
/// Validate the invocation of the extension method
16261652
/// `Pointer<T extends Struct>.ref`.
16271653
void _validateRefPrefixedIdentifier(PrefixedIdentifier node) {
1628-
var targetType = node.prefix.typeOrThrow;
1654+
var targetType = node.prefix.staticType;
16291655
if (!_isValidFfiNativeType(targetType,
16301656
allowVoid: false, allowEmptyStruct: true)) {
16311657
final AstNode errorNode = node;
@@ -1922,6 +1948,20 @@ extension on Element? {
19221948
element.isFfiExtension;
19231949
}
19241950

1951+
bool get isNativeUnionArrayExtension {
1952+
final element = this;
1953+
return element is ExtensionElement &&
1954+
element.name == 'UnionArray' &&
1955+
element.isFfiExtension;
1956+
}
1957+
1958+
bool get isNativeUnionPointerExtension {
1959+
final element = this;
1960+
return element is ExtensionElement &&
1961+
element.name == 'UnionPointer' &&
1962+
element.isFfiExtension;
1963+
}
1964+
19251965
/// Return `true` if this represents the class `Opaque`.
19261966
bool get isOpaque {
19271967
final element = this;

pkg/front_end/testcases/general/ffi_sample.dart.strong.transformed.expect

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ library /*isLegacy*/;
99
import self as self;
1010
import "dart:core" as core;
1111
import "dart:ffi" as ffi;
12+
import "dart:typed_data" as typ;
1213

1314
import "dart:ffi";
1415
import "package:ffi/ffi.dart";
@@ -18,6 +19,9 @@ class Coordinate extends ffi::Struct {
1819
constructor #fromTypedDataBase(synthesized core::Object #typedDataBase) → self::Coordinate
1920
: super ffi::Struct::_fromTypedDataBase(#typedDataBase)
2021
;
22+
constructor #fromTypedData(synthesized typ::TypedData #typedData, synthesized core::int #offset, synthesized core::int #sizeInBytes) → self::Coordinate
23+
: super ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
24+
;
2125
static factory allocate(ffi::Allocator* allocator, core::double* x, core::double* y, ffi::Pointer<self::Coordinate*>* next) → self::Coordinate* {
2226
return let final self::Coordinate* #t1 = new self::Coordinate::#fromTypedDataBase(allocator.{ffi::Allocator::allocate}<self::Coordinate*>(self::Coordinate::#sizeOf){(core::int, {alignment: core::int?}) → ffi::Pointer<self::Coordinate*>}!) in block {
2327
#t1.{self::Coordinate::x} = x;

pkg/front_end/testcases/general/ffi_sample.dart.weak.transformed.expect

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ library /*isLegacy*/;
22
import self as self;
33
import "dart:core" as core;
44
import "dart:ffi" as ffi;
5+
import "dart:typed_data" as typ;
56

67
import "dart:ffi";
78
import "package:ffi/ffi.dart";
@@ -11,6 +12,9 @@ class Coordinate extends ffi::Struct {
1112
constructor #fromTypedDataBase(synthesized core::Object #typedDataBase) → self::Coordinate
1213
: super ffi::Struct::_fromTypedDataBase(#typedDataBase)
1314
;
15+
constructor #fromTypedData(synthesized typ::TypedData #typedData, synthesized core::int #offset, synthesized core::int #sizeInBytes) → self::Coordinate
16+
: super ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
17+
;
1418
static factory allocate(ffi::Allocator* allocator, core::double* x, core::double* y, ffi::Pointer<self::Coordinate*>* next) → self::Coordinate* {
1519
return let final self::Coordinate* #t1 = new self::Coordinate::#fromTypedDataBase(allocator.{ffi::Allocator::allocate}<self::Coordinate*>(self::Coordinate::#sizeOf){(core::int, {alignment: core::int?}) → ffi::Pointer<self::Coordinate*>}!) in block {
1620
#t1.{self::Coordinate::x} = x;

pkg/front_end/testcases/incremental/crash_05.yaml.world.1.expect

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ library from "org-dartlang-test:///lib.dart" as lib {
1111
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → lib::Y
1212
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
1313
;
14+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → lib::Y
15+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
16+
;
1417
@#C7
1518
get yy() → dart.core::int
1619
return dart.ffi::_loadUint32(this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object}, #C9.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*});
@@ -35,6 +38,9 @@ library from "org-dartlang-test:///main.dart" as main {
3538
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → main::X
3639
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
3740
;
41+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → main::X
42+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
43+
;
3844
get xx() → lib::Y
3945
return new lib::Y::#fromTypedDataBase( block {
4046
synthesized dart.core::Object #typedDataBase = this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object};

pkg/front_end/testcases/incremental/crash_05.yaml.world.2.expect

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ library from "org-dartlang-test:///lib.dart" as lib {
1111
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → lib::Y
1212
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
1313
;
14+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → lib::Y
15+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
16+
;
1417
@#C7
1518
get yy() → dart.core::int
1619
return dart.ffi::_loadUint32(this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object}, #C9.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*});
@@ -35,6 +38,9 @@ library from "org-dartlang-test:///main.dart" as main {
3538
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → main::X
3639
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
3740
;
41+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → main::X
42+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
43+
;
3844
get xx() → lib::Y
3945
return new lib::Y::#fromTypedDataBase( block {
4046
synthesized dart.core::Object #typedDataBase = this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object};

pkg/front_end/testcases/incremental/crash_06.yaml.world.1.expect

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ library from "org-dartlang-test:///structs.dart" as str {
2929
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → str::A
3030
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
3131
;
32+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → str::A
33+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
34+
;
3235
get yy() → str::Y
3336
return new str::Y::#fromTypedDataBase( block {
3437
synthesized dart.core::Object #typedDataBase = this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object};
@@ -47,6 +50,9 @@ library from "org-dartlang-test:///structs.dart" as str {
4750
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → str::Y
4851
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
4952
;
53+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → str::Y
54+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
55+
;
5056
external get zz() → invalid-type;
5157
external set zz(synthesized invalid-type #externalFieldValue) → void;
5258
@#C10

pkg/front_end/testcases/incremental/crash_06.yaml.world.2.expect

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ library from "org-dartlang-test:///structs.dart" as str {
2929
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → str::A
3030
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
3131
;
32+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → str::A
33+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
34+
;
3235
get yy() → str::Y
3336
return new str::Y::#fromTypedDataBase( block {
3437
synthesized dart.core::Object #typedDataBase = this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object};
@@ -47,6 +50,9 @@ library from "org-dartlang-test:///structs.dart" as str {
4750
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → str::Y
4851
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
4952
;
53+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → str::Y
54+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
55+
;
5056
external get zz() → invalid-type;
5157
external set zz(synthesized invalid-type #externalFieldValue) → void;
5258
@#C10

pkg/front_end/testcases/incremental/ffi_01.yaml.world.1.expect

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ library from "org-dartlang-test:///lib.dart" as lib {
88
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → lib::Coordinate
99
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
1010
;
11+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → lib::Coordinate
12+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
13+
;
1114
@#C8
1215
get x() → dart.core::double
1316
return dart.ffi::_loadDouble(this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object}, #C10.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*});

pkg/front_end/testcases/incremental/ffi_01.yaml.world.2.expect

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ library from "org-dartlang-test:///lib.dart" as lib {
88
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → lib::Coordinate
99
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
1010
;
11+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → lib::Coordinate
12+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
13+
;
1114
@#C8
1215
get x() → dart.core::double
1316
return dart.ffi::_loadDouble(this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object}, #C10.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*});

pkg/front_end/testcases/incremental/ffi_02.yaml.world.1.expect

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ library from "org-dartlang-test:///lib.dart" as lib {
88
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → lib::Coordinate
99
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
1010
;
11+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → lib::Coordinate
12+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
13+
;
1114
@#C8
1215
get x() → dart.core::double
1316
return dart.ffi::_loadDouble(this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object}, #C10.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*});

pkg/front_end/testcases/incremental/issue_46666.yaml.world.1.expect

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ library from "org-dartlang-test:///a.dart" as a {
1111
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → a::StructA
1212
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
1313
;
14+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → a::StructA
15+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
16+
;
1417
get a1() → dart.ffi::Pointer<dart.ffi::Void>
1518
return dart.ffi::_loadPointer<dart.ffi::Void>(this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object}, #C9.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*});
1619
set a1(synthesized dart.ffi::Pointer<dart.ffi::Void> #externalFieldValue) → void
@@ -42,6 +45,9 @@ library from "org-dartlang-test:///a.dart" as a {
4245
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → a::NestedStruct
4346
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
4447
;
48+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → a::NestedStruct
49+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
50+
;
4551
get n1() → dart.ffi::Pointer<dart.ffi::Void>
4652
return dart.ffi::_loadPointer<dart.ffi::Void>(this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object}, #C9.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*});
4753
set n1(synthesized dart.ffi::Pointer<dart.ffi::Void> #externalFieldValue) → void
@@ -74,6 +80,9 @@ library from "org-dartlang-test:///b.dart" as b {
7480
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → b::StructB
7581
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
7682
;
83+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → b::StructB
84+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
85+
;
7786
get b1() → a::StructA
7887
return new a::StructA::#fromTypedDataBase( block {
7988
synthesized dart.core::Object #typedDataBase = this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object};

pkg/front_end/testcases/incremental/issue_46666.yaml.world.2.expect

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ library from "org-dartlang-test:///a.dart" as a {
1111
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → a::StructA
1212
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
1313
;
14+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → a::StructA
15+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
16+
;
1417
get a1() → dart.ffi::Pointer<dart.ffi::Void>
1518
return dart.ffi::_loadPointer<dart.ffi::Void>(this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object}, #C9.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*});
1619
set a1(synthesized dart.ffi::Pointer<dart.ffi::Void> #externalFieldValue) → void
@@ -42,6 +45,9 @@ library from "org-dartlang-test:///a.dart" as a {
4245
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → a::NestedStruct
4346
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
4447
;
48+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → a::NestedStruct
49+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
50+
;
4551
get n1() → dart.ffi::Pointer<dart.ffi::Void>
4652
return dart.ffi::_loadPointer<dart.ffi::Void>(this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object}, #C9.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*});
4753
set n1(synthesized dart.ffi::Pointer<dart.ffi::Void> #externalFieldValue) → void
@@ -74,6 +80,9 @@ library from "org-dartlang-test:///b.dart" as b {
7480
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → b::StructB
7581
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
7682
;
83+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → b::StructB
84+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
85+
;
7786
get b1() → a::StructA
7887
return new a::StructA::#fromTypedDataBase( block {
7988
synthesized dart.core::Object #typedDataBase = this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object};

pkg/front_end/testcases/incremental/no_outline_change_35.yaml.world.1.expect

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ library from "org-dartlang-test:///lib.dart" as lib {
88
constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → lib::Coordinate
99
: super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase)
1010
;
11+
constructor #fromTypedData(synthesized dart.typed_data::TypedData #typedData, synthesized dart.core::int #offset, synthesized dart.core::int #sizeInBytes) → lib::Coordinate
12+
: super dart.ffi::Struct::_fromTypedData(#typedData, #offset, #sizeInBytes)
13+
;
1114
@#C8
1215
get x() → dart.core::double
1316
return dart.ffi::_loadDouble(this.{dart.ffi::_Compound::_typedDataBase}{dart.core::Object}, #C10.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*});

0 commit comments

Comments
 (0)