dart-sdk/tests/ffi/very_large_struct.dart
Daco Harkes 40f7a11d89 [vm/ffi] NNBD use external fields for structs
This enables adding the `external` keyword to struct fields, which
enables use in nnbd (weak mode).

Closes: https://github.com/dart-lang/sdk/issues/40247

External fields are not implemented in the analyzer yet:
https://github.com/dart-lang/sdk/issues/41940

Change-Id: I9d88acbdabf73ca63a6ad3d549930aa3c97cb53f
Cq-Include-Trybots: luci.dart.try: analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148242
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-05-18 12:22:50 +00:00

52 lines
838 B
Dart

// Copyright (c) 2019, 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';
/// Large sample struct for dart:ffi library.
class VeryLargeStruct extends Struct {
@Int8()
external int a;
@Int16()
external int b;
@Int32()
external int c;
@Int64()
external int d;
@Uint8()
external int e;
@Uint16()
external int f;
@Uint32()
external int g;
@Uint64()
external int h;
@IntPtr()
external int i;
@Double()
external double j;
@Float()
external double k;
external Pointer<VeryLargeStruct> parent;
@IntPtr()
external int numChildren;
external Pointer<VeryLargeStruct> children;
@Int8()
external int smallLastField;
}