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

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

Issue 14998006: Add some user-friendly utility functions to pkg/analyzer_experimental. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
OLDNEW
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
scheglov 2013/05/09 01:26:46 Missing library directive?
5 import 'dart:async';
6 import 'dart:io';
7
8 import 'generated/java_io.dart';
9 import 'generated/engine.dart';
10 import 'generated/error.dart';
11 import 'generated/source_io.dart';
12 import 'generated/sdk.dart';
13 import 'generated/sdk_io.dart';
14 import 'generated/ast.dart';
15 import 'generated/element.dart';
16 import '../options.dart';
2 17
3 /** 18 /**
4 * Helper for formatting [AnalysisError]s. 19 * Helper for formatting [AnalysisError]s.
5 * The two format options are a user consumable format and a machine consumable format. 20 * The two format options are a user consumable format and a machine consumable format.
6 */ 21 */
7 class _ErrorFormatter { 22 class ErrorFormatter {
8 StringSink out; 23 StringSink out;
9 CommandLineOptions options; 24 CommandLineOptions options;
10 25
11 _ErrorFormatter(this.out, this.options); 26 ErrorFormatter(this.out, this.options);
12 27
13 void startAnalysis() { 28 void startAnalysis() {
14 if (!options.machineFormat) { 29 if (!options.machineFormat) {
15 out.writeln("Analyzing ${options.sourceFiles}..."); 30 out.writeln("Analyzing ${options.sourceFiles}...");
16 } 31 }
17 } 32 }
18 33
19 void formatErrors(List<AnalysisErrorInfo> errorInfos) { 34 void formatErrors(List<AnalysisErrorInfo> errorInfos) {
20 var errors = new List<AnalysisError>(); 35 var errors = new List<AnalysisError>();
21 var errorToLine = new Map<AnalysisError, LineInfo>(); 36 var errorToLine = new Map<AnalysisError, LineInfo>();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 149 }
135 150
136 static String pluralize(String word, int count) { 151 static String pluralize(String word, int count) {
137 if (count == 1) { 152 if (count == 1) {
138 return word; 153 return word;
139 } else { 154 } else {
140 return word + "s"; 155 return word + "s";
141 } 156 }
142 } 157 }
143 } 158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698