OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 class A { | |
6 // Constructor may not be static. | |
7 static A(); // //# 00: compile-time error | |
8 | |
9 // Factory may not be static. | |
10 static factory A() { return null; } // //# 01: compile-time error | |
11 | |
12 // Named constructor may not conflict with names of methods and fields. | |
13 var m; | |
14 A.m() { m = 0; } // //# 04: compile-time error | |
15 | |
16 set q(var value) { | |
17 m = q; | |
18 } // No name conflict with q=. | |
19 // The runtime error occurs because main calls new A() instead of new A.q(). | |
20 A.q(); // //# 05: runtime error | |
21 | |
22 A.foo() : m = 0; // //# 06: compile-time error | |
23 int foo(int a, int b) => a + b * m; | |
24 } | |
25 | |
26 main() { | |
27 new A(); | |
28 } | |
OLD | NEW |