Skip to content

Commit bf683ba

Browse files
committed
Reland "[vm/ffi] Introduce Struct.create and Union.create"
Analyzer fix #54754 has landed. A new version of package:analyzer and package:dartdoc have been released. `pub global activate dartdoc` should now work. Patchset 1 is identical to the original CL. The only difference is an extra test testing with negative offsets. === Original CL description === 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: Id7f30bcd4a6ae55a8298b39c9eadf4e80bc699a9 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-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-release-ia32-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349260 Reviewed-by: Martin Kustermann <[email protected]>
1 parent 0151574 commit bf683ba

File tree

50 files changed

+944
-56
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

+944
-56
lines changed

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

Lines changed: 47 additions & 7 deletions
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
}
@@ -1148,6 +1158,22 @@ class FfiVerifier extends RecursiveAstVisitor<void> {
11481158
}
11491159
}
11501160

1161+
void _validateCreate(MethodInvocation node, String errorClass) {
1162+
final typeArgumentTypes = node.typeArgumentTypes;
1163+
if (typeArgumentTypes == null || typeArgumentTypes.length != 1) {
1164+
return;
1165+
}
1166+
final DartType dartType = typeArgumentTypes[0];
1167+
if (!_isValidFfiNativeType(dartType)) {
1168+
final AstNode errorNode = node;
1169+
_errorReporter.reportErrorForNode(
1170+
FfiCode.NON_CONSTANT_TYPE_ARGUMENT,
1171+
errorNode,
1172+
['$errorClass.create'],
1173+
);
1174+
}
1175+
}
1176+
11511177
void _validateElementAt(MethodInvocation node) {
11521178
var targetType = node.realTarget?.staticType;
11531179
if (targetType is InterfaceType && targetType.isPointer) {
@@ -1856,6 +1882,20 @@ extension on Element? {
18561882
element.isFfiExtension;
18571883
}
18581884

1885+
bool get isNativeUnionArrayExtension {
1886+
final element = this;
1887+
return element is ExtensionElement &&
1888+
element.name == 'UnionArray' &&
1889+
element.isFfiExtension;
1890+
}
1891+
1892+
bool get isNativeUnionPointerExtension {
1893+
final element = this;
1894+
return element is ExtensionElement &&
1895+
element.name == 'UnionPointer' &&
1896+
element.isFfiExtension;
1897+
}
1898+
18591899
/// Return `true` if this represents the class `Opaque`.
18601900
bool get isOpaque {
18611901
final element = this;

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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 6 additions & 0 deletions
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

Lines changed: 6 additions & 0 deletions
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

Lines changed: 6 additions & 0 deletions
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

Lines changed: 6 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 9 additions & 0 deletions
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

Lines changed: 9 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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/no_outline_change_35.yaml.world.2.expect

Lines changed: 3 additions & 0 deletions
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)