You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// pkg/front_end/testcases/general/field_initializer_capture_this.dart:6:17: Error: Can't access 'this' in a field initializer to read 'x'.
6
+
// var f = () => x; // error
7
+
// ^
8
+
//
9
+
import self as self;
10
+
import "dart:core" as core;
11
+
12
+
class Class extends core::Object {
13
+
field () →* dynamic f = () → dynamic => invalid-expression "pkg/front_end/testcases/general/field_initializer_capture_this.dart:6:17: Error: Can't access 'this' in a field initializer to read 'x'.
14
+
var f = () => x; // error
15
+
^";
16
+
field dynamic x = null;
17
+
synthetic constructor •() → self::Class*
18
+
: super core::Object::•()
19
+
;
20
+
abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
// pkg/front_end/testcases/general/field_initializer_capture_this.dart:6:17: Error: Can't access 'this' in a field initializer to read 'x'.
6
+
// var f = () => x; // error
7
+
// ^
8
+
//
9
+
import self as self;
10
+
import "dart:core" as core;
11
+
12
+
class Class extends core::Object {
13
+
field () →* dynamic f = () → dynamic => invalid-expression "pkg/front_end/testcases/general/field_initializer_capture_this.dart:6:17: Error: Can't access 'this' in a field initializer to read 'x'.
14
+
var f = () => x; // error
15
+
^";
16
+
field dynamic x = null;
17
+
synthetic constructor •() → self::Class*
18
+
: super core::Object::•()
19
+
;
20
+
abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
Copy file name to clipboardExpand all lines: pkg/front_end/testcases/late_lowering/late_final_field_with_initializer.dart.strong.expect
+27-9Lines changed: 27 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,23 @@ import self as self;
3
3
import "dart:core" as core;
4
4
import "dart:_internal" as _in;
5
5
6
+
class B extends core::Object {
7
+
final field core::int x;
8
+
constructor •(core::int x) → self::B
9
+
: self::B::x = x, super core::Object::•()
10
+
;
11
+
}
12
+
class C extends self::B {
13
+
field core::int? _#C#y = null;
14
+
field core::bool _#C#y#isSet = false;
15
+
constructor •(core::int x) → self::C
16
+
: super self::B::•(x)
17
+
;
18
+
get y() → core::int
19
+
return let final core::int? #t1 = this.{self::C::_#C#y} in #t1.==(null) ?{core::int} let final core::int #t2 = this.{self::B::x}.{core::num::+}(1) in this.{self::C::_#C#y}.==(null) ?{core::int} this.{self::C::_#C#y} = #t2 : throw new _in::LateInitializationErrorImpl::•("Field 'y' has been assigned during initialization.") : #t1{core::int};
20
+
method method() → dynamic
21
+
return this.{self::B::x};
22
+
}
6
23
class Class<T extends core::Object? = dynamic> extends core::Object {
7
24
static field core::int? lateStaticField1Init = null;
8
25
static field core::int? _#lateStaticField1 = null;
return let final core::int? #t1 = self::Class::_#lateStaticField1 in #t1.==(null) ?{core::int} let final core::int #t2 = self::Class::initLateStaticField1(87) in self::Class::_#lateStaticField1.==(null) ?{core::int} self::Class::_#lateStaticField1 = #t2 : throw new _in::LateInitializationErrorImpl::•("Field 'lateStaticField1' has been assigned during initialization.") : #t1{core::int};
41
+
return let final core::int? #t3 = self::Class::_#lateStaticField1 in #t3.==(null) ?{core::int} let final core::int #t4 = self::Class::initLateStaticField1(87) in self::Class::_#lateStaticField1.==(null) ?{core::int} self::Class::_#lateStaticField1 = #t4 : throw new _in::LateInitializationErrorImpl::•("Field 'lateStaticField1' has been assigned during initialization.") : #t3{core::int};
return let final core::int? #t3 = self::Class::_#lateStaticField2 in #t3.==(null) ?{core::int} let final core::int #t4 = self::Class::initLateStaticField2(42) in self::Class::_#lateStaticField2.==(null) ?{core::int} self::Class::_#lateStaticField2 = #t4 : throw new _in::LateInitializationErrorImpl::•("Field 'lateStaticField2' has been assigned during initialization.") : #t3{core::int};
46
+
return let final core::int? #t5 = self::Class::_#lateStaticField2 in #t5.==(null) ?{core::int} let final core::int #t6 = self::Class::initLateStaticField2(42) in self::Class::_#lateStaticField2.==(null) ?{core::int} self::Class::_#lateStaticField2 = #t6 : throw new _in::LateInitializationErrorImpl::•("Field 'lateStaticField2' has been assigned during initialization.") : #t5{core::int};
return let final core::int? #t5 = this.{self::Class::_#Class#lateInstanceField} in #t5.==(null) ?{core::int} let final core::int #t6 = this.{self::Class::initLateInstanceField}(16) in this.{self::Class::_#Class#lateInstanceField}.==(null) ?{core::int} this.{self::Class::_#Class#lateInstanceField} = #t6 : throw new _in::LateInitializationErrorImpl::•("Field 'lateInstanceField' has been assigned during initialization.") : #t5{core::int};
56
+
return let final core::int? #t7 = this.{self::Class::_#Class#lateInstanceField} in #t7.==(null) ?{core::int} let final core::int #t8 = this.{self::Class::initLateInstanceField}(16) in this.{self::Class::_#Class#lateInstanceField}.==(null) ?{core::int} this.{self::Class::_#Class#lateInstanceField} = #t8 : throw new _in::LateInitializationErrorImpl::•("Field 'lateInstanceField' has been assigned during initialization.") : #t7{core::int};
return let final core::int? #t9 = self::_#lateTopLevelField1 in #t9.==(null) ?{core::int} let final core::int #t10 = self::initLateTopLevelField1(123) in self::_#lateTopLevelField1.==(null) ?{core::int} self::_#lateTopLevelField1 = #t10 : throw new _in::LateInitializationErrorImpl::•("Field 'lateTopLevelField1' has been assigned during initialization.") : #t9{core::int};
100
+
return let final core::int? #t11 = self::_#lateTopLevelField1 in #t11.==(null) ?{core::int} let final core::int #t12 = self::initLateTopLevelField1(123) in self::_#lateTopLevelField1.==(null) ?{core::int} self::_#lateTopLevelField1 = #t12 : throw new _in::LateInitializationErrorImpl::•("Field 'lateTopLevelField1' has been assigned during initialization.") : #t11{core::int};
static get Extension|lateExtensionField1() → core::int
88
-
return let final core::int? #t11 = self::_#Extension|lateExtensionField1 in #t11.==(null) ?{core::int} let final core::int #t12 = self::Extension|initLateExtensionField1(87) in self::_#Extension|lateExtensionField1.==(null) ?{core::int} self::_#Extension|lateExtensionField1 = #t12 : throw new _in::LateInitializationErrorImpl::•("Field 'lateExtensionField1' has been assigned during initialization.") : #t11{core::int};
105
+
return let final core::int? #t13 = self::_#Extension|lateExtensionField1 in #t13.==(null) ?{core::int} let final core::int #t14 = self::Extension|initLateExtensionField1(87) in self::_#Extension|lateExtensionField1.==(null) ?{core::int} self::_#Extension|lateExtensionField1 = #t14 : throw new _in::LateInitializationErrorImpl::•("Field 'lateExtensionField1' has been assigned during initialization.") : #t13{core::int};
static get Extension|lateExtensionField2() → core::int
93
-
return let final core::int? #t13 = self::_#Extension|lateExtensionField2 in #t13.==(null) ?{core::int} let final core::int #t14 = self::Extension|initLateExtensionField2(42) in self::_#Extension|lateExtensionField2.==(null) ?{core::int} self::_#Extension|lateExtensionField2 = #t14 : throw new _in::LateInitializationErrorImpl::•("Field 'lateExtensionField2' has been assigned during initialization.") : #t13{core::int};
110
+
return let final core::int? #t15 = self::_#Extension|lateExtensionField2 in #t15.==(null) ?{core::int} let final core::int #t16 = self::Extension|initLateExtensionField2(42) in self::_#Extension|lateExtensionField2.==(null) ?{core::int} self::_#Extension|lateExtensionField2 = #t16 : throw new _in::LateInitializationErrorImpl::•("Field 'lateExtensionField2' has been assigned during initialization.") : #t15{core::int};
0 commit comments