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

Unified Diff: tests/language_strong/field_override6_test.dart

Issue 2691433004: Support virtual fields in DDC without requiring the @virtual annotation.
Patch Set: Created 3 years, 10 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
« no previous file with comments | « tests/language_strong/field_override5_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language_strong/field_override6_test.dart
diff --git a/tests/language_strong/field_override6_test.dart b/tests/language_strong/field_override6_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..937000d83c246dec753be42b657c2b908a990881
--- /dev/null
+++ b/tests/language_strong/field_override6_test.dart
@@ -0,0 +1,126 @@
+// 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.
+
+import "package:expect/expect.dart";
+import "package:meta/meta.dart";
+
+abstract class A {
+ get x1;
+ get x3;
+ @virtual
+ var x5 = 1;
+ @virtual
+ var x6 = 1;
+ @virtual
+ var x8 = 1;
+ @virtual
+ var x9 = 1;
+
+ @virtual
+ var xB = 1;
+ @virtual
+ var xC = 1;
+ @virtual
+ var xE = 1;
+ @virtual
+ var xF = 1;
+}
+
+abstract class B extends A {
+ @virtual
+ var x1 = 2;
+ @virtual
+ var x3 = 2;
+
+ get x5;
+ get x6;
+
+ set x8(v);
+ set x9(v);
+
+ get xB;
+ set xB(v) {
+ super.xB = v;
+ }
+
+ get xC;
+ set xC(v) {
+ super.xC = v;
+ }
+
+ get xE => super.xE;
+ set xE(v);
+ get xF => super.xF;
+ set xF(v);
+}
+
+class C extends B {
+ var x1 = 3;
+ get x1_ => 3;
+
+ get x2 => super.x1;
+ get x2_ => 2;
+
+ get x3 => 3;
+ get x3_ => 3;
+
+ get x4 => super.x3;
+ get x4_ => 2;
+
+ get x5;
+ get x5_ => 1;
+
+ get x6;
+ get x6_ => 1;
+
+ get x7 => super.x6;
+ get x7_ => 1;
+
+ get x8;
+ get x8_ => 1;
+
+ get x9;
+ get x9_ => 1;
+
+ get xA => super.x9;
+ get xA_ => 1;
+
+ get xB;
+ get xB_ => 1;
+
+ get xC;
+ get xC_ => 1;
+
+ get xD => super.xC;
+ get xD_ => 1;
+
+ get xE;
+ get xE_ => 1;
+
+ get xF;
+ get xF_ => 1;
+
+ get xG => super.xF;
+ get xG_ => 1;
+}
+
+main() {
+ var c = new C();
+ Expect.equals(c.x1_, c.x1);
+ Expect.equals(c.x2_, c.x2);
+ Expect.equals(c.x3_, c.x3);
+ Expect.equals(c.x4_, c.x4);
+ Expect.equals(c.x5_, c.x5);
+ Expect.equals(c.x6_, c.x6);
+ Expect.equals(c.x7_, c.x7);
+ Expect.equals(c.x8_, c.x8);
+ Expect.equals(c.x9_, c.x9);
+ Expect.equals(c.xA_, c.xA);
+ Expect.equals(c.xB_, c.xB);
+ Expect.equals(c.xC_, c.xC);
+ Expect.equals(c.xD_, c.xD);
+ Expect.equals(c.xE_, c.xE);
+ Expect.equals(c.xF_, c.xF);
+ Expect.equals(c.xG_, c.xG);
+}
« no previous file with comments | « tests/language_strong/field_override5_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698