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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import 'mock_compiler.dart'; | 6 import 'mock_compiler.dart'; |
7 | 7 |
8 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; | 8 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; |
9 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 9 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
10 hide SourceString; | 10 hide SourceString; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 import '$PRIVATE_SOURCE_URI'; | 62 import '$PRIVATE_SOURCE_URI'; |
63 | 63 |
64 void main() { | 64 void main() { |
65 PublicClass publicClass; | 65 PublicClass publicClass; |
66 $text | 66 $text |
67 } | 67 } |
68 '''; | 68 '''; |
69 Uri uri = Uri.parse('src:public'); | 69 Uri uri = Uri.parse('src:public'); |
70 compiler.registerSource(uri, source); | 70 compiler.registerSource(uri, source); |
71 compiler.runCompiler(uri); | 71 compiler.runCompiler(uri).then((_) { |
72 compareWarningKinds(text, expectedWarnings, compiler.warnings); | 72 compareWarningKinds(text, expectedWarnings, compiler.warnings); |
| 73 }); |
73 } | 74 } |
74 | 75 |
75 void main() { | 76 void main() { |
76 // Read from private variable. | 77 // Read from private variable. |
77 analyze('var value = _privateVariable;', MessageKind.CANNOT_RESOLVE.warning); | 78 analyze('var value = _privateVariable;', MessageKind.CANNOT_RESOLVE.warning); |
78 // Write to private variable. | 79 // Write to private variable. |
79 analyze('_privateVariable = 0;', MessageKind.CANNOT_RESOLVE.warning); | 80 analyze('_privateVariable = 0;', MessageKind.CANNOT_RESOLVE.warning); |
80 // Access private function. | 81 // Access private function. |
81 analyze('var value = _privateFunction;', MessageKind.CANNOT_RESOLVE.warning); | 82 analyze('var value = _privateFunction;', MessageKind.CANNOT_RESOLVE.warning); |
82 // Call private function. | 83 // Call private function. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // Call public getter on public class. | 158 // Call public getter on public class. |
158 analyze('var value = publicClass.publicGetter;'); | 159 analyze('var value = publicClass.publicGetter;'); |
159 // Call public setter on public class. | 160 // Call public setter on public class. |
160 analyze('publicClass.publicSetter = 0;'); | 161 analyze('publicClass.publicSetter = 0;'); |
161 // Access public method on public class. | 162 // Access public method on public class. |
162 analyze('var value = publicClass.publicMethod;'); | 163 analyze('var value = publicClass.publicMethod;'); |
163 // Call public method on public class. | 164 // Call public method on public class. |
164 analyze('publicClass.publicMethod();'); | 165 analyze('publicClass.publicMethod();'); |
165 } | 166 } |
166 | 167 |
OLD | NEW |