Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: pkg/kernel/testcases/closures/instance_tear_off.dart.expect

Issue 2561723003: Merge kernel closure conversion into the Dart SDK (Closed)
Patch Set: Remove path constraint Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 library;
2 import self as self;
3 import "dart:core" as core;
4 import "dart:mock" as mock;
5
6 class C extends core::Object {
7 field dynamic f = new self::Closure#C#f#function::•(null);
8 constructor •() → void
9 : super core::Object::•()
10 ;
11 get g() → dynamic {
12 return new self::Closure#C#g#function::•(null);
13 }
14 method a() → dynamic {
15 return "a";
16 }
17 method b(dynamic x) → dynamic {
18 return x;
19 }
20 method c(dynamic x, [dynamic y = 2]) → dynamic {
21 return x.+(y);
22 }
23 method d(dynamic x, {dynamic y = 2}) → dynamic {
24 return x.+(y);
25 }
26 get a#get() → dynamic
27 return new self::Closure#C#a::•(this);
28 get b#get() → dynamic
29 return new self::Closure#C#b::•(this);
30 get c#get() → dynamic
31 return new self::Closure#C#c::•(this);
32 get d#get() → dynamic
33 return new self::Closure#C#d::•(this);
34 }
35 class D<T extends core::Object> extends core::Object {
36 field dynamic f = new self::Closure#D#f#function::•(null);
37 constructor •() → void
38 : super core::Object::•()
39 ;
40 get g() → dynamic {
41 return new self::Closure#D#g#function::•(null);
42 }
43 method a() → dynamic {
44 return "a";
45 }
46 method b(dynamic x) → dynamic {
47 return x;
48 }
49 method c(dynamic x, [dynamic y = 2]) → dynamic {
50 return x.+(y);
51 }
52 method d(dynamic x, {dynamic y = 2}) → dynamic {
53 return x.+(y);
54 }
55 get a#get() → dynamic
56 return new self::Closure#D#a::•<self::D::T>(this);
57 get b#get() → dynamic
58 return new self::Closure#D#b::•<self::D::T>(this);
59 get c#get() → dynamic
60 return new self::Closure#D#c::•<self::D::T>(this);
61 get d#get() → dynamic
62 return new self::Closure#D#d::•<self::D::T>(this);
63 }
64 class E<T extends core::Object> extends core::Object {
65 field dynamic f = new self::Closure#E#f#function::•(null);
66 constructor •() → void
67 : super core::Object::•()
68 ;
69 get g() → dynamic {
70 return new self::Closure#E#g#function::•<self::E::T>(null);
71 }
72 method a() → dynamic {
73 return "a";
74 }
75 method b(self::E::T x) → dynamic {
76 return x;
77 }
78 method c(self::E::T x, [self::E::T y = 2]) → dynamic {
79 return x.+(y);
80 }
81 method d(self::E::T x, {self::E::T y = 2}) → dynamic {
82 return x.+(y);
83 }
84 get a#get() → dynamic
85 return new self::Closure#E#a::•<self::E::T>(this);
86 get b#get() → dynamic
87 return new self::Closure#E#b::•<self::E::T>(this);
88 get c#get() → dynamic
89 return new self::Closure#E#c::•<self::E::T>(this);
90 get d#get() → dynamic
91 return new self::Closure#E#d::•<self::E::T>(this);
92 }
93 class Closure#C#g#function extends core::Object implements core::Function {
94 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
95 field mock::Context context;
96 constructor •(final mock::Context context) → dynamic
97 : self::Closure#C#g#function::context = context
98 ;
99 method call(dynamic x) → dynamic {
100 "This is a temporary solution. In the VM, this will become an additional par ameter.";
101 final mock::Context #contextParameter = this.{self::Closure#C#g#function::co ntext};
102 return "g(${x})";
103 }
104 }
105 class Closure#C#a extends core::Object implements core::Function {
106 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
107 field self::C self;
108 constructor •(final self::C self) → dynamic
109 : self::Closure#C#a::self = self
110 ;
111 method call() → dynamic
112 return this.{self::Closure#C#a::self}.{self::C::a}();
113 }
114 class Closure#C#b extends core::Object implements core::Function {
115 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
116 field self::C self;
117 constructor •(final self::C self) → dynamic
118 : self::Closure#C#b::self = self
119 ;
120 method call(dynamic x) → dynamic
121 return this.{self::Closure#C#b::self}.{self::C::b}(x);
122 }
123 class Closure#C#c extends core::Object implements core::Function {
124 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
125 field self::C self;
126 constructor •(final self::C self) → dynamic
127 : self::Closure#C#c::self = self
128 ;
129 method call(dynamic x, [dynamic y = 2]) → dynamic
130 return this.{self::Closure#C#c::self}.{self::C::c}(x, y);
131 }
132 class Closure#C#d extends core::Object implements core::Function {
133 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
134 field self::C self;
135 constructor •(final self::C self) → dynamic
136 : self::Closure#C#d::self = self
137 ;
138 method call(dynamic x, {dynamic y = 2}) → dynamic
139 return this.{self::Closure#C#d::self}.{self::C::d}(x, y: y);
140 }
141 class Closure#C#f#function extends core::Object implements core::Function {
142 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
143 field mock::Context context;
144 constructor •(final mock::Context context) → dynamic
145 : self::Closure#C#f#function::context = context
146 ;
147 method call() → dynamic {
148 "This is a temporary solution. In the VM, this will become an additional par ameter.";
149 final mock::Context #contextParameter = this.{self::Closure#C#f#function::co ntext};
150 return "f";
151 }
152 }
153 class Closure#D#g#function extends core::Object implements core::Function {
154 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
155 field mock::Context context;
156 constructor •(final mock::Context context) → dynamic
157 : self::Closure#D#g#function::context = context
158 ;
159 method call(dynamic x) → dynamic {
160 "This is a temporary solution. In the VM, this will become an additional par ameter.";
161 final mock::Context #contextParameter = this.{self::Closure#D#g#function::co ntext};
162 return "g(${x})";
163 }
164 }
165 class Closure#D#a<T extends core::Object> extends core::Object implements core:: Function {
166 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
167 field self::D<self::Closure#D#a::T> self;
168 constructor •(final self::D<self::Closure#D#a::T> self) → dynamic
169 : self::Closure#D#a::self = self
170 ;
171 method call() → dynamic
172 return this.{self::Closure#D#a::self}.{self::D::a}();
173 }
174 class Closure#D#b<T extends core::Object> extends core::Object implements core:: Function {
175 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
176 field self::D<self::Closure#D#b::T> self;
177 constructor •(final self::D<self::Closure#D#b::T> self) → dynamic
178 : self::Closure#D#b::self = self
179 ;
180 method call(dynamic x) → dynamic
181 return this.{self::Closure#D#b::self}.{self::D::b}(x);
182 }
183 class Closure#D#c<T extends core::Object> extends core::Object implements core:: Function {
184 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
185 field self::D<self::Closure#D#c::T> self;
186 constructor •(final self::D<self::Closure#D#c::T> self) → dynamic
187 : self::Closure#D#c::self = self
188 ;
189 method call(dynamic x, [dynamic y = 2]) → dynamic
190 return this.{self::Closure#D#c::self}.{self::D::c}(x, y);
191 }
192 class Closure#D#d<T extends core::Object> extends core::Object implements core:: Function {
193 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
194 field self::D<self::Closure#D#d::T> self;
195 constructor •(final self::D<self::Closure#D#d::T> self) → dynamic
196 : self::Closure#D#d::self = self
197 ;
198 method call(dynamic x, {dynamic y = 2}) → dynamic
199 return this.{self::Closure#D#d::self}.{self::D::d}(x, y: y);
200 }
201 class Closure#D#f#function extends core::Object implements core::Function {
202 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
203 field mock::Context context;
204 constructor •(final mock::Context context) → dynamic
205 : self::Closure#D#f#function::context = context
206 ;
207 method call() → dynamic {
208 "This is a temporary solution. In the VM, this will become an additional par ameter.";
209 final mock::Context #contextParameter = this.{self::Closure#D#f#function::co ntext};
210 return "f";
211 }
212 }
213 class Closure#E#g#function<T extends core::Object> extends core::Object implemen ts core::Function {
214 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
215 field mock::Context context;
216 constructor •(final mock::Context context) → dynamic
217 : self::Closure#E#g#function::context = context
218 ;
219 method call(self::Closure#E#g#function::T x) → dynamic {
220 "This is a temporary solution. In the VM, this will become an additional par ameter.";
221 final mock::Context #contextParameter = this.{self::Closure#E#g#function::co ntext};
222 return "g(${x})";
223 }
224 }
225 class Closure#E#a<T extends core::Object> extends core::Object implements core:: Function {
226 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
227 field self::E<self::Closure#E#a::T> self;
228 constructor •(final self::E<self::Closure#E#a::T> self) → dynamic
229 : self::Closure#E#a::self = self
230 ;
231 method call() → dynamic
232 return this.{self::Closure#E#a::self}.{self::E::a}();
233 }
234 class Closure#E#b<T extends core::Object> extends core::Object implements core:: Function {
235 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
236 field self::E<self::Closure#E#b::T> self;
237 constructor •(final self::E<self::Closure#E#b::T> self) → dynamic
238 : self::Closure#E#b::self = self
239 ;
240 method call(self::Closure#E#b::T x) → dynamic
241 return this.{self::Closure#E#b::self}.{self::E::b}(x);
242 }
243 class Closure#E#c<T extends core::Object> extends core::Object implements core:: Function {
244 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
245 field self::E<self::Closure#E#c::T> self;
246 constructor •(final self::E<self::Closure#E#c::T> self) → dynamic
247 : self::Closure#E#c::self = self
248 ;
249 method call(self::Closure#E#c::T x, [self::Closure#E#c::T y = 2]) → dynamic
250 return this.{self::Closure#E#c::self}.{self::E::c}(x, y);
251 }
252 class Closure#E#d<T extends core::Object> extends core::Object implements core:: Function {
253 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
254 field self::E<self::Closure#E#d::T> self;
255 constructor •(final self::E<self::Closure#E#d::T> self) → dynamic
256 : self::Closure#E#d::self = self
257 ;
258 method call(self::Closure#E#d::T x, {self::Closure#E#d::T y = 2}) → dynamic
259 return this.{self::Closure#E#d::self}.{self::E::d}(x, y: y);
260 }
261 class Closure#E#f#function extends core::Object implements core::Function {
262 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
263 field mock::Context context;
264 constructor •(final mock::Context context) → dynamic
265 : self::Closure#E#f#function::context = context
266 ;
267 method call() → dynamic {
268 "This is a temporary solution. In the VM, this will become an additional par ameter.";
269 final mock::Context #contextParameter = this.{self::Closure#E#f#function::co ntext};
270 return "f";
271 }
272 }
273 static method expect(dynamic expected, dynamic actual) → dynamic {
274 core::print("Expecting '${expected}' and got '${actual}'");
275 if(!expected.==(actual)) {
276 core::print("Expected '${expected}' but got '${actual}'");
277 throw "Expected '${expected}' but got '${actual}'";
278 }
279 }
280 static method test(dynamic o) → dynamic {
281 self::expect("f", o.f());
282 self::expect("f", o.f.call());
283 self::expect("g(42)", o.g(42));
284 self::expect("g(42)", o.g.call(42));
285 self::expect("a", o.a());
286 self::expect("a", o.a#get.call());
287 self::expect(42, o.b(42));
288 self::expect(42, o.b#get.call(42));
289 self::expect(42, o.c(40));
290 self::expect(42, o.c#get.call(40));
291 self::expect(87, o.c(80, 7));
292 self::expect(87, o.c#get.call(80, 7));
293 self::expect(42, o.d(40));
294 self::expect(42, o.d#get.call(40));
295 self::expect(87, o.d(80, y: 7));
296 self::expect(87, o.d#get.call(80, y: 7));
297 }
298 static method main(dynamic arguments) → dynamic {
299 self::test(new self::C::•());
300 self::test(new self::D::•<core::int>());
301 self::test(new self::E::•<core::int>());
302 }
OLDNEW
« no previous file with comments | « pkg/kernel/testcases/closures/instance_tear_off.dart ('k') | pkg/kernel/testcases/closures/named_closure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698