Skip to content

Commit d9d3292

Browse files
dcharkesCommit Queue
authored andcommitted
[ffi/tests] Cleanup lints
Change-Id: Ieac458f7d39557a49b0d0f17e1ce327cffab255c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421185 Commit-Queue: Daco Harkes <[email protected]> Reviewed-by: Moritz Sümmermann <[email protected]>
1 parent 302885c commit d9d3292

7 files changed

+14
-25
lines changed

tests/ffi/array_compound_elements_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// VMOptions=--use-slow-path --stacktrace-every=100
1010

1111
import 'dart:ffi';
12-
import 'dart:typed_data';
1312

1413
import 'package:expect/expect.dart';
1514
import 'package:ffi/ffi.dart';

tests/ffi/dylib_isolates_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
// SharedObjects=ffi_test_functions
88

9+
import 'dart:async';
910
import 'dart:ffi';
1011
import 'dart:io';
1112
import 'dart:isolate';
@@ -29,7 +30,7 @@ void main() async {
2930
Expect.equals(123, getGlobalVar());
3031

3132
final receivePort = ReceivePort();
32-
Isolate.spawn(secondIsolateMain, receivePort.sendPort);
33+
unawaited(Isolate.spawn(secondIsolateMain, receivePort.sendPort));
3334
await receivePort.first;
3435
if (!Platform.isIOS /* Static linking causes different behavior. */ ) {
3536
Expect.equals(42, getGlobalVar());

tests/ffi/generator/array_primitive_elements_test_generator.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'dart:io';
66

77
import 'c_types.dart';
88
import 'utils.dart';
9-
import 'structs_by_value_tests_generator.dart';
109

1110
void main() async {
1211
final StringBuffer buffer = StringBuffer();
@@ -355,5 +354,4 @@ String typedDataListName(FundamentalType type) => switch (type) {
355354
float => 'Float32List',
356355
double_ => 'Float64List',
357356
FundamentalType() => '${type.dartCType}List',
358-
_ => throw UnimplementedError(),
359357
};

tests/ffi/regress_flutter79441_test.dart

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,13 @@ typedef _c_memset = Void Function(Pointer<Uint8>, Int32, IntPtr);
1212

1313
_dart_memset? fbMemset;
1414

15-
void _fallbackMemset(Pointer<Uint8> ptr, int byte, int size) {
16-
final bytes = ptr.cast<Uint8>();
17-
for (var i = 0; i < size; i++) {
18-
bytes[i] = byte;
19-
}
20-
}
21-
2215
void main() {
2316
try {
2417
fbMemset = DynamicLibrary.process().lookupFunction<_c_memset, _dart_memset>(
2518
'memset',
2619
);
2720
} catch (_) {
28-
// This works:
29-
// fbMemset = _fallbackMemset;
30-
31-
// This doesn't: /aot/precompiler.cc: 2761: error: unreachable code
21+
// /aot/precompiler.cc: 2761: error: unreachable code
3222
fbMemset = (Pointer<Uint8> ptr, int byte, int size) {
3323
final bytes = ptr.cast<Uint8>();
3424
for (var i = 0; i < size; i++) {

tests/ffi/regress_jump_to_frame_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ typedef Dart_PropagateError_NativeType = Void Function(Handle);
3838
typedef Dart_PropagateError_DartType = void Function(Object);
3939

4040
final Dart_PropagateError_DartType propagateError = () {
41-
final Pointer<_DartApi> dlapi = NativeApi.initializeApiDLData.cast();
41+
final dlapi = NativeApi.initializeApiDLData.cast<_DartApi>();
4242
for (int i = 0; dlapi.ref.functions[i].name != nullptr; i++) {
4343
final name = dlapi.ref.functions[i].name.cast<Utf8>().toDartString();
4444
if (name == 'Dart_PropagateError') {

tests/ffi/vmspecific_callback_unwind_error_through_handle_test.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,19 @@ typedef CalloutCType = Handle Function(Pointer);
2222
typedef CalloutDartType = Object Function(Pointer);
2323

2424
void child(_) {
25-
var callout = ffiTestFunctions.lookupFunction<CalloutCType, CalloutDartType>(
26-
"TestUnwindErrorThroughHandle",
27-
isLeaf: false,
28-
);
29-
var callback = Pointer.fromFunction<CallbackType>(unwindErrorThroughHandle);
30-
var result = callout(callback);
25+
final callout = ffiTestFunctions
26+
.lookupFunction<CalloutCType, CalloutDartType>(
27+
"TestUnwindErrorThroughHandle",
28+
isLeaf: false,
29+
);
30+
final callback = Pointer.fromFunction<CallbackType>(unwindErrorThroughHandle);
31+
callout(callback);
3132
throw "Should not be reached";
3233
}
3334

3435
void main() {
35-
var onExit = new RawReceivePort();
36-
var onError = new RawReceivePort();
36+
final onExit = new RawReceivePort();
37+
final onError = new RawReceivePort();
3738
onExit.handler = ((msg) {
3839
print("Child exited");
3940
onExit.close();

tests/ffi/vmspecific_object_gc_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final triggerGc = ffiTestFunctions
1818
.lookupFunction<Void Function(), void Function()>("TriggerGC");
1919

2020
void main() async {
21-
testGC();
21+
await testGC();
2222
}
2323

2424
dynamic bar;

0 commit comments

Comments
 (0)