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

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

Issue 3007903002: Support annotations on assignment and postfix operations (Closed)
Patch Set: Updated cf. comments 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
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Test that captured variables are boxed regardless of where they are mutated. 5 // Test that captured variables are boxed regardless of where they are mutated.
6 6
7 /*mutateUnused:*/ 7 /*element: mutateUnused:*/
8 mutateUnused() { 8 mutateUnused() {
9 var localVar; 9 var localVar;
10 /**/ () { 10 /**/ () {
11 // Use nothing. 11 // Use nothing.
12 }; 12 };
13 localVar = 42; 13 localVar = 42;
14 return localVar; 14 return localVar;
15 } 15 }
16 16
17 /*mutateInClosure:box=(box0 which holds [localVar])*/ 17 /*element: mutateInClosure:box=(box0 which holds [localVar])*/
18 mutateInClosure() { 18 mutateInClosure() {
19 var /*boxed*/ localVar; 19 var /*boxed*/ localVar;
20 /*free=[box0,localVar]*/ () { 20 /*free=[box0,localVar]*/ () {
21 localVar = 43; 21 localVar = 43;
22 }; 22 };
23 return localVar; 23 return localVar;
24 } 24 }
25 25
26 /*mutateOutsideClosure:box=(box0 which holds [localVar])*/ 26 /*element: mutateOutsideClosure:box=(box0 which holds [localVar])*/
27 mutateOutsideClosure() { 27 mutateOutsideClosure() {
28 var /*boxed*/ localVar; 28 var /*boxed*/ localVar;
29 /*free=[box0,localVar]*/ () { 29 /*free=[box0,localVar]*/ () {
30 print(localVar); 30 print(localVar);
31 }; 31 };
32 localVar = 44; 32 localVar = 44;
33 return localVar; 33 return localVar;
34 } 34 }
35 35
36 /*mutateInOtherClosure:box=(box0 which holds [localVar])*/ 36 /*element: mutateInOtherClosure:box=(box0 which holds [localVar])*/
37 mutateInOtherClosure() { 37 mutateInOtherClosure() {
38 var /*boxed*/ localVar; 38 var /*boxed*/ localVar;
39 /*free=[box0,localVar]*/ () { 39 /*free=[box0,localVar]*/ () {
40 print(localVar); 40 print(localVar);
41 }; 41 };
42 /*free=[box0,localVar]*/ () { 42 /*free=[box0,localVar]*/ () {
43 localVar = 45; 43 localVar = 45;
44 }; 44 };
45 return localVar; 45 return localVar;
46 } 46 }
47 47
48 /*mutateInNestedClosure:box=(box0 which holds [localVar])*/ 48 /*element: mutateInNestedClosure:box=(box0 which holds [localVar])*/
49 mutateInNestedClosure() { 49 mutateInNestedClosure() {
50 var /*boxed*/ localVar; 50 var /*boxed*/ localVar;
51 /*free=[box0,localVar]*/ () { 51 /*free=[box0,localVar]*/ () {
52 print(localVar); 52 print(localVar);
53 /*free=[box0,localVar]*/ () { 53 /*free=[box0,localVar]*/ () {
54 localVar = 46; 54 localVar = 46;
55 }; 55 };
56 }; 56 };
57 return localVar; 57 return localVar;
58 } 58 }
59 59
60 main() { 60 main() {
61 mutateUnused(); 61 mutateUnused();
62 mutateInClosure(); 62 mutateInClosure();
63 mutateOutsideClosure(); 63 mutateOutsideClosure();
64 mutateInOtherClosure(); 64 mutateInOtherClosure();
65 mutateInNestedClosure(); 65 mutateInNestedClosure();
66 } 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