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

Unified Diff: tests/compiler/dart2js/closure/data/nested_closures.dart

Issue 3003543002: Add more tests for boxed variables. (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « tests/compiler/dart2js/closure/data/mutations.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/closure/data/nested_closures.dart
diff --git a/tests/compiler/dart2js/closure/data/nested_closures.dart b/tests/compiler/dart2js/closure/data/nested_closures.dart
index 37e4e8d22c31650eb8166d08d5ae2223b51e819a..4ba90f5bac2485cf4946018182a0b0cea1029fa0 100644
--- a/tests/compiler/dart2js/closure/data/nested_closures.dart
+++ b/tests/compiler/dart2js/closure/data/nested_closures.dart
@@ -2,7 +2,35 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*test:box=box0,boxed=[b1,b2,b3]*/ test(c1, /*boxed*/ b1) {
+/// Test boxing/captures for nested closures.
+
+/*useOne:box=box0,boxed=[b1]*/ useOne(/*boxed*/ b1) {
+ /*box=box1,boxed=[b2],free=[b1,box0]*/ () {
+ var /*boxed*/ b2 = (b1 = 1);
+
+ /*free=[b2,box1]*/ () {
+ return (b2 = 2);
+ };
+
+ return b2;
+ };
+ return b1;
+}
+
+/*useBoth:box=box0,boxed=[b1]*/ useBoth(/*boxed*/ b1) {
+ /*box=box1,boxed=[b2],free=[b1,box0]*/ () {
+ var /*boxed*/ b2 = (b1 = 1);
+
+ /*free=[b1,b2,box0,box1]*/ () {
+ return b1 + (b2 = 2);
+ };
+
+ return b2;
+ };
+ return b1;
+}
+
+/*useMany:box=box0,boxed=[b1,b2,b3]*/ useMany(c1, /*boxed*/ b1) {
var /*boxed*/ b2 = 2;
var /*boxed*/ b3 = 3;
var c2 = 2;
@@ -21,5 +49,7 @@
}
main() {
- test(1, 2);
+ useOne(1);
+ useBoth(1);
+ useMany(1, 2);
}
« no previous file with comments | « tests/compiler/dart2js/closure/data/mutations.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698