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

Unified Diff: pkg/kernel/testcases/closures_initializers/local_initializers.dart

Issue 2971293002: Fix closure conversion in field and local initializers. (Closed)
Patch Set: Created 3 years, 5 months 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
Index: pkg/kernel/testcases/closures_initializers/local_initializers.dart
diff --git a/pkg/kernel/testcases/closures_initializers/local_initializers.dart b/pkg/kernel/testcases/closures_initializers/local_initializers.dart
index d8df32d5b6665e5dcbac5d41ab79e9cc54943740..84d336bd421e88e0ceb225972658e59b8667cd7e 100644
--- a/pkg/kernel/testcases/closures_initializers/local_initializers.dart
+++ b/pkg/kernel/testcases/closures_initializers/local_initializers.dart
@@ -11,13 +11,24 @@
class X {}
+// Closure in field initializer.
Dmitry Stefantsov 2017/07/07 09:47:47 I would split this test in two or change the name
+//
class A {
X foo;
- A.named(X foo) {}
- A(X foo) : this.named((() => foo)());
+ A(X i) : foo = ((() => i)());
+}
+
+// Closure in local initializer.
+//
+class B {
+ X foo;
+ B.named(X foo) {}
+ B(X foo) : this.named((() => foo)());
}
main() {
A a = new A(new X());
a.foo; // To prevent dartanalyzer from marking [a] as unused.
+ B b = new B(new X());
+ b.foo;
}

Powered by Google App Engine
This is Rietveld 408576698