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 | 4 |
5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 // Test the semantics of static members mixed with instance members. | 7 // Test the semantics of static members mixed with instance members. |
8 | 8 |
9 // Following are relevant quotes from Dart Programming Language | 9 // Following are relevant quotes from Dart Programming Language |
10 // Specification, Draft Version 0.10, June 7, 2012. | 10 // Specification, Draft Version 0.10, June 7, 2012. |
11 | 11 |
12 // 7 Classes: | 12 // 7 Classes: |
13 | 13 |
14 // "It is a compile-time error if a class has an instance method and a | 14 // "It is a compile-time error if a class has an instance method and a |
15 // static member method with the same name." | 15 // static member method with the same name." |
16 | 16 |
17 // 7.1 Instance Methods: | 17 // 7.1 Instance Methods: |
18 | 18 |
19 // "Instance methods are functions (6) whose declarations are | 19 // "Instance methods are functions (6) whose declarations are |
20 // immediately contained within a class declaration and that are not | 20 // immediately contained within a class declaration and that are not |
21 // declared static. The instance methods of a class C are those | 21 // declared static. The instance methods of a class C are those |
22 // instance methods declared by C and the instance methods inherited | 22 // instance methods declared by C and the instance methods inherited |
23 // by C from its superclass." | 23 // by C from its superclass." |
24 | 24 |
| 25 |
25 // 7.6 Static Methods | 26 // 7.6 Static Methods |
26 | 27 |
27 // "Static methods are functions whose declarations are immediately | 28 // "Static methods are functions whose declarations are immediately |
28 // contained within a class declaration and that are declared | 29 // contained within a class declaration and that are declared |
29 // static. The static methods of a class C are those static methods | 30 // static. The static methods of a class C are those static methods |
30 // declared by C." | 31 // declared by C." |
31 | 32 |
32 // 7.7 Static Variables | 33 // 7.7 Static Variables |
33 | 34 |
34 // "Static variables are variables whose declarations are immediately | 35 // "Static variables are variables whose declarations are immediately |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 Expect.equals('sub', Sub.m()); | 91 Expect.equals('sub', Sub.m()); |
91 Expect.equals('super', Super.i); | 92 Expect.equals('super', Super.i); |
92 Expect.equals('sub', Sub.i); | 93 Expect.equals('sub', Sub.i); |
93 Expect.equals('super', Super.i2); | 94 Expect.equals('super', Super.i2); |
94 Expect.equals('sub', Sub.i2()); | 95 Expect.equals('sub', Sub.i2()); |
95 Expect.equals('super', new Super().instanceMethod()); | 96 Expect.equals('super', new Super().instanceMethod()); |
96 Expect.equals('sub', new Sub().instanceMethod()); | 97 Expect.equals('sub', new Sub().instanceMethod()); |
97 Expect.equals('super', new Super().instanceMethod2()); | 98 Expect.equals('super', new Super().instanceMethod2()); |
98 Expect.equals('super', new Sub().instanceMethod2()); | 99 Expect.equals('super', new Sub().instanceMethod2()); |
99 } | 100 } |
OLD | NEW |