Files
sdk/pkg/kernel/testcases/closures/capture_closure_parameter.dart.expect
T
Karl Klose 8c6a174091 Use List::filled instead of List:: in closure conversion
The redirecting factory List:: is currently removed and replaced with the actual target at the callsites during construction of kernel, but referencing the actual target here would make the transformation platform specific.

R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2637083002 .
2017-01-17 15:17:11 +01:00

38 lines
1.5 KiB
Plaintext

library;
import self as self;
import "dart:core" as core;
import "dart:mock" as mock;
class Closure#main#foo#bar 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#foo#bar::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#foo#bar::context};
core::print(#contextParameter.[](0));
}
}
class Closure#main#foo 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#foo::context = context
;
method call(dynamic x) → dynamic {
"This is a temporary solution. In the VM, this will become an additional parameter.";
final mock::Context #contextParameter = this.{self::Closure#main#foo::context};
final mock::Context #context = new mock::Context::•(1);
#context.parent = #contextParameter;
#context.[]=(0, null);
final () → dynamic bar = new self::Closure#main#foo#bar::•(#context);
return bar;
}
}
static method main(core::List<core::String> arguments) → dynamic {
final (dynamic) → dynamic foo = new self::Closure#main#foo::•(null);
foo.call(arguments.[](0)).call();
}