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 /*readParameterInAnonymousClosure:*/ |
6 readParameterInAnonymousClosure(/**/ parameter) { | 6 readParameterInAnonymousClosure(/**/ parameter) { |
7 return /*free=[parameter]*/ () => parameter; | 7 return /*free=[parameter]*/ () => parameter; |
8 } | 8 } |
9 | 9 |
10 /*readParameterInClosure:*/ | 10 /*readParameterInClosure:*/ |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 class Foo { |
| 66 int /*Foo.bar:hasThis*/ bar = 4; |
| 67 |
| 68 /*Foo.baz:hasThis*/ baz() { |
| 69 /*free=[this],hasThis*/ func() => bar; |
| 70 return func; |
| 71 } |
| 72 } |
| 73 |
65 main() { | 74 main() { |
66 readParameterInAnonymousClosure(null); | 75 readParameterInAnonymousClosure(null); |
67 readParameterInClosure(null); | 76 readParameterInClosure(null); |
68 writeParameterInAnonymousClosure(null); | 77 writeParameterInAnonymousClosure(null); |
69 writeParameterInClosure(null); | 78 writeParameterInClosure(null); |
70 readLocalInAnonymousClosure(null); | 79 readLocalInAnonymousClosure(null); |
71 readLocalInClosure(null); | 80 readLocalInClosure(null); |
72 writeLocalInAnonymousClosure(null); | 81 writeLocalInAnonymousClosure(null); |
73 writeLocalInClosure(null); | 82 writeLocalInClosure(null); |
| 83 new Foo().baz(); |
74 } | 84 } |
OLD | NEW |