[cfe/test/ffi] Move ffi_sample.dart to nnbd folder

Bumps `package:ffi` to a version using `?`.

Moves `ffi_sample.dart` from `general` to `nnbd` to prevent errors on
the usage of `?` in `package:ffi`.

Change-Id: I8bce1850ce4d144174a2e3705b0ae00523b45c73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178201
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
Daco Harkes 2021-01-08 14:15:12 +00:00 committed by commit-bot@chromium.org
parent cf8887bd7e
commit 78ca1452dc
12 changed files with 256 additions and 165 deletions

2
DEPS
View file

@ -102,7 +102,7 @@ vars = {
"chromedriver_tag": "83.0.4103.39",
"dartdoc_rev" : "a1d86f2c992f4660ddcc09b27733396e92765d2a",
"ffi_rev": "a5d4232cd38562c75a3ed847baa340e399538028",
"ffi_rev": "31352979f261f7c6ea88fa0a2cfb0fdd004c38fb",
"fixnum_rev": "16d3890c6dc82ca629659da1934e412292508bba",
"file_rev": "0e09370f581ab6388d46fda4cdab66638c0171a1",
"glob_rev": "7c0ef8d4fa086f6b185c4dd724b700e7d7ad8f79",

View file

@ -1,36 +0,0 @@
library;
import self as self;
import "dart:ffi" as ffi;
import "dart:core" as core;
import "dart:ffi";
import "package:ffi/ffi.dart";
class Coordinate extends ffi::Struct {
@ffi::Double::•()
field core::double* x;
@ffi::Double::•()
field core::double* y;
field ffi::Pointer<self::Coordinate*>* next;
static factory allocate(core::double* x, core::double* y, ffi::Pointer<self::Coordinate*>* next) → self::Coordinate*
;
abstract member-signature get _addressOf() → core::Object*; -> ffi::Struct::_addressOf
abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
abstract member-signature method toString() → core::String*; -> core::Object::toString
abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
}
static method main() → dynamic
;
Extra constant evaluation status:
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///ffi_sample.dart:13:4 -> InstanceConstant(const Double{})
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///ffi_sample.dart:16:4 -> InstanceConstant(const Double{})
Extra constant evaluation: evaluated: 2, effectively constant: 2

View file

@ -1,44 +0,0 @@
library;
import self as self;
import "dart:ffi" as ffi;
import "dart:core" as core;
import "package:ffi/src/allocation.dart" as all;
import "dart:ffi";
import "package:ffi/ffi.dart";
class Coordinate extends ffi::Struct {
@#C1
field core::double* x = null;
@#C1
field core::double* y = null;
field ffi::Pointer<self::Coordinate*>* next = null;
static factory allocate(core::double* x, core::double* y, ffi::Pointer<self::Coordinate*>* next) → self::Coordinate* {
return let final self::Coordinate* #t1 = ffi::StructPointer|get#ref<self::Coordinate*>(all::allocate<self::Coordinate*>()) in block {
#t1.{self::Coordinate::x} = x;
#t1.{self::Coordinate::y} = y;
#t1.{self::Coordinate::next} = next;
} =>#t1;
}
abstract member-signature get _addressOf() → core::Object*; -> ffi::Struct::_addressOf
abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
abstract member-signature method toString() → core::String*; -> core::Object::toString
abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
}
static method main() → dynamic {}
constants {
#C1 = ffi::Double {}
}
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:116:9)

View file

