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

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

Issue 2998803002: [kernel] Support for top-level generic functions. (Closed)
Patch Set: Review comments. Created 3 years, 4 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 core::int max = 100; 5 static const field core::int max = 100;
6 static method main() → dynamic { 6 static method main() → dynamic {
7 dynamic closures = <dynamic>[]; 7 dynamic closures = <dynamic>[];
8 dynamic closures2 = <dynamic>[]; 8 dynamic closures2 = <dynamic>[];
9 final Vector #context = MakeVector(2); 9 final Vector #context = MakeVector(3);
10 #context[1] = null; 10 #context[2] = null;
11 { 11 {
12 Vector #context = MakeVector(2); 12 Vector #context = MakeVector(3);
13 #context[0] = #context; 13 #context[1] = #context;
14 #context[1] = 0; 14 #context[2] = 0;
15 for (; (#context[1]).<(self::max); #context = CopyVector(#context), #context [1] = (#context[1]).+(1)) { 15 for (; (#context[2]).<(self::max); #context = CopyVector(#context), #context [2] = (#context[2]).+(1)) {
16 closures.add(MakeClosure<() → dynamic>(self::closure#main#function, #conte xt)); 16 closures.add(MakeClosure<() → dynamic>(self::closure#main#function, #conte xt));
17 closures2.add(MakeClosure<() → dynamic>(self::closure#main#function#1, #co ntext)); 17 closures2.add(MakeClosure<() → dynamic>(self::closure#main#function#1, #co ntext));
18 } 18 }
19 } 19 }
20 core::int sum = 0; 20 core::int sum = 0;
21 for (core::Function f in closures) { 21 for (core::Function f in closures) {
22 sum = sum.+(f.call()); 22 sum = sum.+(f.call());
23 } 23 }
24 for (core::Function f in closures2) { 24 for (core::Function f in closures2) {
25 f.call(); 25 f.call();
26 } 26 }
27 core::int expectedSum = self::max.-(1).*(self::max).~/(2); 27 core::int expectedSum = self::max.-(1).*(self::max).~/(2);
28 if(!expectedSum.==(sum)) { 28 if(!expectedSum.==(sum)) {
29 throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}"); 29 throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}");
30 } 30 }
31 } 31 }
32 static method closure#main#function(Vector #contextParameter) → dynamic { 32 static method closure#main#function(Vector #contextParameter) → dynamic {
33 return #contextParameter[0][1] = #contextParameter[1]; 33 return #contextParameter[1][2] = #contextParameter[2];
34 } 34 }
35 static method closure#main#function#1(Vector #contextParameter) → dynamic { 35 static method closure#main#function#1(Vector #contextParameter) → dynamic {
36 if(!(#contextParameter[0][1]).==(self::max.-(1))) 36 if(!(#contextParameter[1][2]).==(self::max.-(1)))
37 throw "last: ${#contextParameter[0][1]} != ${self::max.-(1)}"; 37 throw "last: ${#contextParameter[1][2]} != ${self::max.-(1)}";
38 } 38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698