File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
_fe_analyzer_shared/test/flow_analysis/definite_unassignment/data
front_end/lib/src/fasta/kernel Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 6
6
// doesn't execute immediately, so it may refer to other late variables that
7
7
// aren't assigned yet.
8
8
9
+ void use (Object ? x) {}
10
+
9
11
eagerInitializerRefersToLateVar () {
10
12
late int x;
11
13
int y = /*unassigned*/ x;
@@ -17,3 +19,9 @@ lateInitializerRefersToLateVar() {
17
19
late int y = x;
18
20
x = 0 ;
19
21
}
22
+
23
+ lateInitializerIsAssignment () {
24
+ late int y;
25
+ late int z1 = y = 3 ;
26
+ use (y);
27
+ }
Original file line number Diff line number Diff line change @@ -2408,11 +2408,12 @@ class BodyBuilder extends ScopeListener<JumpTarget>
2408
2408
assert (assignmentOperator.stringValue == "=" );
2409
2409
AssignedVariablesNodeInfo <VariableDeclaration > assignedVariablesInfo;
2410
2410
bool isLate = (currentLocalVariableModifiers & lateMask) != 0 ;
2411
+ Expression initializer = popForValue ();
2411
2412
if (isLate) {
2412
2413
assignedVariablesInfo = typeInferrer? .assignedVariables
2413
2414
? .deferNode (isClosureOrLateVariableInitializer: true );
2414
2415
}
2415
- pushNewLocalVariable (popForValue () , equalsToken: assignmentOperator);
2416
+ pushNewLocalVariable (initializer , equalsToken: assignmentOperator);
2416
2417
if (isLate) {
2417
2418
VariableDeclaration node = peek ();
2418
2419
// This is matched by the call to [beginNode] in
You can’t perform that action at this time.
0 commit comments