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

Unified Diff: compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java

Issue 8949055: Issue 250: Allow for GNU formatted errors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks to drop 'gnu' and stuff library in message format Created 9 years 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
Index: compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java
diff --git a/compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java b/compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java
index 9afef168e0eeff06929cf0d4aa9d45b1c351a8ca..eb6b2bef12ea442a17dabeaf191424396a81359c 100644
--- a/compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java
+++ b/compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java
@@ -5,6 +5,7 @@
package com.google.dart.compiler;
import com.google.common.io.Closeables;
+import com.google.dart.compiler.CompilerConfiguration.ErrorFormat;
import java.io.BufferedReader;
import java.io.IOException;
@@ -24,14 +25,12 @@ public class PrettyErrorFormatter extends DefaultErrorFormatter {
private static String NO_COLOR = "\033[0m";
private final boolean useColor;
- private final boolean printMachineProblems;
public PrettyErrorFormatter(PrintStream outputStream,
boolean useColor,
- boolean printMachineProblems) {
- super(outputStream);
+ ErrorFormat errorFormat) {
+ super(outputStream, errorFormat);
this.useColor = useColor;
- this.printMachineProblems = printMachineProblems;
}
@Override
@@ -79,7 +78,7 @@ public class PrettyErrorFormatter extends DefaultErrorFormatter {
if (useColor) {
buf.append(RED_BOLD_COLOR);
}
- if (printMachineProblems) {
+ if (errorFormat == ErrorFormat.MACHINE) {
buf.append(String.format(
"%s:%s:%s:%s:%d:%d:%d: %s",
event.getErrorCode().getErrorSeverity(),
@@ -91,11 +90,14 @@ public class PrettyErrorFormatter extends DefaultErrorFormatter {
length,
event.getMessage()));
} else {
+ String sourceName = sourceFile.getUri().toString();
+ String includeFrom = getImportString(sourceFile);
buf.append(String.format(
- "%s:%d: %s",
- sourceFile.getName(),
+ "%s:%d: %s%s",
+ sourceName,
event.getLineNumber(),
- event.getMessage()));
+ event.getMessage(),
+ includeFrom));
}
if (useColor) {
buf.append(NO_COLOR);

Powered by Google App Engine
This is Rietveld 408576698