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

Side by Side Diff: pkg/kernel/testcases/closures/closure_in_initializer.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 extends core::Object implements core::Function {
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::context = context
21 ;
22 method call() → 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:: context};
25 return #contextParameter.[](0).call();
26 }
27 }
28 class Closure#main#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#main#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#main#function::c ontext};
37 return core::print("hest");
38 }
39 }
40 static method main() → dynamic {
41 core::print(0);
42 dynamic c = new self::C::foo(new self::Closure#main#function::•(null));
43 core::print(2);
44 c.t();
45 core::print(3);
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698