Version 2.18.0-14.0.dev
Merge commit '5ca6eec782bf4131218561e0d858275615afbda0' into 'dev'
diff --git a/pkg/front_end/testcases/general/ffi_sample.dart.weak.expect b/pkg/front_end/testcases/general/ffi_sample.dart.weak.expect
index d92782a..269de28 100644
--- a/pkg/front_end/testcases/general/ffi_sample.dart.weak.expect
+++ b/pkg/front_end/testcases/general/ffi_sample.dart.weak.expect
@@ -40,7 +40,7 @@
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
-- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:115:9)
+- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:35:9)
- NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/general/ffi_sample.dart.weak.modular.expect b/pkg/front_end/testcases/general/ffi_sample.dart.weak.modular.expect
index d92782a..269de28 100644
--- a/pkg/front_end/testcases/general/ffi_sample.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/ffi_sample.dart.weak.modular.expect
@@ -40,7 +40,7 @@
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
-- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:115:9)
+- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:35:9)
- NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/general/ffi_sample.dart.weak.transformed.expect b/pkg/front_end/testcases/general/ffi_sample.dart.weak.transformed.expect
index 0765c4c..15587c9 100644
--- a/pkg/front_end/testcases/general/ffi_sample.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/ffi_sample.dart.weak.transformed.expect
@@ -74,7 +74,7 @@
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
-- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:115:9)
+- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:35:9)
- NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.expect
index b190b3a..b376ba2 100644
--- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.expect
@@ -34,7 +34,7 @@
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
-- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:115:9)
+- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:35:9)
- NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect
index fccf634..2b681fa 100644
--- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect
@@ -65,7 +65,7 @@
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
-- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:115:9)
+- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:35:9)
- NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.expect
index b190b3a..b376ba2 100644
--- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.expect
@@ -34,7 +34,7 @@
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
-- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:115:9)
+- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:35:9)
- NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.modular.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.modular.expect
index b190b3a..b376ba2 100644
--- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.modular.expect
@@ -34,7 +34,7 @@
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
-- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:115:9)
+- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:35:9)
- NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect
index fccf634..2b681fa 100644
--- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect
@@ -65,7 +65,7 @@
Constructor coverage from constants:
org-dartlang-testcase:///ffi_sample.dart:
-- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:114:9)
-- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:34:9)
+- Double. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:115:9)
+- _NativeDouble. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:35:9)
- NativeType. (from org-dartlang-sdk:///sdk/lib/ffi/native_type.dart:12:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
diff --git a/runtime/tools/ffi/sdk_lib_ffi_generator.dart b/runtime/tools/ffi/sdk_lib_ffi_generator.dart
index d32b0a1..64b985a 100644
--- a/runtime/tools/ffi/sdk_lib_ffi_generator.dart
+++ b/runtime/tools/ffi/sdk_lib_ffi_generator.dart
@@ -24,12 +24,13 @@
Config("Uint16", "int", "Uint16List", 2),
Config("Uint32", "int", "Uint32List", 4),
Config("Uint64", "int", "Uint64List", 8),
- Config("IntPtr", "int", kDoNotEmit, kIntPtrElementSize),
Config("Float", "double", "Float32List", 4),
Config("Double", "double", "Float64List", 8),
- Config("Bool", "bool", kDoNotEmit, 1),
+ Config("Bool", "bool", kDoNotEmit, 1, since: Version(2, 15)),
];
+const arrayVersion = Version(2, 13);
+
//
// Generator.
//
@@ -81,8 +82,6 @@
final elementSize = config.elementSize;
final bits = sizeOfBits(elementSize);
- // final sizeInBytes =
- // "${sizeOf(elementSize)} byte${elementSize != 1 ? "s" : ""}";
String property;
if (_isInt(nativeType)) {
@@ -178,9 +177,10 @@
""";
if (container == "Pointer") {
+ final since = config.since?.sinceAnnotation ?? '';
buffer.write("""
/// Extension on [Pointer] specialized for the type argument [$nativeType].
-extension ${nativeType}Pointer on Pointer<$nativeType> {
+$since extension ${nativeType}Pointer on Pointer<$nativeType> {
/// The $property at [address].
$platform$truncate$alignment external $dartType get value;
@@ -197,9 +197,11 @@
""");
} else {
+ final since =
+ Version.latest(config.since, arrayVersion)?.sinceAnnotation ?? '';
buffer.write("""
/// Bounds checking indexing methods on [Array]s of [$nativeType].
-extension ${nativeType}Array on Array<$nativeType> {
+$since extension ${nativeType}Array on Array<$nativeType> {
external $dartType operator [](int index);
external void operator []=(int index, $dartType value);
@@ -288,32 +290,11 @@
bool _isInt(String type) => type.startsWith("Int") || type.startsWith("Uint");
bool _isSigned(String type) => type.startsWith("Int");
-String sizeOf(int size) {
- switch (size) {
- case kIntPtrElementSize:
- return "4 or 8";
- default:
- return "$size";
- }
-}
+String sizeOf(int size) => "$size";
-String sizeOfBits(int size) {
- switch (size) {
- case kIntPtrElementSize:
- return "32 or 64";
- default:
- return "${size * 8}";
- }
-}
+String sizeOfBits(int size) => "${size * 8}";
-String sizeOfIntPtrSize(int size) {
- switch (size) {
- case kIntPtrElementSize:
- return "_intPtrSize";
- default:
- return "$size";
- }
-}
+String sizeOfIntPtrSize(int size) => "$size";
String bracketOr(String input) {
if (input.contains("or")) {
@@ -348,9 +329,32 @@
final String dartType;
final String typedListType;
final int elementSize;
+ final Version? since;
const Config(
- this.nativeType, this.dartType, this.typedListType, this.elementSize);
+ this.nativeType, this.dartType, this.typedListType, this.elementSize,
+ {Version? since})
+ : since = since;
}
const String kDoNotEmit = "donotemit";
-const int kIntPtrElementSize = -1;
+
+class Version {
+ final int major;
+ final int minor;
+
+ const Version(this.major, this.minor);
+
+ @override
+ String toString() => '$major.$minor';
+
+ static Version? latest(Version? a, Version? b) {
+ if (a == null) return b;
+ if (b == null) return a;
+ if (a.major > b.major) return a;
+ if (b.major > a.major) return b;
+ if (a.minor > b.minor) return a;
+ return b;
+ }
+
+ String get sinceAnnotation => "@Since('$this')";
+}
diff --git a/sdk/lib/ffi/abi.dart b/sdk/lib/ffi/abi.dart
index 1efe4a5..e6f08b3 100644
--- a/sdk/lib/ffi/abi.dart
+++ b/sdk/lib/ffi/abi.dart
@@ -14,6 +14,7 @@
/// The Dart VM can run on a variety of operating systems and architectures.
/// Supported ABIs are represented by `Abi` objects.
/// See [values] for all the supported ABIs.
+@Since('2.16')
class Abi {
/// The application binary interface for Android on the Arm architecture.
static const androidArm = _androidArm;
diff --git a/sdk/lib/ffi/abi_specific.dart b/sdk/lib/ffi/abi_specific.dart
index a41308c..61eb867 100644
--- a/sdk/lib/ffi/abi_specific.dart
+++ b/sdk/lib/ffi/abi_specific.dart
@@ -43,6 +43,7 @@
/// const UintPtr();
/// }
/// ```
+@Since('2.16')
class AbiSpecificInteger extends NativeType {
const AbiSpecificInteger();
}
@@ -50,6 +51,7 @@
/// Mapping for a subtype of [AbiSpecificInteger].
///
/// See documentation on [AbiSpecificInteger].
+@Since('2.16')
class AbiSpecificIntegerMapping {
final Map<Abi, NativeType> mapping;
diff --git a/sdk/lib/ffi/allocation.dart b/sdk/lib/ffi/allocation.dart
index fc5fce4..45673cc 100644
--- a/sdk/lib/ffi/allocation.dart
+++ b/sdk/lib/ffi/allocation.dart
@@ -5,6 +5,7 @@
part of dart.ffi;
/// Manages memory on the native heap.
+@Since('2.12')
abstract class Allocator {
/// This interface is meant to be implemented, not extended or mixed in.
Allocator._() {
@@ -28,6 +29,7 @@
}
/// Extension on [Allocator] to provide allocation with [NativeType].
+@Since('2.12')
extension AllocatorAlloc on Allocator {
/// Allocates `sizeOf<T>() * count` bytes of memory using
/// `allocator.allocate`.
diff --git a/sdk/lib/ffi/c_type.dart b/sdk/lib/ffi/c_type.dart
index cb9d386..ee358c2 100644
--- a/sdk/lib/ffi/c_type.dart
+++ b/sdk/lib/ffi/c_type.dart
@@ -21,6 +21,7 @@
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Uint8(),
Abi.androidArm64: Uint8(),
@@ -57,6 +58,7 @@
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Int8(),
Abi.androidArm64: Int8(),
@@ -93,6 +95,7 @@
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Uint8(),
Abi.androidArm64: Uint8(),
@@ -129,6 +132,7 @@
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Int16(),
Abi.androidArm64: Int16(),
@@ -165,6 +169,7 @@
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Uint16(),
Abi.androidArm64: Uint16(),
@@ -201,6 +206,7 @@
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Int32(),
Abi.androidArm64: Int32(),
@@ -237,6 +243,7 @@
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Uint32(),
Abi.androidArm64: Uint32(),
@@ -274,6 +281,7 @@
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Int32(),
Abi.androidArm64: Int64(),
@@ -311,6 +319,7 @@
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Uint32(),
Abi.androidArm64: Uint64(),
@@ -347,6 +356,7 @@
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Int64(),
Abi.androidArm64: Int64(),
@@ -383,6 +393,7 @@
/// in Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Uint64(),
Abi.androidArm64: Uint64(),
@@ -447,6 +458,7 @@
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Uint32(),
Abi.androidArm64: Uint64(),
@@ -479,6 +491,7 @@
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Uint32(),
Abi.androidArm64: Uint64(),
@@ -514,6 +527,7 @@
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct] and
/// [Union] fields.
+@Since('2.17')
@AbiSpecificIntegerMapping({
Abi.androidArm: Uint32(),
Abi.androidArm64: Uint32(),
diff --git a/sdk/lib/ffi/ffi.dart b/sdk/lib/ffi/ffi.dart
index 0d4d5b7..8311238 100644
--- a/sdk/lib/ffi/ffi.dart
+++ b/sdk/lib/ffi/ffi.dart
@@ -2,13 +2,12 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file
-/**
- * Foreign Function Interface for interoperability with the C programming language.
- *
- * For further details, please see: https://dart.dev/server/c-interop
- *
- * {@category VM}
- */
+/// Foreign Function Interface for interoperability with the C programming language.
+///
+/// For further details, please see: https://dart.dev/server/c-interop.
+///
+/// {@category VM}
+@Since('2.6')
library dart.ffi;
import 'dart:_internal' show Since;
@@ -93,6 +92,7 @@
}
/// A fixed-sized array of [T]s.
+@Since('2.13')
class Array<T extends NativeType> extends NativeType {
/// Const constructor to specify [Array] dimensions in [Struct]s.
///
@@ -523,6 +523,7 @@
}
/// Extension on [Pointer] specialized for the type argument [Bool].
+@Since('2.15')
extension BoolPointer on Pointer<Bool> {
/// The bool at [address].
external bool get value;
@@ -537,6 +538,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Int8].
+@Since('2.13')
extension Int8Array on Array<Int8> {
external int operator [](int index);
@@ -544,6 +546,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Int16].
+@Since('2.13')
extension Int16Array on Array<Int16> {
external int operator [](int index);
@@ -551,6 +554,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Int32].
+@Since('2.13')
extension Int32Array on Array<Int32> {
external int operator [](int index);
@@ -558,6 +562,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Int64].
+@Since('2.13')
extension Int64Array on Array<Int64> {
external int operator [](int index);
@@ -565,6 +570,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Uint8].
+@Since('2.13')
extension Uint8Array on Array<Uint8> {
external int operator [](int index);
@@ -572,6 +578,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Uint16].
+@Since('2.13')
extension Uint16Array on Array<Uint16> {
external int operator [](int index);
@@ -579,6 +586,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Uint32].
+@Since('2.13')
extension Uint32Array on Array<Uint32> {
external int operator [](int index);
@@ -586,6 +594,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Uint64].
+@Since('2.13')
extension Uint64Array on Array<Uint64> {
external int operator [](int index);
@@ -593,6 +602,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Float].
+@Since('2.13')
extension FloatArray on Array<Float> {
external double operator [](int index);
@@ -600,6 +610,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Double].
+@Since('2.13')
extension DoubleArray on Array<Double> {
external double operator [](int index);
@@ -607,6 +618,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Bool].
+@Since('2.15')
extension BoolArray on Array<Bool> {
external bool operator [](int index);
@@ -642,7 +654,7 @@
/// Store a Dart value into this location offset by [index].
///
/// A [Pointer] is unboxed before being stored (as if by `.address`), and the
- /// pointer is boxed (as if by `Pointer.fromAddress`) when loaded.
+ /// pointer is boxed (as if by [Pointer.fromAddress]) when loaded.
///
/// On 32-bit platforms the [address] must be 4-byte aligned, and on 64-bit
/// platforms the [address] must be 8-byte aligned.
@@ -650,6 +662,7 @@
}
/// Extension on [Pointer] specialized for the type argument [Struct].
+@Since('2.12')
extension StructPointer<T extends Struct> on Pointer<T> {
/// A Dart view of the struct referenced by this pointer.
///
@@ -685,6 +698,7 @@
}
/// Extension on [Pointer] specialized for the type argument [Union].
+@Since('2.14')
extension UnionPointer<T extends Union> on Pointer<T> {
/// A Dart view of the union referenced by this pointer.
///
@@ -721,6 +735,7 @@
/// Extension on [Pointer] specialized for the type argument
/// [AbiSpecificInteger].
+@Since('2.16')
extension AbiSpecificIntegerPointer<T extends AbiSpecificInteger>
on Pointer<T> {
/// The integer at [address].
@@ -736,6 +751,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Pointer].
+@Since('2.13')
extension PointerArray<T extends NativeType> on Array<Pointer<T>> {
external Pointer<T> operator [](int index);
@@ -743,6 +759,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Struct].
+@Since('2.13')
extension StructArray<T extends Struct> on Array<T> {
/// This extension method must be invoked on a receiver of type `Pointer<T>`
/// where `T` is a compile-time constant type.
@@ -750,6 +767,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Union].
+@Since('2.14')
extension UnionArray<T extends Union> on Array<T> {
/// This extension method must be invoked on a receiver of type `Pointer<T>`
/// where `T` is a compile-time constant type.
@@ -757,6 +775,7 @@
}
/// Bounds checking indexing methods on [Array]s of [Array].
+@Since('2.13')
extension ArrayArray<T extends NativeType> on Array<Array<T>> {
external Array<T> operator [](int index);
@@ -764,6 +783,7 @@
}
/// Bounds checking indexing methods on [Array]s of [AbiSpecificInteger].
+@Since('2.16')
extension AbiSpecificIntegerArray on Array<AbiSpecificInteger> {
external int operator [](int index);
@@ -771,31 +791,40 @@
}
/// Extension to retrieve the native `Dart_Port` from a [SendPort].
+@Since('2.7')
extension NativePort on SendPort {
/// The native port of this [SendPort].
///
/// The returned native port can for example be used by C code to post
/// messages to the connected [ReceivePort] via `Dart_PostCObject()` - see
/// `dart_native_api.h`.
+ ///
+ /// Only the send ports from the platform classes [ReceivePort] and
+ /// [RawReceivePort] are supported. User-defined implementations of
+ /// [SendPort] are not supported.
external int get nativePort;
}
/// Opaque, not exposing it's members.
+@Since('2.8')
class Dart_CObject extends Opaque {}
typedef Dart_NativeMessageHandler = Void Function(Int64, Pointer<Dart_CObject>);
/// Utilities for accessing the Dart VM API from Dart code or
/// from C code via `dart_api_dl.h`.
+@Since('2.8')
abstract class NativeApi {
/// On breaking changes the major version is increased.
///
/// The versioning covers the API surface in `dart_api_dl.h`.
+ @Since('2.9')
external static int get majorVersion;
/// On backwards compatible changes the minor version is increased.
///
/// The versioning covers the API surface in `dart_api_dl.h`.
+ @Since('2.9')
external static int get minorVersion;
/// A function pointer to
@@ -827,6 +856,7 @@
/// Pass this to `Dart_InitializeApiDL` in your native code to enable using the
/// symbols in `dart_api_dl.h`.
+ @Since('2.9')
external static Pointer<Void> get initializeApiDLData;
}
@@ -843,6 +873,7 @@
/// See `Dart_SetFfiNativeResolver` in `dart_api.h`
///
/// NOTE: This is an experimental feature and may change in the future.
+@Since('2.14')
class FfiNative<T> {
final String nativeName;
final bool isLeaf;
diff --git a/sdk/lib/ffi/native_finalizer.dart b/sdk/lib/ffi/native_finalizer.dart
index 14074cf..fcc4437 100644
--- a/sdk/lib/ffi/native_finalizer.dart
+++ b/sdk/lib/ffi/native_finalizer.dart
@@ -218,6 +218,7 @@
/// ```
// TODO(http://dartbug.com/44395): Add implicit await to Dart implementation.
// This will fix `useAsync2` above.
+@Since('2.17')
abstract class Finalizable {
factory Finalizable._() => throw UnsupportedError("");
}
@@ -246,6 +247,7 @@
/// attached finalizers are definitely called at least once before the program
/// ends, and the callbacks are called as soon as possible after an object
/// is recognized as inaccessible.
+@Since('2.17')
abstract class NativeFinalizer {
/// Creates a finalizer with the given finalization callback.
///
diff --git a/sdk/lib/ffi/native_type.dart b/sdk/lib/ffi/native_type.dart
index 55a9f6d..62db0d5 100644
--- a/sdk/lib/ffi/native_type.dart
+++ b/sdk/lib/ffi/native_type.dart
@@ -16,6 +16,7 @@
///
/// [Opaque]'s subtypes are not constructible in the Dart code and serve purely
/// as markers in type signatures.
+@Since('2.12')
abstract class Opaque extends NativeType {}
/// [_NativeInteger]'s subtypes represent a native integer in C.
@@ -118,6 +119,7 @@
///
/// [Bool] is not constructible in the Dart code and serves purely as marker
/// in type signatures.
+@Since('2.15')
class Bool extends NativeType {
const Bool();
}
@@ -133,6 +135,7 @@
///
/// [Handle] is not constructible in the Dart code and serves purely as marker in
/// type signatures.
+@Since('2.9')
abstract class Handle extends NativeType {}
/// Represents a function type in C.
diff --git a/sdk/lib/ffi/struct.dart b/sdk/lib/ffi/struct.dart
index c02a059..3f84c42 100644
--- a/sdk/lib/ffi/struct.dart
+++ b/sdk/lib/ffi/struct.dart
@@ -61,6 +61,7 @@
/// by native memory or typed data. They may allocated via allocation or loaded
/// from a [Pointer] or created by ffi calls or callbacks. They cannot be
/// created by a generative constructor.
+@Since('2.12')
abstract class Struct extends _Compound {
/// Construct a reference to the [nullptr].
///
@@ -76,6 +77,7 @@
/// need to be packed.
///
/// Valid values for [memberAlignment] are 1, 2, 4, 8, and 16.
+@Since('2.13')
class Packed {
final int memberAlignment;
diff --git a/sdk/lib/ffi/union.dart b/sdk/lib/ffi/union.dart
index 60242fe..8d2ee9e 100644
--- a/sdk/lib/ffi/union.dart
+++ b/sdk/lib/ffi/union.dart
@@ -46,6 +46,7 @@
/// Instances of a subclass of [Union] have reference semantics and are backed
/// by native memory. The may allocated via allocation or loaded from a
/// [Pointer], but cannot be created by a generative constructor.
+@Since('2.14')
abstract class Union extends _Compound {
/// Construct a reference to the [nullptr].
///
diff --git a/tools/VERSION b/tools/VERSION
index c811137..fda6b19 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 18
PATCH 0
-PRERELEASE 13
+PRERELEASE 14
PRERELEASE_PATCH 0
\ No newline at end of file