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

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

Issue 3007623002: Fix many bugs with closure conversion in checked mode. (Closed)
Patch Set: Created 3 years, 3 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 static method doit(core::int x) → void { 5 static method doit(core::int x) → void {
6 final Vector #context = MakeVector(3); 6 final dynamic #context = MakeVector(3);
7 #context[2] = x; 7 #context[2] = x;
8 final core::int max = 10; 8 final core::int max = 10;
9 final core::double expectedSum = max.-(1).*(max)./(2); 9 final core::double expectedSum = max.-(1).*(max)./(2);
10 core::int counter = 0; 10 core::int counter = 0;
11 dynamic calls = <dynamic>[]; 11 dynamic calls = <dynamic>[];
12 while (counter.<(max)) { 12 while (counter.<(max)) {
13 final Vector #context = MakeVector(3); 13 final dynamic #context = MakeVector(3);
14 #context[1] = #context; 14 #context[1] = #context;
15 #context[2] = counter; 15 #context[2] = counter;
16 calls.add(MakeClosure<() → dynamic>(self::closure#doit#function, #context)); 16 calls.add(MakeClosure<() → dynamic>(self::closure#doit#function, #context));
17 counter = counter.+(1); 17 counter = counter.+(1);
18 } 18 }
19 core::double sum = 0.0; 19 core::double sum = 0.0;
20 for (dynamic c in calls) 20 for (dynamic c in calls)
21 sum = sum.+(c.call()); 21 sum = sum.+(c.call());
22 if(!sum.==(expectedSum)) 22 if(!sum.==(expectedSum))
23 throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}"); 23 throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}");
24 } 24 }
25 static method main() → void { 25 static method main() → void {
26 self::doit(0); 26 self::doit(0);
27 } 27 }
28 static method closure#doit#function(Vector #contextParameter) → dynamic { 28 static method closure#doit#function(dynamic #contextParameter) → dynamic {
29 return (#contextParameter[2]).+(#contextParameter[1][2]); 29 return (#contextParameter[2]).+(#contextParameter[1][2]);
30 } 30 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698