OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Regression test for dart2js issue 6639. | 5 // Regression test for dart2js issue 6639. |
6 | 6 |
7 library inline_super_test; | 7 library inline_super_test; |
| 8 |
8 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
9 | 10 |
10 part 'inline_super_part.dart'; | 11 part 'inline_super_part.dart'; |
11 | 12 |
12 // Long comment to ensure source positions in the following code are | 13 // Long comment to ensure source positions in the following code are |
13 // larger than the part file. Best way to ensure that is to include | 14 // larger than the part file. Best way to ensure that is to include |
14 // the part as a comment: | 15 // the part as a comment: |
15 // | 16 // |
16 // class Player extends LivingActor { | 17 // class Player extends LivingActor { |
17 // Player (deathCallback) : super(null, deathCallback); | 18 // Player (deathCallback) : super(null, deathCallback); |
18 // } | 19 // } |
19 | 20 |
20 class Percept {} | 21 class Percept {} |
21 | 22 |
22 class Actor { | 23 class Actor { |
23 final percept; | 24 final percept; |
24 Actor(this.percept); | 25 Actor(this.percept); |
25 } | 26 } |
26 | 27 |
27 class LivingActor extends Actor { | 28 class LivingActor extends Actor { |
28 // The bug occurs when inlining the node [:new Percept():] into | 29 // The bug occurs when inlining the node [:new Percept():] into |
29 // [Actor]'s constructor. When this inlining is being initiated | 30 // [Actor]'s constructor. When this inlining is being initiated |
30 // from [Player], we must take care to ensure that we know that we | 31 // from [Player], we must take care to ensure that we know that we |
31 // are inlining from this location, and not [Player]. | 32 // are inlining from this location, and not [Player]. |
32 LivingActor () : super(new Percept()); | 33 LivingActor() : super(new Percept()); |
33 } | 34 } |
34 | 35 |
35 main() { | 36 main() { |
36 Expect.isTrue(new Player().percept is Percept); | 37 Expect.isTrue(new Player().percept is Percept); |
37 } | 38 } |
OLD | NEW |