| 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.build_mode; | 5 library analyzer_cli.src.build_mode; |
| 6 | 6 |
| 7 import 'dart:core'; | 7 import 'dart:core'; |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart' show CompilationUnit; | 10 import 'package:analyzer/dart/ast/ast.dart' show CompilationUnit; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 return _computeMaxSeverity(); | 218 return _computeMaxSeverity(); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 ErrorSeverity _computeMaxSeverity() { | 222 ErrorSeverity _computeMaxSeverity() { |
| 223 ErrorSeverity maxSeverity = ErrorSeverity.NONE; | 223 ErrorSeverity maxSeverity = ErrorSeverity.NONE; |
| 224 if (!options.buildSuppressExitCode) { | 224 if (!options.buildSuppressExitCode) { |
| 225 for (Source source in explicitSources) { | 225 for (Source source in explicitSources) { |
| 226 AnalysisErrorInfo errorInfo = context.getErrors(source); | 226 AnalysisErrorInfo errorInfo = context.getErrors(source); |
| 227 for (AnalysisError error in errorInfo.errors) { | 227 for (AnalysisError error in errorInfo.errors) { |
| 228 ProcessedSeverity processedSeverity = | 228 ProcessedSeverity processedSeverity = AnalyzerImpl.processError( |
| 229 AnalyzerImpl.processError(error, options, context); | 229 error, options, context.analysisOptions); |
| 230 if (processedSeverity != null) { | 230 if (processedSeverity != null) { |
| 231 maxSeverity = maxSeverity.max(processedSeverity.severity); | 231 maxSeverity = maxSeverity.max(processedSeverity.severity); |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 return maxSeverity; | 236 return maxSeverity; |
| 237 } | 237 } |
| 238 | 238 |
| 239 void _createContext() { | 239 void _createContext() { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 * Print errors for all explicit sources. If [outputPath] is supplied, output | 312 * Print errors for all explicit sources. If [outputPath] is supplied, output |
| 313 * is sent to a new file at that path. | 313 * is sent to a new file at that path. |
| 314 */ | 314 */ |
| 315 void _printErrors({String outputPath}) { | 315 void _printErrors({String outputPath}) { |
| 316 StringBuffer buffer = new StringBuffer(); | 316 StringBuffer buffer = new StringBuffer(); |
| 317 ErrorFormatter formatter = new ErrorFormatter( | 317 ErrorFormatter formatter = new ErrorFormatter( |
| 318 buffer, | 318 buffer, |
| 319 options, | 319 options, |
| 320 stats, | 320 stats, |
| 321 (AnalysisError error) => | 321 (AnalysisError error) => |
| 322 AnalyzerImpl.processError(error, options, context)); | 322 AnalyzerImpl.processError(error, options, context.analysisOptions)); |
| 323 for (Source source in explicitSources) { | 323 for (Source source in explicitSources) { |
| 324 AnalysisErrorInfo errorInfo = context.getErrors(source); | 324 AnalysisErrorInfo errorInfo = context.getErrors(source); |
| 325 formatter.formatErrors([errorInfo]); | 325 formatter.formatErrors([errorInfo]); |
| 326 } | 326 } |
| 327 if (!options.machineFormat) { | 327 if (!options.machineFormat) { |
| 328 stats.print(buffer); | 328 stats.print(buffer); |
| 329 } | 329 } |
| 330 if (outputPath == null) { | 330 if (outputPath == null) { |
| 331 StringSink sink = options.machineFormat ? errorSink : outSink; | 331 StringSink sink = options.machineFormat ? errorSink : outSink; |
| 332 sink.write(buffer); | 332 sink.write(buffer); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 * Build the inverse mapping of [uriToSourceMap]. | 416 * Build the inverse mapping of [uriToSourceMap]. |
| 417 */ | 417 */ |
| 418 static Map<String, Uri> _computePathToUriMap(Map<Uri, File> uriToSourceMap) { | 418 static Map<String, Uri> _computePathToUriMap(Map<Uri, File> uriToSourceMap) { |
| 419 Map<String, Uri> pathToUriMap = <String, Uri>{}; | 419 Map<String, Uri> pathToUriMap = <String, Uri>{}; |
| 420 uriToSourceMap.forEach((Uri uri, File file) { | 420 uriToSourceMap.forEach((Uri uri, File file) { |
| 421 pathToUriMap[file.path] = uri; | 421 pathToUriMap[file.path] = uri; |
| 422 }); | 422 }); |
| 423 return pathToUriMap; | 423 return pathToUriMap; |
| 424 } | 424 } |
| 425 } | 425 } |
| OLD | NEW |