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

Side by Side Diff: tests/compiler/dart2js/closure/data/mutations.dart

Issue 3003543002: Add more tests for boxed variables. (Closed)
Patch Set: Created 3 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test that captured variables are boxed regardless of where they are mutated.
6
7 /*mutateUnused:*/
8 mutateUnused() {
9 var local;
10 /**/ () {
11 // Use nothing.
12 };
13 local = 42;
14 return local;
15 }
16
17 /*mutateInClosure:box=box0,boxed=[local]*/
18 mutateInClosure() {
19 var /*boxed*/ local;
20 /*free=[box0,local]*/ () {
21 local = 42;
22 };
23 return local;
24 }
25
26 /*mutateOutsideClosure:box=box0,boxed=[local]*/
27 mutateOutsideClosure() {
28 var /*boxed*/ local;
29 /*free=[box0,local]*/ () {
30 print(local);
31 };
32 local = 42;
33 return local;
34 }
35
36 /*mutateInOtherClosure:box=box0,boxed=[local]*/
37 mutateInOtherClosure() {
38 var /*boxed*/ local;
39 /*free=[box0,local]*/ () {
40 print(local);
41 };
42 /*free=[box0,local]*/ () {
43 local = 42;
44 };
45 return local;
46 }
47
48 /*mutateInNestedClosure:box=box0,boxed=[local]*/
49 mutateInNestedClosure() {
50 var /*boxed*/ local;
51 /*free=[box0,local]*/ () {
52 print(local);
53 /*free=[box0,local]*/ () {
54 local = 42;
55 };
56 };
57 return local;
58 }
59
60 main() {
61 mutateUnused();
62 mutateInClosure();
63 mutateOutsideClosure();
64 mutateInOtherClosure();
65 mutateInNestedClosure();
66 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/closure/data/mixed.dart ('k') | tests/compiler/dart2js/closure/data/nested_closures.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698