OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 A { | 5 class A { |
6 A() { NamingTest.count++; } | 6 A() { NamingTest.count++; } |
7 foo(a, b) { | 7 foo(a, b) { |
8 Expect.equals(1, a); | 8 Expect.equals(1, a); |
9 Expect.equals(2, b); | 9 Expect.equals(2, b); |
10 } | 10 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 Expect.equals(12, this.__PROTO__$()); | 151 Expect.equals(12, this.__PROTO__$()); |
152 Expect.equals(10, this.prototype$()); | 152 Expect.equals(10, this.prototype$()); |
153 Expect.equals(12, __PROTO__$()); | 153 Expect.equals(12, __PROTO__$()); |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 class Bug4082360 { | 157 class Bug4082360 { |
158 int x_; | 158 int x_; |
159 Bug4082360() {} | 159 Bug4082360() {} |
160 | 160 |
161 int get x() { return x_; } | 161 int get x { return x_; } |
162 void set x(int value) { x_ = value; } | 162 void set x(int value) { x_ = value; } |
163 | 163 |
164 void indirectSet(int value) { x = value; } | 164 void indirectSet(int value) { x = value; } |
165 | 165 |
166 static void test() { | 166 static void test() { |
167 var bug = new Bug4082360(); | 167 var bug = new Bug4082360(); |
168 bug.indirectSet(42); | 168 bug.indirectSet(42); |
169 Expect.equals(42, bug.x_); | 169 Expect.equals(42, bug.x_); |
170 Expect.equals(42, bug.x); | 170 Expect.equals(42, bug.x); |
171 } | 171 } |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 498 |
499 static void main(args) { | 499 static void main(args) { |
500 var a = new Naming1Test.foo(); | 500 var a = new Naming1Test.foo(); |
501 a.foo(); | 501 a.foo(); |
502 } | 502 } |
503 } | 503 } |
504 | 504 |
505 // Ensure we don't have false positive. | 505 // Ensure we don't have false positive. |
506 class Naming2Test { | 506 class Naming2Test { |
507 Naming2Test() { } | 507 Naming2Test() { } |
508 int get foo() { return 1; } | 508 int get foo { return 1; } |
509 set foo(x) { } | 509 set foo(x) { } |
510 | 510 |
511 static void main(args) { | 511 static void main(args) { |
512 var a = new Naming2Test(); | 512 var a = new Naming2Test(); |
513 Expect.throws(() => a.foo(2), (e) => e is ObjectNotClosureException); | 513 Expect.throws(() => a.foo(2), (e) => e is ObjectNotClosureException); |
514 } | 514 } |
515 } | 515 } |
516 | 516 |
517 main() { | 517 main() { |
518 NamingTest.testMain(); | 518 NamingTest.testMain(); |
519 Naming1Test.main(null); | 519 Naming1Test.main(null); |
520 Naming2Test.main(null); | 520 Naming2Test.main(null); |
521 } | 521 } |
OLD | NEW |