mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:11:19 +00:00
36641368bb
This changes ast-to-text to mark legacy libraries instead of non-nullable-by-default libraries. TEST=existing Change-Id: Ib01147e4ef48c2c5b2ffc6b23547998344dfdf2e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307121 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com>
45 lines
1.5 KiB
Plaintext
45 lines
1.5 KiB
Plaintext
library;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
import "dart:_internal" as _in;
|
|
|
|
class C extends core::Object {
|
|
field core::num pi = 3.14;
|
|
field core::num? _#C#p1 = null;
|
|
field core::bool _#C#p1#isSet = false;
|
|
field core::num? _#C#p2 = null;
|
|
field core::bool _#C#p2#isSet = false;
|
|
synthetic constructor •() → self::C
|
|
: super core::Object::•()
|
|
;
|
|
get p1() → core::num {
|
|
if(!this.{self::C::_#C#p1#isSet}{core::bool}) {
|
|
this.{self::C::_#C#p1} = this.{self::C::pi}{core::num};
|
|
this.{self::C::_#C#p1#isSet} = true;
|
|
}
|
|
return let final core::num? #t1 = this.{self::C::_#C#p1}{core::num?} in #t1{core::num};
|
|
}
|
|
set p1(core::num p1#param) → void {
|
|
this.{self::C::_#C#p1#isSet} = true;
|
|
this.{self::C::_#C#p1} = p1#param;
|
|
}
|
|
get p2() → core::num {
|
|
if(!this.{self::C::_#C#p2#isSet}{core::bool}) {
|
|
final core::num #t2 = this.{self::C::pi}{core::num};
|
|
if(this.{self::C::_#C#p2#isSet}{core::bool})
|
|
throw new _in::LateError::fieldADI("p2");
|
|
this.{self::C::_#C#p2} = #t2;
|
|
this.{self::C::_#C#p2#isSet} = true;
|
|
}
|
|
return let final core::num? #t3 = this.{self::C::_#C#p2}{core::num?} in #t3{core::num};
|
|
}
|
|
}
|
|
static method main() → dynamic {
|
|
self::expect(3.14, new self::C::•().{self::C::p1}{core::num});
|
|
self::expect(3.14, new self::C::•().{self::C::p2}{core::num});
|
|
}
|
|
static method expect(dynamic expected, dynamic actual) → dynamic {
|
|
if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual))
|
|
throw "Expected ${expected}, actual ${actual}";
|
|
}
|