4a63c9e76f
This is a reland of commit 335d3afb78
Original change's description:
> [cfe] Support external inline class fields
>
> Change-Id: I0c16dc5c32aa8afb285b425c826eee8b8534c734
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278507
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>
Change-Id: Ic93a77d747248bd10b05a1f8119f2725355bd9f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279400
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
56 lines
1.2 KiB
Dart
56 lines
1.2 KiB
Dart
// Copyright (c) 2023, 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.
|
|
|
|
abstract class A {}
|
|
|
|
inline class B {
|
|
final A a;
|
|
|
|
external B(A a);
|
|
|
|
external B.named(int i);
|
|
|
|
external A field;
|
|
|
|
external A method();
|
|
|
|
external T genericMethod<T>(T t);
|
|
|
|
external B get getter;
|
|
|
|
external void set setter(B b);
|
|
|
|
external static A staticField;
|
|
|
|
external static A staticMethod();
|
|
|
|
external static T staticGenericMethod<T>(T t);
|
|
|
|
external static B get staticGetter;
|
|
|
|
external static void set staticSetter(B b);
|
|
}
|
|
|
|
void method(A a) {
|
|
B b1 = new B(a);
|
|
B b2 = new B.named(0);
|
|
a = b1.field;
|
|
b1.field = a;
|
|
a = b1.method();
|
|
var f1 = b1.method;
|
|
b2 = b2.genericMethod(b2);
|
|
var f2 = b2.genericMethod;
|
|
int Function(int) f3 = b2.genericMethod;
|
|
b1 = b2.getter;
|
|
b1.setter = b2;
|
|
a = B.staticField;
|
|
B.staticField = a;
|
|
a = B.staticMethod();
|
|
var f4 = B.staticMethod;
|
|
b2 = B.staticGenericMethod(b2);
|
|
var f5 = B.staticGenericMethod;
|
|
String Function(String) f6 = B.staticGenericMethod;
|
|
b1 = B.staticGetter;
|
|
B.staticSetter = b2;
|
|
} |