OLD | NEW |
1 // Copyright (c) 2012, 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 // Dart test for testing access to private fields. | 5 // Dart test for testing access to private fields. |
6 | 6 |
7 part of PrivateTest.dart; | 7 part of PrivateTest.dart; |
8 | 8 |
9 main() { | 9 main() { |
10 testPrivateTopLevel(); | 10 testPrivateTopLevel(); |
11 testPrivateClasses(); | 11 testPrivateClasses(); |
12 } | 12 } |
13 | 13 |
14 void expectCatch(f) { | 14 void expectCatch(f) { |
15 bool threw = false; | 15 bool threw = false; |
16 try { | 16 try { |
17 f(); | 17 f(); |
(...skipping 30 matching lines...) Expand all Loading... |
48 | 48 |
49 class C1 { | 49 class C1 { |
50 int _field1; | 50 int _field1; |
51 C1() : _field1 = 499; | 51 C1() : _field1 = 499; |
52 | 52 |
53 field1a() => _field1; | 53 field1a() => _field1; |
54 } | 54 } |
55 | 55 |
56 class C3 extends C2 { | 56 class C3 extends C2 { |
57 int _field2; | 57 int _field2; |
58 C3() : super(), _field2 = 42; | 58 C3() |
| 59 : super(), |
| 60 _field2 = 42; |
59 | 61 |
60 field2a() => _field2; | 62 field2a() => _field2; |
61 field1c() => _field1; | 63 field1c() => _field1; |
62 } | 64 } |
63 | 65 |
64 int c_field1a(c) => c._field1; | 66 int c_field1a(c) => c._field1; |
65 int c_field2a(c) => c._field2; | 67 int c_field2a(c) => c._field2; |
66 | 68 |
67 int _field1FromNewC4() => new C4()._field1; | 69 int _field1FromNewC4() => new C4()._field1; |
68 int _field2FromNewC4() => new C4()._field2; | 70 int _field2FromNewC4() => new C4()._field2; |
(...skipping 21 matching lines...) Expand all Loading... |
90 Expect.equals(42, c.field2a()); | 92 Expect.equals(42, c.field2a()); |
91 Expect.equals(99, LibOther3.c_field1b(c)); | 93 Expect.equals(99, LibOther3.c_field1b(c)); |
92 Expect.equals(99, c.field1b()); | 94 Expect.equals(99, c.field1b()); |
93 Expect.equals(1024, LibOther3.c_field2b(c)); | 95 Expect.equals(1024, LibOther3.c_field2b(c)); |
94 Expect.equals(1024, c.field2b()); | 96 Expect.equals(1024, c.field2b()); |
95 Expect.equals(499, c.field1c()); | 97 Expect.equals(499, c.field1c()); |
96 Expect.equals(99, c.field1d()); | 98 Expect.equals(99, c.field1d()); |
97 Expect.equals(499, _field1FromNewC4()); | 99 Expect.equals(499, _field1FromNewC4()); |
98 Expect.equals(42, _field2FromNewC4()); | 100 Expect.equals(42, _field2FromNewC4()); |
99 } | 101 } |
OLD | NEW |