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'; | |
9 import 'dart:io'; | 8 import 'dart:io'; |
10 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; | 9 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; |
11 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart'; | 10 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart'; |
12 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 11 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
13 hide Compiler; | 12 hide Compiler; |
14 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'; | 13 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'; |
15 import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.
dart'; | 14 import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.
dart'; |
16 import '../../../sdk/lib/_internal/libraries.dart'; | 15 import '../../../sdk/lib/_internal/libraries.dart'; |
17 | 16 |
18 /** | 17 /** |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 110 } |
112 super.diagnosticHandler(uri, begin, end, message, kind); | 111 super.diagnosticHandler(uri, begin, end, message, kind); |
113 } | 112 } |
114 } | 113 } |
115 | 114 |
116 void main() { | 115 void main() { |
117 var libraryRoot = currentDirectory.resolve('sdk/'); | 116 var libraryRoot = currentDirectory.resolve('sdk/'); |
118 var uriList = new List<Uri>(); | 117 var uriList = new List<Uri>(); |
119 LIBRARIES.forEach((String name, LibraryInfo info) { | 118 LIBRARIES.forEach((String name, LibraryInfo info) { |
120 if (info.documented) { | 119 if (info.documented) { |
121 uriList.add(new Uri.fromComponents(scheme: 'dart', path: name)); | 120 uriList.add(new Uri(scheme: 'dart', path: name)); |
122 } | 121 } |
123 }); | 122 }); |
124 var provider = new SourceFileProvider(); | 123 var provider = new SourceFileProvider(); |
125 var handler = new CollectingDiagnosticHandler(provider); | 124 var handler = new CollectingDiagnosticHandler(provider); |
126 var compiler = new Compiler( | 125 var compiler = new Compiler( |
127 provider.readStringFromUri, | 126 provider.readStringFromUri, |
128 null, | 127 null, |
129 handler.diagnosticHandler, | 128 handler.diagnosticHandler, |
130 libraryRoot, libraryRoot, | 129 libraryRoot, libraryRoot, |
131 <String>['--analyze-only', '--analyze-all', | 130 <String>['--analyze-only', '--analyze-all', |
132 '--categories=Client,Server']); | 131 '--categories=Client,Server']); |
133 compiler.librariesToAnalyzeWhenRun = uriList; | 132 compiler.librariesToAnalyzeWhenRun = uriList; |
134 compiler.run(null); | 133 compiler.run(null); |
135 Expect.isFalse(handler.hasWarnings); | 134 Expect.isFalse(handler.hasWarnings); |
136 Expect.isFalse(handler.hasErrors); | 135 Expect.isFalse(handler.hasErrors); |
137 Expect.isTrue(handler.checkWhiteListUse()); | 136 Expect.isTrue(handler.checkWhiteListUse()); |
138 handler.reportWhiteListUse(); | 137 handler.reportWhiteListUse(); |
139 } | 138 } |
OLD | NEW |