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

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

Issue 2767773004: Add Vector type to Kernel (Closed)
Patch Set: Reformat comment with Markdown, throw exception in type propagation 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 import "dart:mock" as mock;
5 4
6 class Closure#main#function extends core::Object implements core::Function { 5 class Closure#main#function extends core::Object implements core::Function {
7 field core::String note = "This is temporary. The VM doesn't need closure clas ses."; 6 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
8 field mock::Context context; 7 field Vector context;
9 constructor •(final mock::Context context) → dynamic 8 constructor •(final Vector context) → dynamic
10 : self::Closure#main#function::context = context 9 : self::Closure#main#function::context = context
11 ; 10 ;
12 method call() → dynamic { 11 method call() → dynamic {
13 "This is a temporary solution. In the VM, this will become an additional par ameter."; 12 "This is a temporary solution. In the VM, this will become an additional par ameter.";
14 final mock::Context #contextParameter = this.{self::Closure#main#function::c ontext}; 13 final Vector #contextParameter = this.{self::Closure#main#function::context} ;
15 return let final dynamic #t1 = #contextParameter.parent in let final dynamic #t2 = 0 in let final dynamic #t3 = #contextParameter.[](0) in let final dynamic #t4 = #t1.[]=(#t2, #t3) in #t3; 14 return #contextParameter[0][1] = #contextParameter[1];
16 } 15 }
17 } 16 }
18 class Closure#main#function#1 extends core::Object implements core::Function { 17 class Closure#main#function#1 extends core::Object implements core::Function {
19 field core::String note = "This is temporary. The VM doesn't need closure clas ses."; 18 field core::String note = "This is temporary. The VM doesn't need closure clas ses.";
20 field mock::Context context; 19 field Vector context;
21 constructor •(final mock::Context context) → dynamic 20 constructor •(final Vector context) → dynamic
22 : self::Closure#main#function#1::context = context 21 : self::Closure#main#function#1::context = context
23 ; 22 ;
24 method call() → dynamic { 23 method call() → dynamic {
25 "This is a temporary solution. In the VM, this will become an additional par ameter."; 24 "This is a temporary solution. In the VM, this will become an additional par ameter.";
26 final mock::Context #contextParameter = this.{self::Closure#main#function#1: :context}; 25 final Vector #contextParameter = this.{self::Closure#main#function#1::contex t};
27 if(!#contextParameter.parent.[](0).==(self::max.-(1))) 26 if(!(#contextParameter[0][1]).==(self::max.-(1)))
28 throw "last: ${#contextParameter.parent.[](0)} != ${self::max.-(1)}"; 27 throw "last: ${#contextParameter[0][1]} != ${self::max.-(1)}";
29 } 28 }
30 } 29 }
31 static const field core::int max = 100; 30 static const field core::int max = 100;
32 static method main() → dynamic { 31 static method main() → dynamic {
33 dynamic closures = <dynamic>[]; 32 dynamic closures = <dynamic>[];
34 dynamic closures2 = <dynamic>[]; 33 dynamic closures2 = <dynamic>[];
35 final mock::Context #context = new mock::Context::•(1); 34 final Vector #context = MakeVector(2);
36 #context.[]=(0, null); 35 #context[1] = null;
37 { 36 {
38 mock::Context #context = new mock::Context::•(1); 37 Vector #context = MakeVector(2);
39 #context.parent = #context; 38 #context[0] = #context;
40 #context.[]=(0, 0); 39 #context[1] = 0;
41 for (; #context.[](0).<(self::max); #context = #context.copy(), #context.[]= (0, #context.[](0).+(1))) { 40 for (; (#context[1]).<(self::max); #context = CopyVector(#context), #context [1] = (#context[1]).+(1)) {
42 closures.add(new self::Closure#main#function::•(#context)); 41 closures.add(new self::Closure#main#function::•(#context));
43 closures2.add(new self::Closure#main#function#1::•(#context)); 42 closures2.add(new self::Closure#main#function#1::•(#context));
44 } 43 }
45 } 44 }
46 core::int sum = 0; 45 core::int sum = 0;
47 for (core::Function f in closures) { 46 for (core::Function f in closures) {
48 sum = sum.+(f.call()); 47 sum = sum.+(f.call());
49 } 48 }
50 for (core::Function f in closures2) { 49 for (core::Function f in closures2) {
51 f.call(); 50 f.call();
52 } 51 }
53 core::int expectedSum = self::max.-(1).*(self::max).~/(2); 52 core::int expectedSum = self::max.-(1).*(self::max).~/(2);
54 if(!expectedSum.==(sum)) { 53 if(!expectedSum.==(sum)) {
55 throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}"); 54 throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}");
56 } 55 }
57 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698