dart-sdk/tests/ffi/ffi_native_test.dart
Daco Harkes df4ef72c01 [vm/ffi] Remove deprecated FfiNative
TEST=pkg/analyzer/test/
TEST=CI build with class removed from `dart:ffi`

Closes: https://github.com/dart-lang/sdk/issues/53923
CoreLibraryReviewExempt: VM & dart2wasm only.
Change-Id: I45a39b623754f9f1b65cac55ea9adae390199f5d
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm64c-try,analyzer-analysis-server-linux-try,analyzer-mac-release-try,dart-sdk-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336960
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-11-20 13:16:28 +00:00

42 lines
1.3 KiB
Dart

// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
// 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:nativewrappers';
class Classy {
@Native<IntPtr Function(IntPtr)>(symbol: 'ReturnIntPtr')
external static int returnIntPtrStatic(int x);
@Native<Void Function(Handle, IntPtr)>(symbol: 'doesntmatter')
external void goodHasReceiverHandle(int v);
}
base class NativeClassy extends NativeFieldWrapperClass1 {
@Native<IntPtr Function(IntPtr)>(symbol: 'ReturnIntPtr')
external static int returnIntPtrStatic(int x);
@Native<Void Function(Pointer<Void>, IntPtr)>(symbol: 'doesntmatter')
external void goodHasReceiverPointer(int v);
@Native<Void Function(Handle, IntPtr)>(symbol: 'doesntmatter')
external void goodHasReceiverHandle(int v);
}
// Regression test: Ensure same-name Native functions don't collide in the
// top-level namespace, but instead live under their parent (Library, Class).
class A {
@Native<Void Function()>(symbol: 'nop')
external static void foo();
}
class B {
@Native<Void Function()>(symbol: 'nop')
external static void foo();
}
void main() {
/* Intentionally empty: Checks that the transform succeeds. */
}