| 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 library analyze_api; | 5 library analyze_api; |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import 'dart:uri'; | 8 import 'dart:uri'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; | 10 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // Suppress white listed warnings. | 100 // Suppress white listed warnings. |
| 101 return; | 101 return; |
| 102 } | 102 } |
| 103 hasErrors = true; | 103 hasErrors = true; |
| 104 } | 104 } |
| 105 super.diagnosticHandler(uri, begin, end, message, kind); | 105 super.diagnosticHandler(uri, begin, end, message, kind); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 void main() { | 109 void main() { |
| 110 Uri currentWorkingDirectory = getCurrentDirectory(); | 110 var libraryRoot = currentDirectory.resolve('sdk/'); |
| 111 var libraryRoot = currentWorkingDirectory.resolve('sdk/'); | |
| 112 var uriList = new List<Uri>(); | 111 var uriList = new List<Uri>(); |
| 113 LIBRARIES.forEach((String name, LibraryInfo info) { | 112 LIBRARIES.forEach((String name, LibraryInfo info) { |
| 114 if (info.documented) { | 113 if (info.documented) { |
| 115 uriList.add(new Uri.fromComponents(scheme: 'dart', path: name)); | 114 uriList.add(new Uri.fromComponents(scheme: 'dart', path: name)); |
| 116 } | 115 } |
| 117 }); | 116 }); |
| 118 var provider = new SourceFileProvider(); | 117 var provider = new SourceFileProvider(); |
| 119 var handler = new CollectingDiagnosticHandler(provider); | 118 var handler = new CollectingDiagnosticHandler(provider); |
| 120 var compiler = new Compiler( | 119 var compiler = new Compiler( |
| 121 provider.readStringFromUri, | 120 provider.readStringFromUri, |
| 122 null, | 121 null, |
| 123 handler.diagnosticHandler, | 122 handler.diagnosticHandler, |
| 124 libraryRoot, libraryRoot, | 123 libraryRoot, libraryRoot, |
| 125 <String>['--analyze-only', '--analyze-all', | 124 <String>['--analyze-only', '--analyze-all', |
| 126 '--categories=Client,Server']); | 125 '--categories=Client,Server']); |
| 127 compiler.librariesToAnalyzeWhenRun = uriList; | 126 compiler.librariesToAnalyzeWhenRun = uriList; |
| 128 compiler.run(null); | 127 compiler.run(null); |
| 129 Expect.isFalse(handler.hasWarnings); | 128 Expect.isFalse(handler.hasWarnings); |
| 130 Expect.isFalse(handler.hasErrors); | 129 Expect.isFalse(handler.hasErrors); |
| 131 Expect.isTrue(handler.checkWhiteListUse()); | 130 Expect.isTrue(handler.checkWhiteListUse()); |
| 132 handler.reportWhiteListUse(); | 131 handler.reportWhiteListUse(); |
| 133 } | 132 } |
| OLD | NEW |