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/closures.dart.expect

Issue 2778223002: Add primitive to create closures and use it for closure conversion (Closed)
Patch Set: Skip context param in closure type construction, rather than remove it Created 3 years, 8 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
1 library; 1 library;
2 import self as self; 2 import self as self;
3 import "dart:core" as core; 3 import "dart:core" as core;
4 4
5 class Closure#main#function extends core::Object implements core::Function {
6 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
7 field Vector context;
8 constructor •(final Vector context) → dynamic
9 : self::Closure#main#function::context = context
10 ;
11 method call(dynamic x) → dynamic {
12 "This is a temporary solution. In the VM, this will become an additional par ameter.";
13 final Vector #contextParameter = this.{self::Closure#main#function::context} ;
14 return (#contextParameter[1]).[](x);
15 }
16 }
17 static field dynamic f = null; 5 static field dynamic f = null;
18 static method foo() → dynamic { 6 static method foo() → dynamic {
19 core::print(self::f.call(0)); 7 core::print(self::f.call(0));
20 } 8 }
21 static method main(dynamic arguments) → dynamic { 9 static method main(dynamic arguments) → dynamic {
22 final Vector #context = MakeVector(2); 10 final Vector #context = MakeVector(2);
23 #context[1] = arguments; 11 #context[1] = arguments;
24 self::f = new self::Closure#main#function::•(#context); 12 self::f = MakeClosure<(dynamic) → dynamic>(self::closure#main#function, #conte xt);
25 self::foo(); 13 self::foo();
26 } 14 }
15 static method closure#main#function(Vector #contextParameter, dynamic x) → dynam ic {
16 return (#contextParameter[1]).[](x);
17 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698