@ -1,75 +0,0 @@
library;
import self as self;
import "dart:core" as core;
import "dart:ffi" as ffi;
import "package:ffi/src/allocation.dart" as all;
import "dart:ffi";
import "package:ffi/ffi.dart";
@#C3
@#C8
class Coordinate extends ffi::Struct {
@#C3
static final field core::int* #sizeOf = (#C11).{core::List::[]}(ffi::_abi());
@#C3
constructor #fromTypedDataBase(dynamic #pointer) → dynamic
: super ffi::Struct::_fromPointer(#pointer)
;
static factory allocate(core::double* x, core::double* y, ffi::Pointer<self::Coordinate*>* next) → self::Coordinate* {
return let final self::Coordinate* #t1 = ffi::StructPointer|get#ref<self::Coordinate*>(all::allocate<self::Coordinate*>()) in block {
#t1.{self::Coordinate::x} = x;
#t1.{self::Coordinate::y} = y;
#t1.{self::Coordinate::next} = next;
} =>#t1;
}
abstract member-signature get _addressOf() → core::Object*; -> ffi::Struct::_addressOf
abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
abstract member-signature method toString() → core::String*; -> core::Object::toString
abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
get x() → core::double*
return ffi::_loadDouble(this.{ffi::Struct::_addressOf}, (#C13).{core::List::[]}(ffi::_abi()));
set x(core::double* #v) → void
return ffi::_storeDouble(this.{ffi::Struct::_addressOf}, (#C13).{core::List::[]}(ffi::_abi()), #v);
get y() → core::double*
return ffi::_loadDouble(this.{ffi::Struct::_addressOf}, (#C15).{core::List::[]}(ffi::_abi()));
set y(core::double* #v) → void
return ffi::_storeDouble(this.{ffi::Struct::_addressOf}, (#C15).{core::List::[]}(ffi::_abi()), #v);
get next() → ffi::Pointer<self::Coordinate*>*
return ffi::_fromAddress<self::Coordinate*>(ffi::_loadIntPtr(this.{ffi::Struct::_addressOf}, (#C17).{core::List::[]}(ffi::_abi())));
set next(ffi::Pointer<self::Coordinate*>* #v) → void
return ffi::_storeIntPtr(this.{ffi::Struct::_addressOf}, (#C17).{core::List::[]}(ffi::_abi()), #v.{ffi::Pointer::address});
}
static method main() → dynamic {}
constants {
#C1 = "vm:entry-point"
#C2 = null
#C3 = core::pragma {name:#C1, options:#C2}
#C4 = "vm:ffi:struct-fields"
#C5 = TypeLiteralConstant(ffi::Double)
#C6 = TypeLiteralConstant(ffi::Pointer<ffi::NativeType>)
#C7 = <core::Type>[#C5, #C5, #C6]
#C8 = core::pragma {name:#C4, options:#C7}
#C9 = 24
#C10 = 20
#C11 = <core::int*>[#C9, #C10, #C9]
#C12 = 0
#C13 = <core::int*>[#C12, #C12, #C12]
#C14 = 8
#C15 = <core::int*>[#C14, #C14, #C14]
#C16 = 16
#C17 = <core::int*>[#C16, #C16, #C16]
}
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:116:9)

View file

@ -11,12 +11,12 @@ import "package:ffi/ffi.dart";
/// Sample struct for dart:ffi library.
class Coordinate extends Struct {
@Double()
double x;
external double x;
@Double()
double y;
external double y;
Pointer<Coordinate> next;
external Pointer<Coordinate> next;
factory Coordinate.allocate(double x, double y, Pointer<Coordinate> next) {
return allocate<Coordinate>().ref

View file

@ -0,0 +1,32 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:ffi" as ffi;
import "dart:core" as core;
import "dart:ffi";
import "package:ffi/ffi.dart";
class Coordinate extends ffi::Struct {
@ffi::Double::•()
external get x() → core::double;
@ffi::Double::•()
external set x(core::double #externalFieldValue) → void;
@ffi::Double::•()
external get y() → core::double;
@ffi::Double::•()
external set y(core::double #externalFieldValue) → void;
external get next() → ffi::Pointer<self::Coordinate>;
external set next(ffi::Pointer<self::Coordinate> #externalFieldValue) → void;
static factory allocate(core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate
;
}
static method main() → dynamic
;
Extra constant evaluation status:
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///ffi_sample.dart:13:4 -> InstanceConstant(const Double{})
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///ffi_sample.dart:13:4 -> InstanceConstant(const Double{})
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///ffi_sample.dart:16:4 -> InstanceConstant(const Double{})
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///ffi_sample.dart:16:4 -> InstanceConstant(const Double{})
Extra constant evaluation: evaluated: 4, effectively constant: 4

View file

@ -0,0 +1,38 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:ffi" as ffi;
import "dart:core" as core;
import "package:ffi/src/allocation.dart" as all;
import "dart:ffi";
import "package:ffi/ffi.dart";
class Coordinate extends ffi::Struct {
@#C1
external get x() → core::double;
@#C1
external set x(core::double #externalFieldValue) → void;
@#C1
external get y() → core::double;
@#C1
external set y(core::double #externalFieldValue) → void;
external get next() → ffi::Pointer<self::Coordinate>;
external set next(ffi::Pointer<self::Coordinate> #externalFieldValue) → void;
static factory allocate(core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(all::allocate<self::Coordinate>()) in block {
#t1.{self::Coordinate::x} = x;
#t1.{self::Coordinate::y} = y;
#t1.{self::Coordinate::next} = next;
} =>#t1;
}
}
static method main() → dynamic {}
constants {
#C1 = ffi::Double {}
}
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:116:9)

View file

@ -0,0 +1,69 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
import "dart:ffi" as ffi;
import "package:ffi/src/allocation.dart" as all;
import "dart:ffi";
import "package:ffi/ffi.dart";
@#C3
@#C8
class Coordinate extends ffi::Struct {
@#C3
static final field core::int* #sizeOf = (#C11).{core::List::[]}(ffi::_abi())/*isLegacy*/;
@#C3
constructor #fromTypedDataBase(dynamic #pointer) → dynamic
: super ffi::Struct::_fromPointer(#pointer)
;
@#C12
get x() → core::double
return ffi::_loadDouble(this.{ffi::Struct::_addressOf}, (#C14).{core::List::[]}(ffi::_abi()));
@#C12
set x(core::double #externalFieldValue) → void
return ffi::_storeDouble(this.{ffi::Struct::_addressOf}, (#C14).{core::List::[]}(ffi::_abi()), #externalFieldValue);
@#C12
get y() → core::double
return ffi::_loadDouble(this.{ffi::Struct::_addressOf}, (#C16).{core::List::[]}(ffi::_abi()));
@#C12
set y(core::double #externalFieldValue) → void
return ffi::_storeDouble(this.{ffi::Struct::_addressOf}, (#C16).{core::List::[]}(ffi::_abi()), #externalFieldValue);
get next() → ffi::Pointer<self::Coordinate>
return ffi::_fromAddress<self::Coordinate>(ffi::_loadIntPtr(this.{ffi::Struct::_addressOf}, (#C18).{core::List::[]}(ffi::_abi())));
set next(ffi::Pointer<self::Coordinate> #externalFieldValue) → void
return ffi::_storeIntPtr(this.{ffi::Struct::_addressOf}, (#C18).{core::List::[]}(ffi::_abi()), #externalFieldValue.{ffi::Pointer::address});
static factory allocate(core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(all::allocate<self::Coordinate>()) in block {
#t1.{self::Coordinate::x} = x;
#t1.{self::Coordinate::y} = y;
#t1.{self::Coordinate::next} = next;
} =>#t1;
}
}
static method main() → dynamic {}
constants {
#C1 = "vm:entry-point"
#C2 = null
#C3 = core::pragma {name:#C1, options:#C2}
#C4 = "vm:ffi:struct-fields"
#C5 = TypeLiteralConstant(ffi::Double)
#C6 = TypeLiteralConstant(ffi::Pointer<ffi::NativeType>)
#C7 = <core::Type>[#C5, #C5, #C6]
#C8 = core::pragma {name:#C4, options:#C7}
#C9 = 24
#C10 = 20
#C11 = <core::int*>[#C9, #C10, #C9]
#C12 = ffi::Double {}
#C13 = 0
#C14 = <core::int*>[#C13, #C13, #C13]
#C15 = 8
#C16 = <core::int*>[#C15, #C15, #C15]
#C17 = 16
#C18 = <core::int*>[#C17, #C17, #C17]
}
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:116:9)

View file

@ -3,10 +3,10 @@ import "package:ffi/ffi.dart";
class Coordinate extends Struct {
@Double()
double x;
external double x;
@Double()
double y;
Pointer<Coordinate> next;
external double y;
external Pointer<Coordinate> next;
factory Coordinate.allocate(double x, double y, Pointer<Coordinate> next) {}
}

View file

@ -2,11 +2,11 @@ import "package:ffi/ffi.dart";
import 'dart:ffi';
class Coordinate extends Struct {
Pointer<Coordinate> next;
external Pointer<Coordinate> next;
@Double()
double x;
external double x;
@Double()
double y;
external double y;
factory Coordinate.allocate(double x, double y, Pointer<Coordinate> next) {}
}

View file

@ -0,0 +1,38 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:ffi" as ffi;
import "dart:core" as core;
import "package:ffi/src/allocation.dart" as all;
import "dart:ffi";
import "package:ffi/ffi.dart";
class Coordinate extends ffi::Struct {
@#C1
external get x() → core::double;
@#C1
external set x(core::double #externalFieldValue) → void;
@#C1
external get y() → core::double;
@#C1
external set y(core::double #externalFieldValue) → void;
external get next() → ffi::Pointer<self::Coordinate>;
external set next(ffi::Pointer<self::Coordinate> #externalFieldValue) → void;
static factory allocate(core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(all::allocate<self::Coordinate>()) in block {
#t1.{self::Coordinate::x} = x;
#t1.{self::Coordinate::y} = y;
#t1.{self::Coordinate::next} = next;
} =>#t1;
}
}
static method main() → dynamic {}
constants {
#C1 = ffi::Double {}
}
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:116:9)

View file

@ -0,0 +1,69 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
import "dart:ffi" as ffi;
import "package:ffi/src/allocation.dart" as all;
import "dart:ffi";
import "package:ffi/ffi.dart";
@#C3
@#C8
class Coordinate extends ffi::Struct {
@#C3
static final field core::int* #sizeOf = (#C11).{core::List::[]}(ffi::_abi())/*isLegacy*/;
@#C3
constructor #fromTypedDataBase(dynamic #pointer) → dynamic
: super ffi::Struct::_fromPointer(#pointer)
;
@#C12
get x() → core::double
return ffi::_loadDouble(this.{ffi::Struct::_addressOf}, (#C14).{core::List::[]}(ffi::_abi()));
@#C12
set x(core::double #externalFieldValue) → void
return ffi::_storeDouble(this.{ffi::Struct::_addressOf}, (#C14).{core::List::[]}(ffi::_abi()), #externalFieldValue);
@#C12
get y() → core::double
return ffi::_loadDouble(this.{ffi::Struct::_addressOf}, (#C16).{core::List::[]}(ffi::_abi()));
@#C12
set y(core::double #externalFieldValue) → void
return ffi::_storeDouble(this.{ffi::Struct::_addressOf}, (#C16).{core::List::[]}(ffi::_abi()), #externalFieldValue);
get next() → ffi::Pointer<self::Coordinate>
return ffi::_fromAddress<self::Coordinate>(ffi::_loadIntPtr(this.{ffi::Struct::_addressOf}, (#C18).{core::List::[]}(ffi::_abi())));
set next(ffi::Pointer<self::Coordinate> #externalFieldValue) → void
return ffi::_storeIntPtr(this.{ffi::Struct::_addressOf}, (#C18).{core::List::[]}(ffi::_abi()), #externalFieldValue.{ffi::Pointer::address});
static factory allocate(core::double x, core::double y, ffi::Pointer<self::Coordinate> next) → self::Coordinate {
return let final self::Coordinate #t1 = ffi::StructPointer|get#ref<self::Coordinate>(all::allocate<self::Coordinate>()) in block {
#t1.{self::Coordinate::x} = x;
#t1.{self::Coordinate::y} = y;
#t1.{self::Coordinate::next} = next;
} =>#t1;
}
}
static method main() → dynamic {}
constants {
#C1 = "vm:entry-point"
#C2 = null
#C3 = core::pragma {name:#C1, options:#C2}
#C4 = "vm:ffi:struct-fields"
#C5 = TypeLiteralConstant(ffi::Double)
#C6 = TypeLiteralConstant(ffi::Pointer<ffi::NativeType>)
#C7 = <core::Type>[#C5, #C5, #C6]
#C8 = core::pragma {name:#C4, options:#C7}
#C9 = 24
#C10 = 20
#C11 = <core::int*>[#C9, #C10, #C9]
#C12 = ffi::Double {}
#C13 = 0
#C14 = <core::int*>[#C13, #C13, #C13]
#C15 = 8
#C16 = <core::int*>[#C15, #C15, #C15]
#C17 = 16
#C18 = <core::int*>[#C17, #C17, #C17]
}
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:116:9)