| library; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/general/ffi_sample.dart:12:7: Error: The type 'Coordinate' must be 'base', 'final' or 'sealed' because the supertype 'Struct' is 'base'. |
| // Try adding 'base', 'final', or 'sealed' to the type. |
| // class Coordinate extends Struct { |
| // ^ |
| // |
| // pkg/front_end/testcases/general/ffi_sample.dart:19:23: Error: Field 'next' should be initialized because its type 'Pointer<Coordinate>' doesn't allow null. |
| // - 'Pointer' is from 'dart:ffi'. |
| // - 'Coordinate' is from 'pkg/front_end/testcases/general/ffi_sample.dart'. |
| // Pointer<Coordinate> next; |
| // ^^^^ |
| // |
| 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 { |
| field ffi::Pointer<self::Coordinate> next = null; |
| @#C1 |
| external get x() → core::double; |
| @#C1 |
| external set x(synthesized core::double #externalFieldValue) → void; |
| @#C1 |
| external get y() → core::double; |
| @#C1 |
| external set y(synthesized core::double #externalFieldValue) → void; |
| static factory allocate(ffi::Allocator allocator, 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>(ffi::AllocatorAlloc|call<self::Coordinate>(allocator)) 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) |
| - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart) |