OLD | NEW |
1 dart_library.library('constructors', null, /* Imports */[ | 1 dart_library.library('constructors', null, /* Imports */[ |
2 'dart/_runtime', | 2 'dart_sdk' |
3 'dart/core' | 3 ], function(exports, dart_sdk) { |
4 ], /* Lazy imports */[ | |
5 ], function(exports, dart, core) { | |
6 'use strict'; | 4 'use strict'; |
7 let dartx = dart.dartx; | 5 const core = dart_sdk.core; |
8 class A extends core.Object {} | 6 const dart = dart_sdk.dart; |
9 class B extends core.Object { | 7 const dartx = dart_sdk.dartx; |
| 8 const constructors = Object.create(null); |
| 9 constructors.A = class A extends core.Object {}; |
| 10 constructors.B = class B extends core.Object { |
10 B() { | 11 B() { |
11 } | 12 } |
12 } | 13 }; |
13 dart.setSignature(B, { | 14 dart.setSignature(constructors.B, { |
14 constructors: () => ({B: [B, []]}) | 15 constructors: () => ({B: [constructors.B, []]}) |
15 }); | 16 }); |
16 class C extends core.Object { | 17 constructors.C = class C extends core.Object { |
17 named() { | 18 named() { |
18 } | 19 } |
19 } | 20 }; |
20 dart.defineNamedConstructor(C, 'named'); | 21 dart.defineNamedConstructor(constructors.C, 'named'); |
21 dart.setSignature(C, { | 22 dart.setSignature(constructors.C, { |
22 constructors: () => ({named: [C, []]}) | 23 constructors: () => ({named: [constructors.C, []]}) |
23 }); | 24 }); |
24 class C2 extends C { | 25 constructors.C2 = class C2 extends constructors.C { |
25 named() { | 26 named() { |
26 super.named(); | 27 super.named(); |
27 } | 28 } |
28 } | 29 }; |
29 dart.defineNamedConstructor(C2, 'named'); | 30 dart.defineNamedConstructor(constructors.C2, 'named'); |
30 dart.setSignature(C2, { | 31 dart.setSignature(constructors.C2, { |
31 constructors: () => ({named: [C2, []]}) | 32 constructors: () => ({named: [constructors.C2, []]}) |
32 }); | 33 }); |
33 class D extends core.Object { | 34 constructors.D = class D extends core.Object { |
34 D() { | 35 D() { |
35 } | 36 } |
36 named() { | 37 named() { |
37 } | 38 } |
38 } | 39 }; |
39 dart.defineNamedConstructor(D, 'named'); | 40 dart.defineNamedConstructor(constructors.D, 'named'); |
40 dart.setSignature(D, { | 41 dart.setSignature(constructors.D, { |
41 constructors: () => ({ | 42 constructors: () => ({ |
42 D: [D, []], | 43 D: [constructors.D, []], |
43 named: [D, []] | 44 named: [constructors.D, []] |
44 }) | 45 }) |
45 }); | 46 }); |
46 class E extends core.Object { | 47 constructors.E = class E extends core.Object { |
47 E(name) { | 48 E(name) { |
48 this.name = name; | 49 this.name = name; |
49 } | 50 } |
50 } | 51 }; |
51 dart.setSignature(E, { | 52 dart.setSignature(constructors.E, { |
52 constructors: () => ({E: [E, [core.String]]}) | 53 constructors: () => ({E: [constructors.E, [core.String]]}) |
53 }); | 54 }); |
54 class F extends E { | 55 constructors.F = class F extends constructors.E { |
55 F(name) { | 56 F(name) { |
56 super.E(name); | 57 super.E(name); |
57 } | 58 } |
58 } | 59 }; |
59 dart.setSignature(F, { | 60 dart.setSignature(constructors.F, { |
60 constructors: () => ({F: [F, [core.String]]}) | 61 constructors: () => ({F: [constructors.F, [core.String]]}) |
61 }); | 62 }); |
62 class G extends core.Object { | 63 constructors.G = class G extends core.Object { |
63 G(p1) { | 64 G(p1) { |
64 if (p1 === void 0) p1 = null; | 65 if (p1 === void 0) p1 = null; |
65 } | 66 } |
66 } | 67 }; |
67 dart.setSignature(G, { | 68 dart.setSignature(constructors.G, { |
68 constructors: () => ({G: [G, [], [core.String]]}) | 69 constructors: () => ({G: [constructors.G, [], [core.String]]}) |
69 }); | 70 }); |
70 class H extends core.Object { | 71 constructors.H = class H extends core.Object { |
71 H(opts) { | 72 H(opts) { |
72 let p1 = opts && 'p1' in opts ? opts.p1 : null; | 73 let p1 = opts && 'p1' in opts ? opts.p1 : null; |
73 } | 74 } |
74 } | 75 }; |
75 dart.setSignature(H, { | 76 dart.setSignature(constructors.H, { |
76 constructors: () => ({H: [H, [], {p1: core.String}]}) | 77 constructors: () => ({H: [constructors.H, [], {p1: core.String}]}) |
77 }); | 78 }); |
78 class I extends core.Object { | 79 constructors.I = class I extends core.Object { |
79 I() { | 80 I() { |
80 this.name = 'default'; | 81 this.name = 'default'; |
81 } | 82 } |
82 named(name) { | 83 named(name) { |
83 this.name = name; | 84 this.name = name; |
84 } | 85 } |
85 } | 86 }; |
86 dart.defineNamedConstructor(I, 'named'); | 87 dart.defineNamedConstructor(constructors.I, 'named'); |
87 dart.setSignature(I, { | 88 dart.setSignature(constructors.I, { |
88 constructors: () => ({ | 89 constructors: () => ({ |
89 I: [I, []], | 90 I: [constructors.I, []], |
90 named: [I, [core.String]] | 91 named: [constructors.I, [core.String]] |
91 }) | 92 }) |
92 }); | 93 }); |
93 class J extends core.Object { | 94 constructors.J = class J extends core.Object { |
94 J() { | 95 J() { |
95 this.initialized = true; | 96 this.initialized = true; |
96 this.nonInitialized = null; | 97 this.nonInitialized = null; |
97 } | 98 } |
98 } | 99 }; |
99 dart.setSignature(J, { | 100 dart.setSignature(constructors.J, { |
100 constructors: () => ({J: [J, []]}) | 101 constructors: () => ({J: [constructors.J, []]}) |
101 }); | 102 }); |
102 class K extends core.Object { | 103 constructors.K = class K extends core.Object { |
103 K() { | 104 K() { |
104 this.s = 'a'; | 105 this.s = 'a'; |
105 } | 106 } |
106 withS(s) { | 107 withS(s) { |
107 this.s = s; | 108 this.s = s; |
108 } | 109 } |
109 } | 110 }; |
110 dart.defineNamedConstructor(K, 'withS'); | 111 dart.defineNamedConstructor(constructors.K, 'withS'); |
111 dart.setSignature(K, { | 112 dart.setSignature(constructors.K, { |
112 constructors: () => ({ | 113 constructors: () => ({ |
113 K: [K, []], | 114 K: [constructors.K, []], |
114 withS: [K, [core.String]] | 115 withS: [constructors.K, [core.String]] |
115 }) | 116 }) |
116 }); | 117 }); |
117 class L extends core.Object { | 118 constructors.L = class L extends core.Object { |
118 L(foo) { | 119 L(foo) { |
119 this.foo = foo; | 120 this.foo = foo; |
120 } | 121 } |
121 } | 122 }; |
122 dart.setSignature(L, { | 123 dart.setSignature(constructors.L, { |
123 constructors: () => ({L: [L, [dart.dynamic]]}) | 124 constructors: () => ({L: [constructors.L, [dart.dynamic]]}) |
124 }); | 125 }); |
125 class M extends L { | 126 constructors.M = class M extends constructors.L { |
126 named(x) { | 127 named(x) { |
127 super.L(dart.notNull(x) + 42); | 128 super.L(dart.notNull(x) + 42); |
128 } | 129 } |
129 } | 130 }; |
130 dart.defineNamedConstructor(M, 'named'); | 131 dart.defineNamedConstructor(constructors.M, 'named'); |
131 dart.setSignature(M, { | 132 dart.setSignature(constructors.M, { |
132 constructors: () => ({named: [M, [core.int]]}) | 133 constructors: () => ({named: [constructors.M, [core.int]]}) |
133 }); | 134 }); |
134 class N extends M { | 135 constructors.N = class N extends constructors.M { |
135 named(y) { | 136 named(y) { |
136 super.named(dart.notNull(y) + 100); | 137 super.named(dart.notNull(y) + 100); |
137 } | 138 } |
138 } | 139 }; |
139 dart.defineNamedConstructor(N, 'named'); | 140 dart.defineNamedConstructor(constructors.N, 'named'); |
140 dart.setSignature(N, { | 141 dart.setSignature(constructors.N, { |
141 constructors: () => ({named: [N, [core.int]]}) | 142 constructors: () => ({named: [constructors.N, [core.int]]}) |
142 }); | 143 }); |
143 class P extends N { | 144 constructors.P = class P extends constructors.N { |
144 P(z) { | 145 P(z) { |
145 super.named(dart.notNull(z) + 9000); | 146 super.named(dart.notNull(z) + 9000); |
146 } | 147 } |
147 foo(x) { | 148 foo(x) { |
148 this.P(dart.notNull(x) + 42); | 149 this.P(dart.notNull(x) + 42); |
149 } | 150 } |
150 bar() { | 151 bar() { |
151 this.foo(1); | 152 this.foo(1); |
152 } | 153 } |
153 } | 154 }; |
154 dart.defineNamedConstructor(P, 'foo'); | 155 dart.defineNamedConstructor(constructors.P, 'foo'); |
155 dart.defineNamedConstructor(P, 'bar'); | 156 dart.defineNamedConstructor(constructors.P, 'bar'); |
156 dart.setSignature(P, { | 157 dart.setSignature(constructors.P, { |
157 constructors: () => ({ | 158 constructors: () => ({ |
158 P: [P, [core.int]], | 159 P: [constructors.P, [core.int]], |
159 foo: [P, [core.int]], | 160 foo: [constructors.P, [core.int]], |
160 bar: [P, []] | 161 bar: [constructors.P, []] |
161 }) | 162 }) |
162 }); | 163 }); |
163 const Q$ = dart.generic(function(T) { | 164 constructors.Q$ = dart.generic(T => { |
164 class Q extends core.Object { | 165 class Q extends core.Object { |
165 Q(y) { | 166 Q(y) { |
166 this.x = dart.as(y, T); | 167 this.x = dart.as(y, T); |
167 } | 168 } |
168 static foo() { | 169 static foo() { |
169 return new (Q$())("hello"); | 170 return new constructors.Q("hello"); |
170 } | 171 } |
171 bar() { | 172 bar() { |
172 let q = Q$().foo(); | 173 let q = constructors.Q.foo(); |
173 return dart.as(q.x, core.String); | 174 return dart.as(q.x, core.String); |
174 } | 175 } |
175 bar2() { | 176 bar2() { |
176 let q = new (Q$())("world"); | 177 let q = new constructors.Q("world"); |
177 return dart.as(q.x, core.String); | 178 return dart.as(q.x, core.String); |
178 } | 179 } |
179 static baz() { | 180 static baz() { |
180 let q = new (Q$(core.int))(42); | 181 let q = new (constructors.Q$(core.int))(42); |
181 return dart.notNull(q.bar()) + dart.notNull(q.bar2()); | 182 return dart.notNull(q.bar()) + dart.notNull(q.bar2()); |
182 } | 183 } |
183 } | 184 } |
184 dart.setSignature(Q, { | 185 dart.setSignature(Q, { |
185 constructors: () => ({Q: [Q$(T), [dart.dynamic]]}), | 186 constructors: () => ({Q: [constructors.Q$(T), [dart.dynamic]]}), |
186 methods: () => ({ | 187 methods: () => ({ |
187 bar: [core.String, []], | 188 bar: [core.String, []], |
188 bar2: [core.String, []] | 189 bar2: [core.String, []] |
189 }), | 190 }), |
190 statics: () => ({ | 191 statics: () => ({ |
191 foo: [Q$(), []], | 192 foo: [constructors.Q, []], |
192 baz: [core.String, []] | 193 baz: [core.String, []] |
193 }), | 194 }), |
194 names: ['foo', 'baz'] | 195 names: ['foo', 'baz'] |
195 }); | 196 }); |
196 return Q; | 197 return Q; |
197 }); | 198 }); |
198 let Q = Q$(); | 199 constructors.Q = constructors.Q$(); |
199 // Exports: | 200 // Exports: |
200 exports.A = A; | 201 exports.constructors = constructors; |
201 exports.B = B; | |
202 exports.C = C; | |
203 exports.C2 = C2; | |
204 exports.D = D; | |
205 exports.E = E; | |
206 exports.F = F; | |
207 exports.G = G; | |
208 exports.H = H; | |
209 exports.I = I; | |
210 exports.J = J; | |
211 exports.K = K; | |
212 exports.L = L; | |
213 exports.M = M; | |
214 exports.N = N; | |
215 exports.P = P; | |
216 exports.Q$ = Q$; | |
217 exports.Q = Q; | |
218 }); | 202 }); |
OLD | NEW |