| 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); | 78 analyze('var value = _privateVariable;', MessageKind.CANNOT_RESOLVE); |
| 78 // Write to private variable. | 79 // Write to private variable. |
| 79 analyze('_privateVariable = 0;', MessageKind.CANNOT_RESOLVE); | 80 analyze('_privateVariable = 0;', MessageKind.CANNOT_RESOLVE); |
| 80 // Access private function. | 81 // Access private function. |
| 81 analyze('var value = _privateFunction;', MessageKind.CANNOT_RESOLVE); | 82 analyze('var value = _privateFunction;', MessageKind.CANNOT_RESOLVE); |
| 82 // Call private function. | 83 // Call private function. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // Call public getter on public class. | 157 // Call public getter on public class. |
| 157 analyze('var value = publicClass.publicGetter;'); | 158 analyze('var value = publicClass.publicGetter;'); |
| 158 // Call public setter on public class. | 159 // Call public setter on public class. |
| 159 analyze('publicClass.publicSetter = 0;'); | 160 analyze('publicClass.publicSetter = 0;'); |
| 160 // Access public method on public class. | 161 // Access public method on public class. |
| 161 analyze('var value = publicClass.publicMethod;'); | 162 analyze('var value = publicClass.publicMethod;'); |
| 162 // Call public method on public class. | 163 // Call public method on public class. |
| 163 analyze('publicClass.publicMethod();'); | 164 analyze('publicClass.publicMethod();'); |
| 164 } | 165 } |
| 165 | 166 |
| OLD | NEW |