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

Unified Diff: tests/compiler/dart2js/closure/data/mixed.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
Index: tests/compiler/dart2js/closure/data/mixed.dart
diff --git a/tests/compiler/dart2js/closure/data/mixed.dart b/tests/compiler/dart2js/closure/data/mixed.dart
new file mode 100644
index 0000000000000000000000000000000000000000..1d4cc15b08efda81723ff54dca34ea517c9e062a
--- /dev/null
+++ b/tests/compiler/dart2js/closure/data/mixed.dart
@@ -0,0 +1,71 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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 that free variables aren't mixed between capturing and non-capturing
+// closures.
+
+/*mutateInClosure:box=box0,boxed=[local]*/
+mutateInClosure() {
+ var /*boxed*/ local;
+ /*free=[box0,local]*/ () {
+ local = 42;
+ };
+ /**/ () {
+ // Use nothing.
+ };
+ return local;
+}
+
+/*mutateOutsideClosure:box=box0,boxed=[local]*/
+mutateOutsideClosure() {
+ var /*boxed*/ local;
+ /*free=[box0,local]*/ () {
+ print(local);
+ };
+ /**/ () {
+ // Use nothing.
+ };
+ local = 42;
+ return local;
+}
+
+/*mutateInOtherClosure:box=box0,boxed=[local]*/
+mutateInOtherClosure() {
+ var /*boxed*/ local;
+ /*free=[box0,local]*/ () {
+ print(local);
+ };
+ /*free=[box0,local]*/ () {
+ local = 42;
+ };
+ /**/ () {
+ // Use nothing.
+ };
+ return local;
+}
+
+/*mutateInNestedClosure:box=box0,boxed=[local]*/
+mutateInNestedClosure() {
+ var /*boxed*/ local;
+ /*free=[box0,local]*/ () {
+ print(local);
+ /*free=[box0,local]*/ () {
+ local = 42;
+ };
+ /**/ () {
+ // Use nothing.
+ };
+ };
+ /**/ () {
+ // Use nothing.
+ };
+ return local;
+}
+
+main() {
+ mutateInClosure();
+ mutateOutsideClosure();
+ mutateInOtherClosure();
+ mutateInNestedClosure();
+}
« no previous file with comments | « tests/compiler/dart2js/closure/closure_test.dart ('k') | tests/compiler/dart2js/closure/data/mutations.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698