Index: pkg/kernel/testcases/closures/closure_in_constructor.dart.expect |
diff --git a/pkg/kernel/testcases/closures/closure_in_constructor.dart.expect b/pkg/kernel/testcases/closures/closure_in_constructor.dart.expect |
new file mode 100644 |
index 0000000000000000000000000000000000000000..de25cb6dfb7b65987fe306bf87eb3df44070e9ea |
--- /dev/null |
+++ b/pkg/kernel/testcases/closures/closure_in_constructor.dart.expect |
@@ -0,0 +1,49 @@ |
+library; |
+import self as self; |
+import "dart:core" as core; |
+import "dart:mock" as mock; |
+ |
+class C1 extends core::Object { |
+ field dynamic x; |
+ constructor •(dynamic y) → void |
+ : self::C1::x = let final mock::Context #context = new mock::Context::•(1) in let dynamic #t1 = #context.[]=(0, y) in new self::Closure#C1##function::•(#context), super core::Object::•() |
+ ; |
+} |
+class C2 extends core::Object { |
+ field dynamic x = null; |
+ constructor •(dynamic y) → void |
+ : super core::Object::•() { |
+ final mock::Context #context = new mock::Context::•(1); |
+ #context.parent = null; |
+ #context.[]=(0, y); |
+ this.x = new self::Closure#C2#function#function::•(#context); |
+ } |
+} |
+class Closure#C1##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#C1##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#C1##function::context}; |
+ return core::print("Hello ${#contextParameter.[](0)}"); |
+ } |
+} |
+class Closure#C2#function#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#C2#function#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#C2#function#function::context}; |
+ return core::print("Hello ${#contextParameter.[](0)}"); |
+ } |
+} |
+static method main() → dynamic { |
+ new self::C1::•("hest").x(); |
+ new self::C2::•("naebdyr").x(); |
+} |