blob: bb6521e1d6d5d8c28ba17ba355b2091bc12ee45e [file] [log] [blame]
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
import "dart:_internal" as _in;
class Class<T extends core::Object? = dynamic> extends core::Object {
static field core::int? _#lateStaticField1 = null;
static field core::int? _#lateStaticField2 = null;
field core::int? _#Class#lateInstanceField = null;
covariant-by-class field self::Class::T? _#Class#lateGenericInstanceField = null;
field core::bool _#Class#lateGenericInstanceField#isSet = false;
synthetic constructor •() self::Class<self::Class::T%>
: super core::Object::•()
;
static get lateStaticField1() core::int
return let final core::int? #t1 = self::Class::_#lateStaticField1 in #t1 == null ?{core::int} throw new _in::LateError::fieldNI("lateStaticField1") : #t1{core::int};
static set lateStaticField1(core::int lateStaticField1#param) → void
self::Class::_#lateStaticField1 = lateStaticField1#param;
static get lateStaticField2() core::int
return let final core::int? #t2 = self::Class::_#lateStaticField2 in #t2 == null ?{core::int} throw new _in::LateError::fieldNI("lateStaticField2") : #t2{core::int};
static set lateStaticField2(core::int lateStaticField2#param) → void
self::Class::_#lateStaticField2 = lateStaticField2#param;
static method staticMethod() dynamic {
self::throws(() core::int => self::Class::lateStaticField2, "Read value from uninitialized Class.lateStaticField2");
self::Class::lateStaticField2 = 42;
self::expect(42, self::Class::lateStaticField2);
}
get lateInstanceField() core::int
return let final core::int? #t3 = this.{self::Class::_#Class#lateInstanceField}{core::int?} in #t3 == null ?{core::int} throw new _in::LateError::fieldNI("lateInstanceField") : #t3{core::int};
set lateInstanceField(core::int lateInstanceField#param) → void
this.{self::Class::_#Class#lateInstanceField} = lateInstanceField#param;
get lateGenericInstanceField() self::Class::T%
return this.{self::Class::_#Class#lateGenericInstanceField#isSet}{core::bool} ?{self::Class::T%} let final self::Class::T? #t4 = this.{self::Class::_#Class#lateGenericInstanceField}{self::Class::T?} in #t4{self::Class::T%} : throw new _in::LateError::fieldNI("lateGenericInstanceField");
set lateGenericInstanceField(covariant-by-class self::Class::T% lateGenericInstanceField#param) → void {
this.{self::Class::_#Class#lateGenericInstanceField#isSet} = true;
this.{self::Class::_#Class#lateGenericInstanceField} = lateGenericInstanceField#param;
}
method instanceMethod(covariant-by-class self::Class::T% value) dynamic {
self::throws(() core::int => this.{self::Class::lateInstanceField}{core::int}, "Read value from uninitialized Class.lateInstanceField");
this.{self::Class::lateInstanceField} = 16;
self::expect(16, this.{self::Class::lateInstanceField}{core::int});
self::throws(() self::Class::T% => this.{self::Class::lateGenericInstanceField}{self::Class::T%}, "Read value from uninitialized Class.lateGenericInstanceField");
this.{self::Class::lateGenericInstanceField} = value;
self::expect(value, this.{self::Class::lateGenericInstanceField}{self::Class::T%});
}
}
extension Extension<T extends core::Object? = dynamic> on self::Class<T%> {
static field lateExtensionField1 = self::_#Extension|lateExtensionField1;
static get lateExtensionField1 = get self::Extension|lateExtensionField1;
static set lateExtensionField1 = set self::Extension|lateExtensionField1;
static field lateExtensionField2 = self::_#Extension|lateExtensionField2;
static get lateExtensionField2 = get self::Extension|lateExtensionField2;
static set lateExtensionField2 = set self::Extension|lateExtensionField2;
static method staticMethod = self::Extension|staticMethod;
}
static field core::int? _#lateTopLevelField = null;
static field core::int? _#Extension|lateExtensionField1 = null;
static field core::int? _#Extension|lateExtensionField2 = null;
static get lateTopLevelField() core::int
return let final core::int? #t5 = self::_#lateTopLevelField in #t5 == null ?{core::int} throw new _in::LateError::fieldNI("lateTopLevelField") : #t5{core::int};
static set lateTopLevelField(core::int lateTopLevelField#param) → void
self::_#lateTopLevelField = lateTopLevelField#param;
static get Extension|lateExtensionField1() core::int
return let final core::int? #t6 = self::_#Extension|lateExtensionField1 in #t6 == null ?{core::int} throw new _in::LateError::fieldNI("lateExtensionField1") : #t6{core::int};
static set Extension|lateExtensionField1(core::int Extension|lateExtensionField1#param) → void
self::_#Extension|lateExtensionField1 = Extension|lateExtensionField1#param;
static get Extension|lateExtensionField2() core::int
return let final core::int? #t7 = self::_#Extension|lateExtensionField2 in #t7 == null ?{core::int} throw new _in::LateError::fieldNI("lateExtensionField2") : #t7{core::int};
static set Extension|lateExtensionField2(core::int Extension|lateExtensionField2#param) → void
self::_#Extension|lateExtensionField2 = Extension|lateExtensionField2#param;
static method Extension|staticMethod() dynamic {
self::throws(() core::int => self::Extension|lateExtensionField2, "Read value from uninitialized Class.lateExtensionField2");
self::Extension|lateExtensionField2 = 42;
self::expect(42, self::Extension|lateExtensionField2);
}
static method main() dynamic {
self::throws(() core::int => self::lateTopLevelField, "Read value from uninitialized lateTopLevelField");
self::lateTopLevelField = 123;
self::expect(123, self::lateTopLevelField);
self::throws(() core::int => self::Class::lateStaticField1, "Read value from uninitialized Class.lateStaticField1");
self::Class::lateStaticField1 = 87;
self::expect(87, self::Class::lateStaticField1);
self::Class::staticMethod();
new self::Class::•<core::int>().{self::Class::instanceMethod}(0){(core::int) dynamic};
self::Class<core::int> c = new self::Class::•<core::int>();
self::throws(() core::int => c.{self::Class::lateInstanceField}{core::int}, "Read value from uninitialized Class.lateInstanceField");
c.{self::Class::lateInstanceField} = 16;
self::expect(16, c.{self::Class::lateInstanceField}{core::int});
self::throws(() core::int => c.{self::Class::lateGenericInstanceField}{core::int}, "Read value from uninitialized Class.lateGenericInstanceField");
c.{self::Class::lateGenericInstanceField} = 0;
self::expect(0, c.{self::Class::lateGenericInstanceField}{core::int});
self::throws(() core::int => self::Extension|lateExtensionField1, "Read value from uninitialized Extension.lateExtensionField1");
self::Extension|lateExtensionField1 = 87;
self::expect(87, self::Extension|lateExtensionField1);
self::Extension|staticMethod();
}
static method expect(dynamic expected, dynamic actual) dynamic {
if(!(expected =={core::Object::==}{(core::Object) core::bool} actual))
throw "Expected ${expected}, actual ${actual}";
}
static method throws(() dynamic f, core::String message) dynamic {
dynamic value;
try {
value = f(){() dynamic};
}
on core::Error catch(final core::Error e) {
core::print(e);
return;
}
throw "${message}: ${value}";
}