| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "package:async_helper/async_helper.dart"; |
| 7 import 'memory_source_file_helper.dart'; | 7 import 'memory_source_file_helper.dart'; |
| 8 | 8 |
| 9 import '../../../sdk/lib/_internal/compiler/compiler.dart' | 9 import '../../../sdk/lib/_internal/compiler/compiler.dart' |
| 10 show Diagnostic; | 10 show Diagnostic; |
| 11 | 11 |
| 12 main() { | 12 main() { |
| 13 Uri script = currentDirectory.resolveUri(Platform.script); | 13 Uri script = currentDirectory.resolveUri(Platform.script); |
| 14 Uri libraryRoot = script.resolve('../../../sdk/'); | 14 Uri libraryRoot = script.resolve('../../../sdk/'); |
| 15 Uri packageRoot = script.resolve('./packages/'); | 15 Uri packageRoot = script.resolve('./packages/'); |
| 16 | 16 |
| 17 var unusedPattern = new RegExp("Hint: The method '.*' is never called\\."); | |
| 18 | |
| 19 var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES); | 17 var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES); |
| 20 var diagnostics = []; | 18 var diagnostics = []; |
| 21 void diagnosticHandler(Uri uri, int begin, int end, | 19 void diagnosticHandler(Uri uri, int begin, int end, |
| 22 String message, Diagnostic kind) { | 20 String message, Diagnostic kind) { |
| 23 if (kind == Diagnostic.VERBOSE_INFO) { | 21 if (kind == Diagnostic.VERBOSE_INFO) { |
| 24 return; | 22 return; |
| 25 } | 23 } |
| 26 if (message.startsWith(unusedPattern)) { | |
| 27 return; | |
| 28 } | |
| 29 diagnostics.add('$uri:$begin:$end:$message:$kind'); | 24 diagnostics.add('$uri:$begin:$end:$message:$kind'); |
| 30 } | 25 } |
| 31 | 26 |
| 32 Compiler compiler = new Compiler(provider.readStringFromUri, | 27 Compiler compiler = new Compiler(provider.readStringFromUri, |
| 33 (name, extension) => null, | 28 (name, extension) => null, |
| 34 diagnosticHandler, | 29 diagnosticHandler, |
| 35 libraryRoot, | 30 libraryRoot, |
| 36 packageRoot, | 31 packageRoot, |
| 37 ['--analyze-only'], | 32 ['--analyze-only'], |
| 38 {}); | 33 {}); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 hest() {} | 69 hest() {} |
| 75 """, | 70 """, |
| 76 'exporter.dart': """ | 71 'exporter.dart': """ |
| 77 library exporter; | 72 library exporter; |
| 78 | 73 |
| 79 export 'library.dart'; | 74 export 'library.dart'; |
| 80 | 75 |
| 81 hest() {} | 76 hest() {} |
| 82 """, | 77 """, |
| 83 }; | 78 }; |
| OLD | NEW |