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

Unified Diff: pkg/front_end/testcases/reorder_super.dart

Issue 2993193002: When reordering constructor initializers, use correct types for temp vars. (Closed)
Patch Set: Created 3 years, 4 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/front_end/testcases/reorder_super.dart
diff --git a/pkg/front_end/testcases/reorder_super.dart b/pkg/front_end/testcases/reorder_super.dart
new file mode 100644
index 0000000000000000000000000000000000000000..196c06141f676cd865a80f295d35abeda3feb1b2
--- /dev/null
+++ b/pkg/front_end/testcases/reorder_super.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test verifies that super calls get reordered properly. It exercises the
+// case where the arguments to super have a type other than `dynamic`.
+String events = '';
+
+int f(x) {
+ events += 'f($x)\n';
+ return 0;
+}
+
+String g(x) {
+ events += 'g($x)\n';
+ return 'foo';
+}
+
+class B {
+ num x;
+ String y;
+ B(this.x, this.y) {
+ events += 'super($x, $y)\n';
+ }
+}
+
+class C extends B {
+ final z;
+ C()
+ : super(f(1), g(2)),
+ z = f(3);
+}
+
+main() {
+ new C();
+ if (events != 'f(1)\ng(2)\nf(3)\nsuper(0, foo)\n') {
+ throw 'Unexpected sequence of events: $events';
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698