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