76ed8441b9
Change-Id: I718ba69d31d44f30bb52157e87ebc64316bf860b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193586 Commit-Queue: Mayank Patke <fishythefish@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Reviewed-by: Stephen Adams <sra@google.com>
57 lines
2.5 KiB
Plaintext
57 lines
2.5 KiB
Plaintext
library /*isNonNullableByDefault*/;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
import "dart:_internal" as _in;
|
|
|
|
class C extends core::Object {
|
|
field core::int? _#C#a = _in::createSentinel<core::int>();
|
|
field core::int? _#C#b = _in::createSentinel<core::int>();
|
|
field core::int? _#C#c = _in::createSentinel<core::int>();
|
|
field core::int? _#C#d = _in::createSentinel<core::int>();
|
|
synthetic constructor •() → self::C
|
|
: super core::Object::•()
|
|
;
|
|
get a() → core::int
|
|
return let final core::int? #t1 = this.{self::C::_#C#a} in _in::isSentinel(#t1) ?{core::int} throw new _in::LateError::fieldNI("a") : #t1{core::int};
|
|
set a(core::int #t2) → void
|
|
this.{self::C::_#C#a} = #t2;
|
|
get b() → core::int
|
|
return let final core::int? #t3 = this.{self::C::_#C#b} in _in::isSentinel(#t3) ?{core::int} throw new _in::LateError::fieldNI("b") : #t3{core::int};
|
|
set b(core::int #t4) → void
|
|
if(_in::isSentinel(this.{self::C::_#C#b}))
|
|
this.{self::C::_#C#b} = #t4;
|
|
else
|
|
throw new _in::LateError::fieldAI("b");
|
|
get c() → core::int
|
|
return let final core::int? #t5 = this.{self::C::_#C#c} in _in::isSentinel(#t5) ?{core::int} this.{self::C::_#C#c} = 1.{core::int::unary-}(){() → core::int} : #t5{core::int};
|
|
set c(core::int #t6) → void
|
|
this.{self::C::_#C#c} = #t6;
|
|
get d() → core::int
|
|
return let final core::int #t7 = this.{self::C::_#C#d} in _in::isSentinel(#t7) ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in _in::isSentinel(this.{self::C::_#C#d}) ?{core::int} this.{self::C::_#C#d} = #t8 : throw new _in::LateError::fieldADI("d") : #t7;
|
|
}
|
|
static field self::C c = new self::C::•();
|
|
static method main() → void {
|
|
self::testUninitializedNonFinalInstanceField();
|
|
self::testUninitializedFinalInstanceField();
|
|
self::testInitializedNonFinalInstanceField();
|
|
self::testInitializedFinalInstanceField();
|
|
}
|
|
static method testUninitializedNonFinalInstanceField() → void {
|
|
core::print(self::c.{self::C::a}{core::int});
|
|
self::c.{self::C::a} = 42;
|
|
core::print(self::c.{self::C::a}{core::int});
|
|
}
|
|
static method testUninitializedFinalInstanceField() → void {
|
|
core::print(self::c.{self::C::b}{core::int});
|
|
self::c.{self::C::b} = 42;
|
|
core::print(self::c.{self::C::b}{core::int});
|
|
}
|
|
static method testInitializedNonFinalInstanceField() → void {
|
|
core::print(self::c.{self::C::c}{core::int});
|
|
self::c.{self::C::c} = 42;
|
|
core::print(self::c.{self::C::c}{core::int});
|
|
}
|
|
static method testInitializedFinalInstanceField() → void {
|
|
core::print(self::c.{self::C::d}{core::int});
|
|
}
|