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

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

Issue 2712473003: closure conversion: Support closures in initializers (Closed)
Patch Set: Address comments Created 3 years, 9 months 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 C1 extends core::Object {
7 field dynamic x;
8 constructor •(dynamic y) → void
9 : self::C1::x = let final mock::Context #context = new mock::Context::•(1) i n let dynamic #t1 = #context.[]=(0, y) in new self::Closure#C1##function::•(#con text), super core::Object::•()
10 ;
11 }
12 class C2 extends core::Object {
13 field dynamic x = null;
14 constructor •(dynamic y) → void
15 : super core::Object::•() {
16 final mock::Context #context = new mock::Context::•(1);
17 #context.parent = null;
18 #context.[]=(0, y);
19 this.x = new self::Closure#C2#function#function::•(#context);
20 }
21 }
22 class Closure#C1##function extends core::Object implements core::Function {
23 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
24 field mock::Context context;
25 constructor •(final mock::Context context) → dynamic
26 : self::Closure#C1##function::context = context
27 ;
28 method call() → dynamic {
29 "This is a temporary solution. In the VM, this will become an additional par ameter.";
30 final mock::Context #contextParameter = this.{self::Closure#C1##function::co ntext};
31 return core::print("Hello ${#contextParameter.[](0)}");
32 }
33 }
34 class Closure#C2#function#function extends core::Object implements core::Functio n {
35 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
36 field mock::Context context;
37 constructor •(final mock::Context context) → dynamic
38 : self::Closure#C2#function#function::context = context
39 ;
40 method call() → dynamic {
41 "This is a temporary solution. In the VM, this will become an additional par ameter.";
42 final mock::Context #contextParameter = this.{self::Closure#C2#function#func tion::context};
43 return core::print("Hello ${#contextParameter.[](0)}");
44 }
45 }
46 static method main() → dynamic {
47 new self::C1::•("hest").x();
48 new self::C2::•("naebdyr").x();
49 }
OLDNEW
« no previous file with comments | « pkg/kernel/testcases/closures/closure_in_constructor.dart ('k') | pkg/kernel/testcases/closures/closure_in_initializer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698