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

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

Issue 2778223002: Add primitive to create closures and use it for closure conversion (Closed)
Patch Set: Follow common pattern for AST nodes with References in ClosureCreation 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#foo#bar 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#foo#bar::context = context
10 ;
11 method call() → 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#foo#bar::context};
14 core::print(#contextParameter[1]);
15 }
16 }
17 class Closure#main#foo extends core::Object implements core::Function {
18 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
19 field Vector context;
20 constructor •(final Vector context) → dynamic
21 : self::Closure#main#foo::context = context
22 ;
23 method call(dynamic x) → dynamic {
24 "This is a temporary solution. In the VM, this will become an additional par ameter.";
25 final Vector #contextParameter = this.{self::Closure#main#foo::context};
26 final Vector #context = MakeVector(2);
27 #context[0] = #contextParameter;
28 #context[1] = null;
29 final () → dynamic bar = new self::Closure#main#foo#bar::•(#context);
30 return bar;
31 }
32 }
33 static method main(core::List<core::String> arguments) → dynamic { 5 static method main(core::List<core::String> arguments) → dynamic {
34 final (dynamic) → dynamic foo = new self::Closure#main#foo::•(null); 6 final (dynamic) → dynamic foo = MakeClosure<(dynamic) → dynamic>(self::closure #main#foo, null);
35 foo.call(arguments.[](0)).call(); 7 foo.call(arguments.[](0)).call();
36 } 8 }
9 static method closure#main#foo#bar(Vector #contextParameter) → dynamic {
10 core::print(#contextParameter[1]);
11 }
12 static method closure#main#foo(Vector #contextParameter, dynamic x) → dynamic {
13 final Vector #context = MakeVector(2);
14 #context[0] = #contextParameter;
15 #context[1] = x;
16 final () → dynamic bar = MakeClosure<() → dynamic>(self::closure#main#foo#bar, #context);
17 return bar;
18 }
OLDNEW
« no previous file with comments | « pkg/kernel/testcases/closures/capture_closure.dart.expect ('k') | pkg/kernel/testcases/closures/capture_this.dart.expect » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698