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

Unified Diff: pkg/analyzer_cli/lib/src/error_formatter.dart

Issue 2109783003: Fix pipe escaping. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_cli/lib/src/error_formatter.dart
diff --git a/pkg/analyzer_cli/lib/src/error_formatter.dart b/pkg/analyzer_cli/lib/src/error_formatter.dart
index c43fcd8ab61fa54a9216af9b132901235b58b270..e0c9a8eef6fe67bf028470d0dfcdebcaeedac246 100644
--- a/pkg/analyzer_cli/lib/src/error_formatter.dart
+++ b/pkg/analyzer_cli/lib/src/error_formatter.dart
@@ -105,9 +105,13 @@ class AnalysisStats {
/// The two format options are a user consumable format and a machine consumable
/// format.
class ErrorFormatter {
+ static final int _pipeCodeUnit = '|'.codeUnitAt(0);
+ static final int _slashCodeUnit = '\\'.codeUnitAt(0);
+
final StringSink out;
final CommandLineOptions options;
final AnalysisStats stats;
+
final _SeverityProcessor processSeverity;
ErrorFormatter(this.out, this.options, this.stats,
@@ -167,7 +171,6 @@ class ErrorFormatter {
}
out.writeln();
}
-
void formatErrors(List<AnalysisErrorInfo> errorInfos) {
stats.unfilteredCount += errorInfos.length;
@@ -223,9 +226,9 @@ class ErrorFormatter {
}
static String escapePipe(String input) {
- var result = new StringBuffer();
- for (var c in input.codeUnits) {
- if (c == '\\' || c == '|') {
+ StringBuffer result = new StringBuffer();
+ for (int c in input.codeUnits) {
+ if (c == _slashCodeUnit || c == _pipeCodeUnit) {
result.write('\\');
}
result.writeCharCode(c);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698