Files
sdk/pkg/front_end/testcases/late_lowering/issue40805.dart.weak.expect
T
Johnni Winther 0609c6dacc [cfe] Add predefined constructors for late error messages
This CL adds predefined constructors to LateInitializationErrorImpl that
only take the name of the late field/variable as argument. This can reduce
the size of the generated code for ddc/dart2js size because the long
message isn't repeated at all call sites.

In response to #43995

Change-Id: Ie276dd1455feab1655da3a503856da425b20f04f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169883
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-11-03 12:47:06 +00:00

33 lines
992 B
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#x = null;
field core::bool _#C#x#isSet = false;
synthetic constructor •() → self::C
: super core::Object::•()
;
get x() → core::int
return this.{self::C::_#C#x#isSet} ?{core::int} let final core::int? #t1 = this.{self::C::_#C#x} in #t1{core::int} : throw new _in::LateError::fieldNI("x");
set x(covariant core::int #t2) → void
if(this.{self::C::_#C#x#isSet})
throw new _in::LateError::fieldAI("x");
else {
this.{self::C::_#C#x#isSet} = true;
this.{self::C::_#C#x} = #t2;
}
}
class D extends self::C {
synthetic constructor •() → self::D
: super self::C::•()
;
set x(covariant core::num value) → void {
super.{self::C::x} = value.{core::num::toInt}();
}
}
static method main() → dynamic {
new self::D::•().{self::D::x} = 3.14;
}