OLD | NEW |
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 /*readParameterInAnonymousClosure:*/ | 5 /*element: readParameterInAnonymousClosure:*/ |
6 readParameterInAnonymousClosure(/**/ parameter) { | 6 readParameterInAnonymousClosure(/**/ parameter) { |
7 return /*free=[parameter]*/ () => parameter; | 7 return /*free=[parameter]*/ () => parameter; |
8 } | 8 } |
9 | 9 |
10 /*readParameterInClosure:*/ | 10 /*element: readParameterInClosure:*/ |
11 readParameterInClosure(/**/ parameter) { | 11 readParameterInClosure(/**/ parameter) { |
12 /*free=[parameter]*/ func() => parameter; | 12 /*free=[parameter]*/ func() => parameter; |
13 return func; | 13 return func; |
14 } | 14 } |
15 | 15 |
16 /*writeParameterInAnonymousClosure:box=(box0 which holds [parameter])*/ | 16 /*element: writeParameterInAnonymousClosure:box=(box0 which holds [parameter])*/ |
17 writeParameterInAnonymousClosure(/*boxed*/ parameter) { | 17 writeParameterInAnonymousClosure(/*boxed*/ parameter) { |
18 return /*free=[box0,parameter]*/ () { | 18 return /*free=[box0,parameter]*/ () { |
19 parameter = 42; | 19 parameter = 42; |
20 }; | 20 }; |
21 } | 21 } |
22 | 22 |
23 /*writeParameterInClosure:box=(box0 which holds [parameter])*/ | 23 /*element: writeParameterInClosure:box=(box0 which holds [parameter])*/ |
24 writeParameterInClosure(/*boxed*/ parameter) { | 24 writeParameterInClosure(/*boxed*/ parameter) { |
25 /*free=[box0,parameter]*/ func() { | 25 /*free=[box0,parameter]*/ func() { |
26 parameter = 43; | 26 parameter = 43; |
27 } | 27 } |
28 | 28 |
29 return func; | 29 return func; |
30 } | 30 } |
31 | 31 |
32 /*readLocalInAnonymousClosure:*/ | 32 /*element: readLocalInAnonymousClosure:*/ |
33 readLocalInAnonymousClosure(/**/ parameter) { | 33 readLocalInAnonymousClosure(/**/ parameter) { |
34 var /**/ local = parameter; | 34 var /**/ local = parameter; |
35 return /*free=[local]*/ () => local; | 35 return /*free=[local]*/ () => local; |
36 } | 36 } |
37 | 37 |
38 /*readLocalInClosure:*/ | 38 /*element: readLocalInClosure:*/ |
39 readLocalInClosure(/**/ parameter) { | 39 readLocalInClosure(/**/ parameter) { |
40 var /**/ local = parameter; | 40 var /**/ local = parameter; |
41 /*free=[local]*/ func() => local; | 41 /*free=[local]*/ func() => local; |
42 return func; | 42 return func; |
43 } | 43 } |
44 | 44 |
45 /*writeLocalInAnonymousClosure:box=(box0 which holds [local])*/ | 45 /*element: writeLocalInAnonymousClosure:box=(box0 which holds [local])*/ |
46 writeLocalInAnonymousClosure(/**/ parameter) { | 46 writeLocalInAnonymousClosure(/**/ parameter) { |
47 // ignore: UNUSED_LOCAL_VARIABLE | 47 // ignore: UNUSED_LOCAL_VARIABLE |
48 var /*boxed*/ local = parameter; | 48 var /*boxed*/ local = parameter; |
49 return /*free=[box0,local]*/ () { | 49 return /*free=[box0,local]*/ () { |
50 local = 44; | 50 local = 44; |
51 }; | 51 }; |
52 } | 52 } |
53 | 53 |
54 /*writeLocalInClosure:box=(box0 which holds [local])*/ | 54 /*element: writeLocalInClosure:box=(box0 which holds [local])*/ |
55 writeLocalInClosure(/**/ parameter) { | 55 writeLocalInClosure(/**/ parameter) { |
56 // ignore: UNUSED_LOCAL_VARIABLE | 56 // ignore: UNUSED_LOCAL_VARIABLE |
57 var /*boxed*/ local = parameter; | 57 var /*boxed*/ local = parameter; |
58 /*free=[box0,local]*/ func() { | 58 /*free=[box0,local]*/ func() { |
59 local = 45; | 59 local = 45; |
60 } | 60 } |
61 | 61 |
62 return func; | 62 return func; |
63 } | 63 } |
64 | 64 |
65 main() { | 65 main() { |
66 readParameterInAnonymousClosure(null); | 66 readParameterInAnonymousClosure(null); |
67 readParameterInClosure(null); | 67 readParameterInClosure(null); |
68 writeParameterInAnonymousClosure(null); | 68 writeParameterInAnonymousClosure(null); |
69 writeParameterInClosure(null); | 69 writeParameterInClosure(null); |
70 readLocalInAnonymousClosure(null); | 70 readLocalInAnonymousClosure(null); |
71 readLocalInClosure(null); | 71 readLocalInClosure(null); |
72 writeLocalInAnonymousClosure(null); | 72 writeLocalInAnonymousClosure(null); |
73 writeLocalInClosure(null); | 73 writeLocalInClosure(null); |
74 } | 74 } |
OLD | NEW |