| OLD | NEW |
| 1 part of analyzer; | 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library error_formatter; |
| 6 |
| 7 import 'dart:async'; |
| 8 import 'dart:io'; |
| 9 |
| 10 import 'generated/java_io.dart'; |
| 11 import 'generated/engine.dart'; |
| 12 import 'generated/error.dart'; |
| 13 import 'generated/source_io.dart'; |
| 14 import 'generated/sdk.dart'; |
| 15 import 'generated/sdk_io.dart'; |
| 16 import 'generated/ast.dart'; |
| 17 import 'generated/element.dart'; |
| 18 import '../options.dart'; |
| 2 | 19 |
| 3 /** | 20 /** |
| 4 * Helper for formatting [AnalysisError]s. | 21 * Helper for formatting [AnalysisError]s. |
| 5 * The two format options are a user consumable format and a machine consumable
format. | 22 * The two format options are a user consumable format and a machine consumable
format. |
| 6 */ | 23 */ |
| 7 class _ErrorFormatter { | 24 class ErrorFormatter { |
| 8 StringSink out; | 25 StringSink out; |
| 9 CommandLineOptions options; | 26 CommandLineOptions options; |
| 10 | 27 |
| 11 _ErrorFormatter(this.out, this.options); | 28 ErrorFormatter(this.out, this.options); |
| 12 | 29 |
| 13 void startAnalysis() { | 30 void startAnalysis() { |
| 14 if (!options.machineFormat) { | 31 if (!options.machineFormat) { |
| 15 out.writeln("Analyzing ${options.sourceFiles}..."); | 32 out.writeln("Analyzing ${options.sourceFiles}..."); |
| 16 } | 33 } |
| 17 } | 34 } |
| 18 | 35 |
| 19 void formatErrors(List<AnalysisErrorInfo> errorInfos) { | 36 void formatErrors(List<AnalysisErrorInfo> errorInfos) { |
| 20 var errors = new List<AnalysisError>(); | 37 var errors = new List<AnalysisError>(); |
| 21 var errorToLine = new Map<AnalysisError, LineInfo>(); | 38 var errorToLine = new Map<AnalysisError, LineInfo>(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 151 } |
| 135 | 152 |
| 136 static String pluralize(String word, int count) { | 153 static String pluralize(String word, int count) { |
| 137 if (count == 1) { | 154 if (count == 1) { |
| 138 return word; | 155 return word; |
| 139 } else { | 156 } else { |
| 140 return word + "s"; | 157 return word + "s"; |
| 141 } | 158 } |
| 142 } | 159 } |
| 143 } | 160 } |
| OLD | NEW |