Chromium Code Reviews

Side by Side 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.
Jump to:
View unified diff |
« no previous file with comments | « tests/language_strong/field_override5_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "package:expect/expect.dart";
6 import "package:meta/meta.dart";
7
8 abstract class A {
9 get x1;
10 get x3;
11 @virtual
12 var x5 = 1;
13 @virtual
14 var x6 = 1;
15 @virtual
16 var x8 = 1;
17 @virtual
18 var x9 = 1;
19
20 @virtual
21 var xB = 1;
22 @virtual
23 var xC = 1;
24 @virtual
25 var xE = 1;
26 @virtual
27 var xF = 1;
28 }
29
30 abstract class B extends A {
31 @virtual
32 var x1 = 2;
33 @virtual
34 var x3 = 2;
35
36 get x5;
37 get x6;
38
39 set x8(v);
40 set x9(v);
41
42 get xB;
43 set xB(v) {
44 super.xB = v;
45 }
46
47 get xC;
48 set xC(v) {
49 super.xC = v;
50 }
51
52 get xE => super.xE;
53 set xE(v);
54 get xF => super.xF;
55 set xF(v);
56 }
57
58 class C extends B {
59 var x1 = 3;
60 get x1_ => 3;
61
62 get x2 => super.x1;
63 get x2_ => 2;
64
65 get x3 => 3;
66 get x3_ => 3;
67
68 get x4 => super.x3;
69 get x4_ => 2;
70
71 get x5;
72 get x5_ => 1;
73
74 get x6;
75 get x6_ => 1;
76
77 get x7 => super.x6;
78 get x7_ => 1;
79
80 get x8;
81 get x8_ => 1;
82
83 get x9;
84 get x9_ => 1;
85
86 get xA => super.x9;
87 get xA_ => 1;
88
89 get xB;
90 get xB_ => 1;
91
92 get xC;
93 get xC_ => 1;
94
95 get xD => super.xC;
96 get xD_ => 1;
97
98 get xE;
99 get xE_ => 1;
100
101 get xF;
102 get xF_ => 1;
103
104 get xG => super.xF;
105 get xG_ => 1;
106 }
107
108 main() {
109 var c = new C();
110 Expect.equals(c.x1_, c.x1);
111 Expect.equals(c.x2_, c.x2);
112 Expect.equals(c.x3_, c.x3);
113 Expect.equals(c.x4_, c.x4);
114 Expect.equals(c.x5_, c.x5);
115 Expect.equals(c.x6_, c.x6);
116 Expect.equals(c.x7_, c.x7);
117 Expect.equals(c.x8_, c.x8);
118 Expect.equals(c.x9_, c.x9);
119 Expect.equals(c.xA_, c.xA);
120 Expect.equals(c.xB_, c.xB);
121 Expect.equals(c.xC_, c.xC);
122 Expect.equals(c.xD_, c.xD);
123 Expect.equals(c.xE_, c.xE);
124 Expect.equals(c.xF_, c.xF);
125 Expect.equals(c.xG_, c.xG);
126 }
OLDNEW
« 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