blob: f01903262d738aef94356ff1f465f289fdede410 [file] [log] [blame]
library;
import self as self;
import "dart:core" as core;
static method main() dynamic {
core::int? lateLocalInit;
function initLateLocal(core::int? value) core::int? {
return lateLocalInit = value;
}
final core::int? lateLocal;
core::bool #lateLocal#isSet = false;
function #lateLocal#get() → core::int? {
if(!#lateLocal#isSet) {
#lateLocal#isSet = true;
lateLocal = initLateLocal.call(123);
}
return lateLocal;
}
self::expect(null, lateLocalInit);
self::expect(123, #lateLocal#get.call());
self::expect(123, lateLocalInit);
}
static method expect(dynamic expected, dynamic actual) dynamic {
if(!expected.{core::Object::==}(actual))
throw "Expected ${expected}, actual ${actual}";
}