| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Dart test for testing super field access. | 4 // Dart test for testing super field access. |
| 5 | 5 |
| 6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 | 7 import "package:meta/meta.dart" show virtual; |
| 8 | 8 |
| 9 class A { | 9 class A { |
| 10 A() { | 10 A() { |
| 11 city = "Bern"; | 11 city = "Bern"; |
| 12 } | 12 } |
| 13 String greeting() { | 13 String greeting() { |
| 14 return "Gruezi"; | 14 return "Gruezi"; |
| 15 } | 15 } |
| 16 String city; | 16 @virtual String city; |
| 17 } | 17 } |
| 18 | 18 |
| 19 | 19 |
| 20 class B extends A { | 20 class B extends A { |
| 21 B() : super() {} | 21 B() : super() {} |
| 22 String greeting() { | 22 String greeting() { |
| 23 return "Hola " + super.greeting(); | 23 return "Hola " + super.greeting(); |
| 24 } | 24 } |
| 25 } | 25 } |
| 26 | 26 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 49 Expect.equals("Bern", b.city); | 49 Expect.equals("Bern", b.city); |
| 50 Expect.equals("Basel Bern", c.city); | 50 Expect.equals("Basel Bern", c.city); |
| 51 c.city = "Zurich"; | 51 c.city = "Zurich"; |
| 52 Expect.equals("Basel Zurich", c.city); | 52 Expect.equals("Basel Zurich", c.city); |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 main() { | 56 main() { |
| 57 SuperFieldTest.testMain(); | 57 SuperFieldTest.testMain(); |
| 58 } | 58 } |
| OLD | NEW |