5c51990a80
Closes #43174 Change-Id: I6b1cc04cbf2d65d9b877dfabf3e0f535f2491a94 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168542 Reviewed-by: Dmitry Stefantsov <dmitryas@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
50 lines
1.2 KiB
Plaintext
50 lines
1.2 KiB
Plaintext
library /*isNonNullableByDefault*/;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
class C extends core::Object {
|
|
static field core::String? _#s = null;
|
|
static field core::bool _#s#isSet = false;
|
|
synthetic constructor •() → self::C
|
|
: super core::Object::•()
|
|
;
|
|
static get s() → core::String? {
|
|
if(!self::C::_#s#isSet) {
|
|
self::C::_#s = self::init("lateValue");
|
|
self::C::_#s#isSet = true;
|
|
}
|
|
return self::C::_#s;
|
|
}
|
|
static set s(core::String? #t1) → void {
|
|
self::C::_#s#isSet = true;
|
|
self::C::_#s = #t1;
|
|
}
|
|
}
|
|
static field core::bool _called = false;
|
|
static method init(core::String val) → core::String {
|
|
if(!self::_called) {
|
|
self::_called = true;
|
|
throw core::Exception::•();
|
|
}
|
|
return val;
|
|
}
|
|
static method main() → dynamic {
|
|
self::throws(() → void {
|
|
self::C::s;
|
|
});
|
|
self::expect("lateValue", self::C::s);
|
|
}
|
|
static method expect(dynamic expected, dynamic actual) → dynamic {
|
|
if(!expected.{core::Object::==}(actual))
|
|
throw "Expected ${expected}, actual ${actual}";
|
|
}
|
|
static method throws(() → void f) → dynamic {
|
|
try {
|
|
f.call();
|
|
}
|
|
on core::Object catch(final core::Object _) {
|
|
return;
|
|
}
|
|
throw "Expected exception";
|
|
}
|