Skip to content

Commit 9922491

Browse files
dcharkescommit-bot@chromium.org
authored andcommitted
[vm/ffi] Migrate pkg/front_end tests to Allocator
New API landed in: https://dart-review.googlesource.com/c/sdk/+/177705 Issue: #44621 Issue: #38721 Change-Id: Id45274313edbb3842438b66b9c0917a86884c8ed Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178993 Reviewed-by: Aske Simon Christensen <[email protected]> Commit-Queue: Daco Harkes <[email protected]>
1 parent e7f1c03 commit 9922491

14 files changed

+28
-27
lines changed

pkg/front_end/test/spell_checking_list_code.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ alexmarkov
3434
aligned
3535
alive
3636
allocate
37+
allocator
3738
altered
3839
analogous
3940
analogy

pkg/front_end/testcases/general_nnbd_opt_out/ffi_sample.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ class Coordinate extends Struct {
2020

2121
Pointer<Coordinate> next;
2222

23-
factory Coordinate.allocate(double x, double y, Pointer<Coordinate> next) {
24-
return allocate<Coordinate>().ref
23+
factory Coordinate.allocate(
24+
Allocator allocator, double x, double y, Pointer<Coordinate> next) {
25+
return allocator<Coordinate>().ref
2526
..x = x
2627
..y = y
2728
..next = next;

pkg/front_end/testcases/general_nnbd_opt_out/ffi_sample.dart.textual_outline.expect

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ class Coordinate extends Struct {
88
@Double()
99
double y;
1010
Pointer<Coordinate> next;
11-
factory Coordinate.allocate(double x, double y, Pointer<Coordinate> next) {}
11+
factory Coordinate.allocate(
12+
Allocator allocator, double x, double y, Pointer<Coordinate> next) {}
1213
}
1314

1415
main() {}

pkg/front_end/testcases/general_nnbd_opt_out/ffi_sample.dart.textual_outline_modelled.expect

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ class Coordinate extends Struct {
88
double x;
99
@Double()
1010
double y;
11-
factory Coordinate.allocate(double x, double y, Pointer<Coordinate> next) {}
11+
factory Coordinate.allocate(
12+
Allocator allocator, double x, double y, Pointer<Coordinate> next) {}
1213
}
1314

1415
main() {}

pkg/front_end/testcases/general_nnbd_opt_out/ffi_sample.dart.weak.expect

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ library;
22
import self as self;
33
import "dart:ffi" as ffi;
44
import "dart:core" as core;
5-
import "package:ffi/src/allocation.dart" as all;
65

76
import "dart:ffi";
87
import "package:ffi/ffi.dart";
@@ -13,8 +12,8 @@ class Coordinate extends ffi::Struct {
1312
@#C1
1413
field core::double* y = null;
1514
field ffi::Pointer<self::Coordinate*>* next = null;
16-
static factory allocate(core::double* x, core::double* y, ffi::Pointer<self::Coordinate*>* next) → self::Coordinate* {
17-
return let final self::Coordinate* #t1 = ffi::StructPointer|get#ref<self::Coordinate*>(all::allocate<self::Coordinate*>()) in block {
15+
static factory allocate(ffi::Allocator* allocator, core::double* x, core::double* y, ffi::Pointer<self::Coordinate*>* next) → self::Coordinate* {
16+
return let final self::Coordinate* #t1 = ffi::StructPointer|get#ref<self::Coordinate*>(ffi::AllocatorAlloc|call<self::Coordinate*>(allocator)) in block {
1817
#t1.{self::Coordinate::x} = x;
1918
#t1.{self::Coordinate::y} = y;
2019
#t1.{self::Coordinate::next} = next;

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ library;
22
import self as self;
33
import "dart:core" as core;
44
import "dart:ffi" as ffi;
5-
import "package:ffi/src/allocation.dart" as all;
65

76
import "dart:ffi";
87
import "package:ffi/ffi.dart";
@@ -16,8 +15,8 @@ class Coordinate extends ffi::Struct {
1615
constructor #fromTypedDataBase(dynamic #pointer) → dynamic
1716
: super ffi::Struct::_fromPointer(#pointer)
1817
;
19-
static factory allocate(core::double* x, core::double* y, ffi::Pointer<self::Coordinate*>* next) → self::Coordinate* {
20-
return let final self::Coordinate* #t1 = ffi::StructPointer|get#ref<self::Coordinate*>(all::allocate<self::Coordinate*>()) in block {
18+
static factory allocate(ffi::Allocator* allocator, core::double* x, core::double* y, ffi::Pointer<self::Coordinate*>* next) → self::Coordinate* {
19+
return let final self::Coordinate* #t1 = ffi::StructPointer|get#ref<self::Coordinate*>(ffi::AllocatorAlloc|call<self::Coordinate*>(allocator)) in block {
2120
#t1.{self::Coordinate::x} = x;
2221
#t1.{self::Coordinate::y} = y;
2322
#t1.{self::Coordinate::next} = next;

pkg/front_end/testcases/nnbd/ffi_sample.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ class Coordinate extends Struct {
1818

1919
external Pointer<Coordinate> next;
2020

21-
factory Coordinate.allocate(double x, double y, Pointer<Coordinate> next) {
22-
return allocate<Coordinate>().ref
21+
factory Coordinate.allocate(
22+
Allocator allocator, double x, double y, Pointer<Coordinate> next) {
23+
return allocator<Coordinate>().ref
2324
..x = x
2425
..y = y
2526
..next = next;

pkg/front_end/testcases/nnbd/ffi_sample.dart.outline.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Coordinate extends ffi::Struct {
1717
external set y(core::double #externalFieldValue) → void;
1818
external get next() → ffi::Pointer<self::Coordinate>;
1919
external set next(ffi::Pointer<self::Coordinate> #externalFieldValue) → void;
20-
static factory allocate(core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate
20+
static factory allocate(ffi::Allocator allocator, core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate
2121
;
2222
}
2323
static method main() → dynamic

pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.expect

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ library /*isNonNullableByDefault*/;
22
import self as self;
33
import "dart:ffi" as ffi;
44
import "dart:core" as core;
5-
import "package:ffi/src/allocation.dart" as all;
65

76
import "dart:ffi";
87
import "package:ffi/ffi.dart";
@@ -18,8 +17,8 @@ class Coordinate extends ffi::Struct {
1817
external set y(core::double #externalFieldValue) → void;
1918
external get next() → ffi::Pointer<self::Coordinate>;
2019
external set next(ffi::Pointer<self::Coordinate> #externalFieldValue) → void;
21-
static factory allocate(core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
22-
return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(all::allocate<self::Coordinate>()) in block {
20+
static factory allocate(ffi::Allocator allocator, core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
21+
return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(ffi::AllocatorAlloc|call<self::Coordinate>(allocator)) in block {
2322
#t1.{self::Coordinate::x} = x;
2423
#t1.{self::Coordinate::y} = y;
2524
#t1.{self::Coordinate::next} = next;

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ library /*isNonNullableByDefault*/;
22
import self as self;
33
import "dart:core" as core;
44
import "dart:ffi" as ffi;
5-
import "package:ffi/src/allocation.dart" as all;
65

76
import "dart:ffi";
87
import "package:ffi/ffi.dart";
@@ -32,8 +31,8 @@ class Coordinate extends ffi::Struct {
3231
return ffi::_fromAddress<self::Coordinate>(ffi::_loadIntPtr(this.{ffi::Struct::_addressOf}, (#C18).{core::List::[]}(ffi::_abi())));
3332
set next(ffi::Pointer<self::Coordinate> #externalFieldValue) → void
3433
return ffi::_storeIntPtr(this.{ffi::Struct::_addressOf}, (#C18).{core::List::[]}(ffi::_abi()), #externalFieldValue.{ffi::Pointer::address});
35-
static factory allocate(core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
36-
return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(all::allocate<self::Coordinate>()) in block {
34+
static factory allocate(ffi::Allocator allocator, core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
35+
return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(ffi::AllocatorAlloc|call<self::Coordinate>(allocator)) in block {
3736
#t1.{self::Coordinate::x} = x;
3837
#t1.{self::Coordinate::y} = y;
3938
#t1.{self::Coordinate::next} = next;

pkg/front_end/testcases/nnbd/ffi_sample.dart.textual_outline.expect

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ class Coordinate extends Struct {
77
@Double()
88
external double y;
99
external Pointer<Coordinate> next;
10-
factory Coordinate.allocate(double x, double y, Pointer<Coordinate> next) {}
10+
factory Coordinate.allocate(
11+
Allocator allocator, double x, double y, Pointer<Coordinate> next) {}
1112
}
1213

1314
main() {}

pkg/front_end/testcases/nnbd/ffi_sample.dart.textual_outline_modelled.expect

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ class Coordinate extends Struct {
77
external double x;
88
@Double()
99
external double y;
10-
factory Coordinate.allocate(double x, double y, Pointer<Coordinate> next) {}
10+
factory Coordinate.allocate(
11+
Allocator allocator, double x, double y, Pointer<Coordinate> next) {}
1112
}
1213

1314
main() {}

pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.expect

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ library /*isNonNullableByDefault*/;
22
import self as self;
33
import "dart:ffi" as ffi;
44
import "dart:core" as core;
5-
import "package:ffi/src/allocation.dart" as all;
65

76
import "dart:ffi";
87
import "package:ffi/ffi.dart";
@@ -18,8 +17,8 @@ class Coordinate extends ffi::Struct {
1817
external set y(core::double #externalFieldValue) → void;
1918
external get next() → ffi::Pointer<self::Coordinate>;
2019
external set next(ffi::Pointer<self::Coordinate> #externalFieldValue) → void;
21-
static factory allocate(core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
22-
return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(all::allocate<self::Coordinate>()) in block {
20+
static factory allocate(ffi::Allocator allocator, core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
21+
return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(ffi::AllocatorAlloc|call<self::Coordinate>(allocator)) in block {
2322
#t1.{self::Coordinate::x} = x;
2423
#t1.{self::Coordinate::y} = y;
2524
#t1.{self::Coordinate::next} = next;

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ library /*isNonNullableByDefault*/;
22
import self as self;
33
import "dart:core" as core;
44
import "dart:ffi" as ffi;
5-
import "package:ffi/src/allocation.dart" as all;
65

76
import "dart:ffi";
87
import "package:ffi/ffi.dart";
@@ -32,8 +31,8 @@ class Coordinate extends ffi::Struct {
3231
return ffi::_fromAddress<self::Coordinate>(ffi::_loadIntPtr(this.{ffi::Struct::_addressOf}, (#C18).{core::List::[]}(ffi::_abi())));
3332
set next(ffi::Pointer<self::Coordinate> #externalFieldValue) → void
3433
return ffi::_storeIntPtr(this.{ffi::Struct::_addressOf}, (#C18).{core::List::[]}(ffi::_abi()), #externalFieldValue.{ffi::Pointer::address});
35-
static factory allocate(core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
36-
return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(all::allocate<self::Coordinate>()) in block {
34+
static factory allocate(ffi::Allocator allocator, core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
35+
return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(ffi::AllocatorAlloc|call<self::Coordinate>(allocator)) in block {
3736
#t1.{self::Coordinate::x} = x;
3837
#t1.{self::Coordinate::y} = y;
3938
#t1.{self::Coordinate::next} = next;

0 commit comments

Comments
 (0)