Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: pkg/analyzer/lib/src/error_formatter.dart

Issue 975453004: Reformat (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/cancelable_future.dart ('k') | pkg/analyzer/lib/src/generated/ast.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 error_formatter; 5 library error_formatter;
6 6
7 import 'package:analyzer/src/analyzer_impl.dart'; 7 import 'package:analyzer/src/analyzer_impl.dart';
8 8
9 import '../options.dart'; 9 import '../options.dart';
10 import 'generated/engine.dart'; 10 import 'generated/engine.dart';
(...skipping 10 matching lines...) Expand all
21 * Helper for formatting [AnalysisError]s. 21 * Helper for formatting [AnalysisError]s.
22 * 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.
23 */ 23 */
24 class ErrorFormatter { 24 class ErrorFormatter {
25 final StringSink out; 25 final StringSink out;
26 final CommandLineOptions options; 26 final CommandLineOptions options;
27 final _ErrorFilter errorFilter; 27 final _ErrorFilter errorFilter;
28 28
29 ErrorFormatter(this.out, this.options, [this.errorFilter = _anyError]); 29 ErrorFormatter(this.out, this.options, [this.errorFilter = _anyError]);
30 30
31 void formatError(Map<AnalysisError, LineInfo> errorToLine, 31 void formatError(
32 AnalysisError error) { 32 Map<AnalysisError, LineInfo> errorToLine, AnalysisError error) {
33 Source source = error.source; 33 Source source = error.source;
34 LineInfo_Location location = errorToLine[error].getLocation(error.offset); 34 LineInfo_Location location = errorToLine[error].getLocation(error.offset);
35 int length = error.length; 35 int length = error.length;
36 ErrorSeverity severity = 36 ErrorSeverity severity =
37 AnalyzerImpl.computeSeverity(error, options.enableTypeChecks); 37 AnalyzerImpl.computeSeverity(error, options.enableTypeChecks);
38 if (options.machineFormat) { 38 if (options.machineFormat) {
39 if (severity == ErrorSeverity.WARNING && options.warningsAreFatal) { 39 if (severity == ErrorSeverity.WARNING && options.warningsAreFatal) {
40 severity = ErrorSeverity.ERROR; 40 severity = ErrorSeverity.ERROR;
41 } 41 }
42 out.write(severity); 42 out.write(severity);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // severity 84 // severity
85 ErrorSeverity severity1 = 85 ErrorSeverity severity1 =
86 AnalyzerImpl.computeSeverity(error1, options.enableTypeChecks); 86 AnalyzerImpl.computeSeverity(error1, options.enableTypeChecks);
87 ErrorSeverity severity2 = 87 ErrorSeverity severity2 =
88 AnalyzerImpl.computeSeverity(error2, options.enableTypeChecks); 88 AnalyzerImpl.computeSeverity(error2, options.enableTypeChecks);
89 int compare = severity2.compareTo(severity1); 89 int compare = severity2.compareTo(severity1);
90 if (compare != 0) { 90 if (compare != 0) {
91 return compare; 91 return compare;
92 } 92 }
93 // path 93 // path
94 compare = Comparable.compare( 94 compare = Comparable.compare(error1.source.fullName.toLowerCase(),
95 error1.source.fullName.toLowerCase(),
96 error2.source.fullName.toLowerCase()); 95 error2.source.fullName.toLowerCase());
97 if (compare != 0) { 96 if (compare != 0) {
98 return compare; 97 return compare;
99 } 98 }
100 // offset 99 // offset
101 return error1.offset - error2.offset; 100 return error1.offset - error2.offset;
102 }); 101 });
103 // format errors 102 // format errors
104 int errorCount = 0; 103 int errorCount = 0;
105 int warnCount = 0; 104 int warnCount = 0;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 192 }
194 193
195 static String pluralize(String word, int count) { 194 static String pluralize(String word, int count) {
196 if (count == 1) { 195 if (count == 1) {
197 return word; 196 return word;
198 } else { 197 } else {
199 return word + "s"; 198 return word + "s";
200 } 199 }
201 } 200 }
202 } 201 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/cancelable_future.dart ('k') | pkg/analyzer/lib/src/generated/ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698