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

Unified Diff: pkg/kernel/testcases/closures/for_in_closure.dart.expect

Issue 2561723003: Merge kernel closure conversion into the Dart SDK (Closed)
Patch Set: Remove path constraint Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/kernel/testcases/closures/for_in_closure.dart ('k') | pkg/kernel/testcases/closures/for_loop.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/testcases/closures/for_in_closure.dart.expect
diff --git a/pkg/kernel/testcases/closures/for_in_closure.dart.expect b/pkg/kernel/testcases/closures/for_in_closure.dart.expect
new file mode 100644
index 0000000000000000000000000000000000000000..d6c8ee0507885a13228a0afe31b88381c8a89bb9
--- /dev/null
+++ b/pkg/kernel/testcases/closures/for_in_closure.dart.expect
@@ -0,0 +1,37 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class Closure#main#function extends core::Object implements core::Function {
+ field core::String note = "This is temporary. The VM doesn't need closure classes.";
+ field mock::Context context;
+ constructor •(final mock::Context context) → dynamic
+ : self::Closure#main#function::context = context
+ ;
+ method call() → dynamic {
+ "This is a temporary solution. In the VM, this will become an additional parameter.";
+ final mock::Context #contextParameter = this.{self::Closure#main#function::context};
+ return #contextParameter.[](0);
+ }
+}
+static const field dynamic numbers = const <core::int>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+static method main() → dynamic {
+ dynamic closures = <dynamic>[];
+ for (core::int i in self::numbers) {
+ final mock::Context #context = new mock::Context::•(1);
+ #context.parent = null;
+ #context.[]=(0, i);
+ {
+ closures.add(new self::Closure#main#function::•(#context));
+ }
+ }
+ core::int sum = 0;
+ for (core::Function f in closures) {
+ sum = sum.+(f.call());
+ }
+ core::int expectedSum = self::numbers.length.-(1).*(self::numbers.length).~/(2);
+ if(!expectedSum.==(sum)) {
+ throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}");
+ }
+}
« no previous file with comments | « pkg/kernel/testcases/closures/for_in_closure.dart ('k') | pkg/kernel/testcases/closures/for_loop.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698