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

Side by Side Diff: pkg/kernel/testcases/closures/closure_in_initializer_closure.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 C extends core::Object {
7 field dynamic t;
8 constructor foo(dynamic f) → void
9 : self::C::t = let final mock::Context #context = new mock::Context::•(1) in let dynamic #t1 = #context.[]=(0, f) in new self::Closure#C#foo#function::•(#co ntext), super core::Object::•() {
10 final mock::Context #context = new mock::Context::•(1);
11 #context.parent = null;
12 #context.[]=(0, f);
13 core::print(1);
14 }
15 }
16 class Closure#C#foo#function#function extends core::Object implements core::Func tion {
17 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
18 field mock::Context context;
19 constructor •(final mock::Context context) → dynamic
20 : self::Closure#C#foo#function#function::context = context
21 ;
22 method call(dynamic x) → dynamic {
23 "This is a temporary solution. In the VM, this will become an additional par ameter.";
24 final mock::Context #contextParameter = this.{self::Closure#C#foo#function#f unction::context};
25 #contextParameter.parent.[](0).call("${#contextParameter.[](0)}${x}");
26 }
27 }
28 class Closure#C#foo#function extends core::Object implements core::Function {
29 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
30 field mock::Context context;
31 constructor •(final mock::Context context) → dynamic
32 : self::Closure#C#foo#function::context = context
33 ;
34 method call() → dynamic {
35 "This is a temporary solution. In the VM, this will become an additional par ameter.";
36 final mock::Context #contextParameter = this.{self::Closure#C#foo#function:: context};
37 final mock::Context #context = new mock::Context::•(1);
38 #context.parent = #contextParameter;
39 #context.[]=(0, null);
40 dynamic g = new self::Closure#C#foo#function#function::•(#context);
41 #context.[]=(0, "hest");
42 return g;
43 }
44 }
45 class Closure#main#function extends core::Object implements core::Function {
46 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
47 field mock::Context context;
48 constructor •(final mock::Context context) → dynamic
49 : self::Closure#main#function::context = context
50 ;
51 method call(dynamic x) → dynamic {
52 "This is a temporary solution. In the VM, this will become an additional par ameter.";
53 final mock::Context #contextParameter = this.{self::Closure#main#function::c ontext};
54 return core::print(x);
55 }
56 }
57 static method main() → dynamic {
58 core::print(0);
59 dynamic c = new self::C::foo(new self::Closure#main#function::•(null));
60 core::print(2);
61 c.t().call("fisk");
62 core::print(3);
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698