Index: pkg/kernel/testcases/closures/loop2.dart.expect |
diff --git a/pkg/kernel/testcases/closures/loop2.dart.expect b/pkg/kernel/testcases/closures/loop2.dart.expect |
new file mode 100644 |
index 0000000000000000000000000000000000000000..13fbab74c35c7b8673b1e3fc6974ec3fed5cf4ff |
--- /dev/null |
+++ b/pkg/kernel/testcases/closures/loop2.dart.expect |
@@ -0,0 +1,30 @@ |
+library; |
+import self as self; |
+import "dart:core" as core; |
+ |
+static method doit(core::int x) → void { |
+ final Vector #context = MakeVector(3); |
+ #context[2] = x; |
+ final core::int max = 10; |
+ final core::double expectedSum = max.-(1).*(max)./(2); |
+ core::int counter = 0; |
+ dynamic calls = <dynamic>[]; |
+ while (counter.<(max)) { |
+ final Vector #context = MakeVector(3); |
+ #context[1] = #context; |
+ #context[2] = counter; |
+ calls.add(MakeClosure<() → dynamic>(self::closure#doit#function, #context)); |
+ counter = counter.+(1); |
+ } |
+ core::double sum = 0.0; |
+ for (dynamic c in calls) |
+ sum = sum.+(c.call()); |
+ if(!sum.==(expectedSum)) |
+ throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}"); |
+} |
+static method main() → void { |
+ self::doit(0); |
+} |
+static method closure#doit#function(Vector #contextParameter) → dynamic { |
+ return (#contextParameter[2]).+(#contextParameter[1][2]); |
+} |