Files
sdk/pkg/front_end/testcases/dart2js/late_fields.dart.strong.expect
T
Mayank Patke 76ed8441b9 Add frontend expectations for late variables in dart2js.
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>
2021-04-01 22:58:07 +00:00

57 lines
2.4 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 = null;
field core::int? _#C#b = null;
field core::int? _#C#c = null;
field core::int? _#C#d = null;
synthetic constructor •() → self::C
: super core::Object::•()
;
get a() → core::int
return let final core::int? #t1 = this.{self::C::_#C#a} in #t1 == null ?{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 #t3 == null ?{core::int} throw new _in::LateError::fieldNI("b") : #t3{core::int};
set b(core::int #t4) → void
if(this.{self::C::_#C#b} == null)
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 #t5 == null ?{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 #t7 == null ?{core::int} let final core::int #t8 = 1.{core::int::unary-}(){() → core::int} in this.{self::C::_#C#d} == null ?{core::int} this.{self::C::_#C#d} = #t8 : throw new _in::LateError::fieldADI("d") : #t7{core::int};
}
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});
}