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

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

Issue 3000333002: Fix several bugs in closure conversion. (Closed)
Patch Set: Comments. 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 const field dynamic numbers = const <core::int>[0, 1, 2, 3, 4, 5, 6, 7, 8 , 9]; 5 static const field dynamic numbers = const <core::int>[0, 1, 2, 3, 4, 5, 6, 7, 8 , 9];
6 static method main() → dynamic { 6 static method main() → dynamic {
7 dynamic closures = <dynamic>[]; 7 dynamic closures = <dynamic>[];
8 final Vector #context = MakeVector(3);
9 #context[2] = 0;
8 for (core::int i in self::numbers) { 10 for (core::int i in self::numbers) {
9 final Vector #context = MakeVector(3); 11 final Vector #context = MakeVector(3);
12 #context[1] = #context;
10 #context[2] = i; 13 #context[2] = i;
11 { 14 {
12 closures.add(MakeClosure<() → dynamic>(self::closure#main#function, #conte xt)); 15 closures.add(MakeClosure<() → dynamic>(self::closure#main#function, #conte xt));
13 } 16 }
14 } 17 }
15 core::int sum = 0; 18 core::int sum = 0;
16 for (core::Function f in closures) { 19 for (core::Function f in closures) {
17 sum = sum.+(f.call()); 20 sum = sum.+(f.call());
18 } 21 }
19 core::int expectedSum = self::numbers.length.-(1).*(self::numbers.length).~/(2 ); 22 core::int expectedSum = self::numbers.length.-(1).*(self::numbers.length).~/(2 );
20 if(!expectedSum.==(sum)) { 23 if(!expectedSum.==(sum)) {
21 throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}"); 24 throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}");
22 } 25 }
23 } 26 }
24 static method closure#main#function(Vector #contextParameter) → dynamic { 27 static method closure#main#function(Vector #contextParameter) → dynamic {
25 return #contextParameter[2]; 28 return (#contextParameter[2]).+(#contextParameter[1][2]);
26 } 29 }
OLDNEW
« no previous file with comments | « pkg/kernel/testcases/closures/for_in_closure.dart ('k') | pkg/kernel/testcases/closures/loop2.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698