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

Side by Side Diff: tests/language/src/GettersSettersTest.dart

Issue 10115005: Static members are not visible in subclasses (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/co19/co19-runtime.status ('k') | tests/language/src/PrivateMemberTest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class GettersSettersTest { 5 class GettersSettersTest {
6 6
7 static int foo; 7 static int foo;
8 8
9 static testMain() { 9 static testMain() {
10 A a = new A(); 10 A a = new A();
11 a.x = 2; 11 a.x = 2;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 ReferenceField rf = new ReferenceField(); 53 ReferenceField rf = new ReferenceField();
54 rf.x_ = 1; 54 rf.x_ = 1;
55 Expect.equals(1, rf.getIt()); 55 Expect.equals(1, rf.getIt());
56 rf.setIt(2); 56 rf.setIt(2);
57 Expect.equals(2, rf.x_); 57 Expect.equals(2, rf.x_);
58 } 58 }
59 } 59 }
60 60
61 class A { 61 class A {
62 // TODO(fabiofmv): consider removing once http://b/4254120 is fixed.
63 A() { }
64 int x_; 62 int x_;
65 static int foo; 63 static int foo;
66 64
67 static get bar() { 65 static get bar() {
68 return foo; 66 return foo;
69 } 67 }
70 68
71 static set bar(newValue) { 69 static set bar(newValue) {
72 foo = newValue; 70 foo = newValue;
73 } 71 }
(...skipping 16 matching lines...) Expand all
90 88
91 void operator []=(int index, int value) { 89 void operator []=(int index, int value) {
92 x_ = index + value; 90 x_ = index + value;
93 } 91 }
94 92
95 int getX_() { 93 int getX_() {
96 return x_; 94 return x_;
97 } 95 }
98 } 96 }
99 97
100 class B extends A { 98 class B extends A { }
101 B() : super() {}
102 }
103 99
104 class C extends A { 100 class C extends A {
105 int y_; 101 int y_;
106 102
107 C() : super() { 103 C() : super() {
108 this.x_ = 0; 104 this.x_ = 0;
109 } 105 }
110 106
111 int get x() { 107 int get x() {
112 return y_; 108 return y_;
113 } 109 }
114 110
115 void set x(int value) { 111 void set x(int value) {
116 y_ = value; 112 y_ = value;
117 } 113 }
118 } 114 }
119 115
120 class D extends A { 116 class D extends A {
121 D() : super() {}
122
123 var x2_; 117 var x2_;
124 118
125 set x(new_x) { 119 set x(new_x) {
126 x2_ = new_x; 120 x2_ = new_x;
127 } 121 }
128 122
129 test() { 123 test() {
130 x = 87; 124 x = 87;
131 Expect.equals(87, x2_); 125 Expect.equals(87, x2_);
132 x = 42; 126 x = 42;
133 Expect.equals(42, x2_); 127 Expect.equals(42, x2_);
134
135 foo = 0;
136 Expect.equals(0, bar);
137 bar = 1;
138 Expect.equals(1, foo);
139 var tmp = foo;
140 foo += 3;
141 Expect.equals(4, bar);
142 bar += 5;
143 Expect.equals(9, foo);
144 } 128 }
145 } 129 }
146 130
147 class OverrideField extends A { 131 class OverrideField extends A {
148 OverrideField() : super() {}
149
150 int get x_() { 132 int get x_() {
151 return 27; 133 return 27;
152 } 134 }
153 } 135 }
154 136
155 class ReferenceField extends A { 137 class ReferenceField extends A {
156 ReferenceField() : super() {}
157
158 setIt(a) { 138 setIt(a) {
159 super.x_ = a; 139 super.x_ = a;
160 } 140 }
161 141
162 int getIt() { 142 int getIt() {
163 return super.x_; 143 return super.x_;
164 } 144 }
165 } 145 }
166 146
167 main() { 147 main() {
168 GettersSettersTest.testMain(); 148 GettersSettersTest.testMain();
169 } 149 }
OLDNEW
« no previous file with comments | « tests/co19/co19-runtime.status ('k') | tests/language/src/PrivateMemberTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698