| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 class B { | 7 class B { |
| 8 final z; | 8 final z; |
| 9 B(this.z); | 9 B(this.z); |
| 10 | 10 |
| 11 foo() => this.z; | 11 foo() => this.z; |
| 12 } | 12 } |
| 13 | 13 |
| 14 class A<T> extends B { | 14 class A<T> extends B { |
| 15 var captured, captured2; | 15 var captured, captured2; |
| 16 var typedList; | 16 var typedList; |
| 17 | 17 |
| 18 // p must be inside a box (in dart2js). | 18 // p must be inside a box (in dart2js). |
| 19 A(p) : captured = (() => p), super(p++) { | 19 A(p) |
| 20 : captured = (() => p), |
| 21 super(p++) { |
| 20 // Make non-inlinable. | 22 // Make non-inlinable. |
| 21 try {} catch(e) {} | 23 try {} catch (e) {} |
| 22 | 24 |
| 23 captured2 = () => p++; | 25 captured2 = () => p++; |
| 24 | 26 |
| 25 // In the current implementation of dart2js makes the generic type an | 27 // In the current implementation of dart2js makes the generic type an |
| 26 // argument to the body. | 28 // argument to the body. |
| 27 typedList = <T>[]; | 29 typedList = <T>[]; |
| 28 } | 30 } |
| 29 | 31 |
| 30 foo() => captured(); | 32 foo() => captured(); |
| 31 bar() => captured2(); | 33 bar() => captured2(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 56 Expect.equals(0, a.typedList.length); | 58 Expect.equals(0, a.typedList.length); |
| 57 Expect.equals(0, a2.typedList.length); | 59 Expect.equals(0, a2.typedList.length); |
| 58 a.typedList.add(499); | 60 a.typedList.add(499); |
| 59 Expect.equals(1, a.typedList.length); | 61 Expect.equals(1, a.typedList.length); |
| 60 Expect.equals(0, a2.typedList.length); | 62 Expect.equals(0, a2.typedList.length); |
| 61 Expect.isTrue(a.typedList is List<int>); | 63 Expect.isTrue(a.typedList is List<int>); |
| 62 Expect.isTrue(a2.typedList is List<int>); | 64 Expect.isTrue(a2.typedList is List<int>); |
| 63 Expect.isFalse(a.typedList is List<String>); | 65 Expect.isFalse(a.typedList is List<String>); |
| 64 Expect.isTrue(a2.typedList is List<String>); | 66 Expect.isTrue(a2.typedList is List<String>); |
| 65 } | 67 } |
| OLD | NEW |