| 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}");
|
| + }
|
| +}
|
|
|