Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1375)

Unified Diff: tests/language/if_null_assignment_behavior_test.dart

Issue 1062723002: Implement the new '?.' operator in analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Bump analyzer version. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/language/if_null_assignment_behavior_test.dart
diff --git a/tests/language/if_null_assignment_behavior_test.dart b/tests/language/if_null_assignment_behavior_test.dart
index a5ab550fb043e8671e204e3ec4de87b47279185f..548d94ace8e8b8a5973d4c278db1a171813befe7 100644
--- a/tests/language/if_null_assignment_behavior_test.dart
+++ b/tests/language/if_null_assignment_behavior_test.dart
@@ -194,4 +194,11 @@ main() {
check(2, () => x[y] ??= bad(), ['x', 'y', 'x[1]']); /// 24: continued
xGetValue = new C('x'); yGetValue = 1; zGetValue = 2; /// 25: ok
check(2, () => x[y] ??= z, ['x', 'y', 'x[1]', 'z', 'x[1]=2']); /// 25: continued
+
+ // e1?.v ??= e2 is equivalent to ((x) => x == null ? null : x.v ??= e2)(e1).
+ check(null, () => x?.v ??= bad(), ['x']); /// 26: ok
+ xGetValue = new C('x'); xGetValue.vGetValue = 1; /// 27: ok
+ check(1, () => x?.v ??= bad(), ['x', 'x.v']); /// 27: continued
+ xGetValue = new C('x'); yGetValue = 1; /// 28: ok
+ check(1, () => x?.v ??= y, ['x', 'x.v', 'y', 'x.v=1']); /// 28: continued
}

Powered by Google App Engine
This is Rietveld 408576698