OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer_cli.src.analyzer_impl; | 5 library analyzer_cli.src.analyzer_impl; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 Future<ErrorSeverity> _analyze( | 163 Future<ErrorSeverity> _analyze( |
164 int printMode, ErrorFormatter formatter) async { | 164 int printMode, ErrorFormatter formatter) async { |
165 // Don't try to analyze parts. | 165 // Don't try to analyze parts. |
166 String path = librarySource.fullName; | 166 String path = librarySource.fullName; |
167 SourceKind librarySourceKind = analysisDriver != null | 167 SourceKind librarySourceKind = analysisDriver != null |
168 ? await analysisDriver.getSourceKind(path) | 168 ? await analysisDriver.getSourceKind(path) |
169 : context.computeKindOf(librarySource); | 169 : context.computeKindOf(librarySource); |
170 if (librarySourceKind == SourceKind.PART) { | 170 if (librarySourceKind == SourceKind.PART) { |
171 stderr.writeln("Only libraries can be analyzed."); | 171 stderr.writeln("Only libraries can be analyzed."); |
172 stderr.writeln("${path} is a part and can not be analyzed."); | 172 stderr.writeln("$path is a part and can not be analyzed."); |
173 return ErrorSeverity.ERROR; | 173 return ErrorSeverity.ERROR; |
174 } | 174 } |
175 | 175 |
176 LibraryElement libraryElement = await _resolveLibrary(); | 176 LibraryElement libraryElement = await _resolveLibrary(); |
177 prepareSources(libraryElement); | 177 prepareSources(libraryElement); |
178 await prepareErrors(); | 178 await prepareErrors(); |
179 | 179 |
180 // Print errors and performance numbers. | 180 // Print errors and performance numbers. |
181 if (printMode == 1) { | 181 if (printMode == 1) { |
182 formatter.formatErrors(errorInfos); | 182 formatter.formatErrors(errorInfos); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 } | 303 } |
304 | 304 |
305 @override | 305 @override |
306 void logInformation(String message, [CaughtException exception]) { | 306 void logInformation(String message, [CaughtException exception]) { |
307 outSink.writeln(message); | 307 outSink.writeln(message); |
308 if (exception != null) { | 308 if (exception != null) { |
309 outSink.writeln(exception); | 309 outSink.writeln(exception); |
310 } | 310 } |
311 } | 311 } |
312 } | 312 } |
OLD | NEW |