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

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

Issue 15853005: Change the cmd-line output for warnings from foo.dart:line:col to foo.dart, line x, col y. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 // 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 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'generated/java_io.dart'; 10 import 'generated/java_io.dart';
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 out.write(escapePipe(source.fullName)); 117 out.write(escapePipe(source.fullName));
118 out.write('|'); 118 out.write('|');
119 out.write(location.lineNumber); 119 out.write(location.lineNumber);
120 out.write('|'); 120 out.write('|');
121 out.write(location.columnNumber); 121 out.write(location.columnNumber);
122 out.write('|'); 122 out.write('|');
123 out.write(length); 123 out.write(length);
124 out.write('|'); 124 out.write('|');
125 out.writeln(escapePipe(error.message)); 125 out.writeln(escapePipe(error.message));
126 } else { 126 } else {
127 // [warning] 'foo' is not a method or function (/Users/devoncarew/temp/foo .dart:-1:-1) 127 // [warning] 'foo' is not a... (/Users/.../tmp/foo.dart, line 1, col 2)
128 out.write('['); 128 out.write('[${severity.displayName}] ${error.message} ');
129 out.write(severity.displayName); 129 out.write('(${source.fullName}');
130 out.write('] '); 130 out.write(', line ${location.lineNumber}, col ${location.columnNumber})');
131 out.write(error.message);
132 out.write(' (');
133 out.write(source.fullName);
134 out.write(':');
135 out.write(location.lineNumber);
136 out.write(':');
137 out.write(location.columnNumber);
138 out.writeln(')');
139 } 131 }
140 } 132 }
141 133
142 static String escapePipe(String input) { 134 static String escapePipe(String input) {
143 var result = new StringBuffer(); 135 var result = new StringBuffer();
144 for (var c in input.codeUnits) { 136 for (var c in input.codeUnits) {
145 if (c == '\\' || c == '|') { 137 if (c == '\\' || c == '|') {
146 result.write('\\'); 138 result.write('\\');
147 } 139 }
148 result.writeCharCode(c); 140 result.writeCharCode(c);
149 } 141 }
150 return result.toString(); 142 return result.toString();
151 } 143 }
152 144
153 static String pluralize(String word, int count) { 145 static String pluralize(String word, int count) {
154 if (count == 1) { 146 if (count == 1) {
155 return word; 147 return word;
156 } else { 148 } else {
157 return word + "s"; 149 return word + "s";
158 } 150 }
159 } 151 }
160 } 152 }
OLDNEW
« no previous file with comments | « editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/ErrorFormatter.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698