OLD | NEW |
| (Empty) |
1 // Copyright (c) 2015, 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 | |
7 class B { | |
8 B(); | |
9 } | |
10 | |
11 class C { | |
12 C.named(); | |
13 } | |
14 | |
15 class C2 extends C { | |
16 C2.named() : super.named(); | |
17 } | |
18 | |
19 class D { | |
20 D(); | |
21 | |
22 D.named(); | |
23 } | |
24 | |
25 class E { | |
26 String name; | |
27 | |
28 E(this.name); | |
29 } | |
30 | |
31 class F extends E { | |
32 F(String name) : super(name); | |
33 } | |
34 | |
35 class G { | |
36 // default parameters not implemented | |
37 G([String p1]); | |
38 } | |
39 | |
40 class H { | |
41 // default parameters not implemented | |
42 H({String p1}); | |
43 } | |
44 | |
45 class I { | |
46 String name; | |
47 | |
48 I() : name = 'default'; | |
49 | |
50 I.named(this.name); | |
51 } | |
52 | |
53 class J { | |
54 num nonInitialized; | |
55 bool initialized; | |
56 | |
57 J() : initialized = true; | |
58 } | |
59 | |
60 class K { | |
61 String s = 'a'; | |
62 | |
63 K(); | |
64 | |
65 K.withS(this.s); | |
66 } | |
67 | |
68 class L { | |
69 var foo; | |
70 L(this.foo); | |
71 } | |
72 | |
73 class M extends L { | |
74 M.named(int x) : super(x + 42); | |
75 } | |
76 | |
77 class N extends M { | |
78 N.named(int y) : super.named(y + 100); | |
79 } | |
80 | |
81 class P extends N { | |
82 P(int z) : super.named(z + 9000); | |
83 P.foo(int x) : this(x + 42); | |
84 P.bar() : this.foo(1); | |
85 } | |
86 | |
87 class Q<T> { | |
88 T x; | |
89 | |
90 Q(y) : x = y; | |
91 | |
92 static Q foo() => new Q("hello"); | |
93 | |
94 String bar() { | |
95 var q = foo(); | |
96 return q.x; | |
97 } | |
98 | |
99 String bar2() { | |
100 var q = new Q("world"); | |
101 return q.x; | |
102 } | |
103 | |
104 static String baz() { | |
105 var q = new Q<int>(42); | |
106 return q.bar() + q.bar2(); | |
107 } | |
108 } | |
OLD | NEW |