| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 sources.clear(); | 157 sources.clear(); |
| 158 errorInfos.clear(); | 158 errorInfos.clear(); |
| 159 Uri libraryUri = librarySource.uri; | 159 Uri libraryUri = librarySource.uri; |
| 160 if (libraryUri.scheme == 'package' && libraryUri.pathSegments.length > 0) { | 160 if (libraryUri.scheme == 'package' && libraryUri.pathSegments.length > 0) { |
| 161 _selfPackageName = libraryUri.pathSegments[0]; | 161 _selfPackageName = libraryUri.pathSegments[0]; |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 Future<ErrorSeverity> _analyze(int printMode) async { | 165 Future<ErrorSeverity> _analyze(int printMode) async { |
| 166 // Don't try to analyze parts. | 166 // Don't try to analyze parts. |
| 167 if (context.computeKindOf(librarySource) == SourceKind.PART) { | 167 String path = librarySource.fullName; |
| 168 SourceKind librarySourceKind = analysisDriver != null |
| 169 ? await analysisDriver.getSourceKind(path) |
| 170 : context.computeKindOf(librarySource); |
| 171 if (librarySourceKind == SourceKind.PART) { |
| 168 stderr.writeln("Only libraries can be analyzed."); | 172 stderr.writeln("Only libraries can be analyzed."); |
| 169 stderr.writeln( | 173 stderr.writeln("${path} is a part and can not be analyzed."); |
| 170 "${librarySource.fullName} is a part and can not be analyzed."); | |
| 171 return ErrorSeverity.ERROR; | 174 return ErrorSeverity.ERROR; |
| 172 } | 175 } |
| 173 | 176 |
| 174 LibraryElement libraryElement = await _resolveLibrary(); | 177 LibraryElement libraryElement = await _resolveLibrary(); |
| 175 prepareSources(libraryElement); | 178 prepareSources(libraryElement); |
| 176 await prepareErrors(); | 179 await prepareErrors(); |
| 177 | 180 |
| 178 // Print errors and performance numbers. | 181 // Print errors and performance numbers. |
| 179 if (printMode == 1) { | 182 if (printMode == 1) { |
| 180 _printErrors(); | 183 _printErrors(); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 } | 382 } |
| 380 | 383 |
| 381 @override | 384 @override |
| 382 void logInformation(String message, [CaughtException exception]) { | 385 void logInformation(String message, [CaughtException exception]) { |
| 383 outSink.writeln(message); | 386 outSink.writeln(message); |
| 384 if (exception != null) { | 387 if (exception != null) { |
| 385 outSink.writeln(exception); | 388 outSink.writeln(exception); |
| 386 } | 389 } |
| 387 } | 390 } |
| 388 } | 391 } |
| OLD | NEW |