OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 we give up on tracing a function if one of its closurizations | 5 // Test that we give up on tracing a function if one of its closurizations |
6 // escapes tracing. | 6 // escapes tracing. |
7 | 7 |
8 class A { | 8 class A { |
9 var _boo = 22; | 9 var _boo = 22; |
10 get boo { | 10 get boo { |
11 return _boo; | 11 return _boo; |
12 return 1; | 12 return 1; |
13 } | 13 } |
14 } | 14 } |
15 | 15 |
16 class B { | 16 class B { |
17 var _bar = 42; | 17 var _bar = 42; |
18 get boo { | 18 get boo { |
19 return _bar; | 19 return _bar; |
20 return 1; | 20 return 1; |
21 } | 21 } |
22 } | 22 } |
23 | 23 |
24 class Holder { | 24 class Holder { |
25 tearMe(x) => x.boo; | 25 tearMe(x) => x.boo; |
26 } | 26 } |
27 | 27 |
28 var list = []; | 28 var list = []; |
29 | 29 |
30 main () { | 30 main() { |
31 var holder = new Holder(); | 31 var holder = new Holder(); |
32 var hide = ((X) => X)(holder.tearMe); | 32 var hide = ((X) => X)(holder.tearMe); |
33 hide(new A()); | 33 hide(new A()); |
34 list.add(holder.tearMe); | 34 list.add(holder.tearMe); |
35 var x = list[0]; | 35 var x = list[0]; |
36 x(new B()); | 36 x(new B()); |
37 } | 37 } |
OLD | NEW |