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