mirror of
https://github.com/dart-lang/sdk
synced 2024-10-04 18:58:27 +00:00
fix ffi sample diagnostics
Change-Id: I70cac821de46311e3c8d91f5853c5de09d3a7b6e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292041 Auto-Submit: Jake Macdonald <jakemac@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
parent
103a098d64
commit
836e56b774
|
@ -27,7 +27,7 @@ main() {
|
|||
c1.ref.next = c3;
|
||||
|
||||
Coordinate currentCoordinate = c1.ref;
|
||||
for (var i in [0, 1, 2, 3, 4]) {
|
||||
for (var _ in [0, 1, 2, 3, 4]) {
|
||||
currentCoordinate = currentCoordinate.next.ref;
|
||||
print("${currentCoordinate.x}; ${currentCoordinate.y}");
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ main() {
|
|||
c3.ref.next = c2;
|
||||
|
||||
Coordinate currentCoordinate = c1.ref;
|
||||
for (var i in [0, 1, 2, 3, 4]) {
|
||||
for (var _ in [0, 1, 2, 3, 4]) {
|
||||
currentCoordinate = currentCoordinate.next.ref;
|
||||
print("${currentCoordinate.x}; ${currentCoordinate.y}");
|
||||
}
|
||||
|
@ -64,9 +64,9 @@ main() {
|
|||
{
|
||||
// Allocating in native memory returns a pointer.
|
||||
final c = calloc<Coordinate>();
|
||||
print(c is Pointer<Coordinate>);
|
||||
print(c is Pointer<Coordinate>); // ignore: unnecessary_type_check
|
||||
// `.ref` returns a reference which gives access to the fields.
|
||||
print(c.ref is Coordinate);
|
||||
print(c.ref is Coordinate); // ignore: unnecessary_type_check
|
||||
calloc.free(c);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// 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.
|
||||
|
||||
import "dart:ffi";
|
||||
import "dart:io";
|
||||
|
||||
import "package:ffi/ffi.dart";
|
||||
|
@ -44,7 +43,7 @@ void main() {
|
|||
int id = r.readColumnAsInt("id");
|
||||
expect(true, 1 <= id && id <= 3);
|
||||
String name = r.readColumnByIndex(1);
|
||||
expect(true, name is String);
|
||||
expect(name, isA<String>());
|
||||
final alternativeName = r.readColumn("alternative_name") as String?;
|
||||
dynamic multiTypedValue = r.readColumn("multi_typed_column");
|
||||
expect(
|
||||
|
@ -70,7 +69,7 @@ void main() {
|
|||
int id = r.readColumnAsInt("id");
|
||||
expect(true, 1 <= id && id <= 3);
|
||||
String name = r.readColumnByIndex(1);
|
||||
expect(true, name is String);
|
||||
expect(name, isA<String>());
|
||||
final alternativeName = r.readColumn("alternative_name") as String?;
|
||||
dynamic multiTypedValue = r.readColumn("multi_typed_column");
|
||||
expect(
|
||||
|
|
Loading…
Reference in a new issue