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

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

Issue 9186037: Issue 986: Static type warning when overriding static super members (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updating enum name Created 8 years, 11 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 | compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 eb6b2bef12ea442a17dabeaf191424396a81359c..f8ac492f35abbe98ae49f486d2b6f5f70df25eae 100644
--- a/compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java
+++ b/compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java
@@ -20,9 +20,15 @@ import java.io.Reader;
* extra line underlying the portion of the line containing the error.
*/
public class PrettyErrorFormatter extends DefaultErrorFormatter {
- private static String RED_BOLD_COLOR = "\033[31;1m";
- private static String RED_COLOR = "\033[31m";
- private static String NO_COLOR = "\033[0m";
+ public static final String ERROR_BOLD_COLOR = "\033[31;1m";
+ public static final String ERROR_COLOR = "\033[31m";
+
+ // Mix ANSI with xterm colors, giving ANSI priority. The terminal should ignore xterm codes
+ // if it doesn't support them.
+ public static final String WARNING_BOLD_COLOR = "\033[33;1m\033[38;5;202m";
+ public static final String WARNING_COLOR = "\033[33m\033[38;5;208m";
+
+ public static final String NO_COLOR = "\033[0m";
private final boolean useColor;
@@ -76,7 +82,8 @@ public class PrettyErrorFormatter extends DefaultErrorFormatter {
// print the error message
StringBuilder buf = new StringBuilder();
if (useColor) {
- buf.append(RED_BOLD_COLOR);
+ buf.append(event.getErrorCode().getErrorSeverity() == ErrorSeverity.WARNING
+ ? WARNING_BOLD_COLOR : ERROR_BOLD_COLOR);
}
if (errorFormat == ErrorFormat.MACHINE) {
buf.append(String.format(
@@ -113,7 +120,8 @@ public class PrettyErrorFormatter extends DefaultErrorFormatter {
buf.append(String.format("%6d: %s%s%s%s%s\n",
line,
lineText.substring(0, col),
- RED_COLOR,
+ event.getErrorCode().getErrorSeverity() == ErrorSeverity.WARNING
+ ? WARNING_COLOR : ERROR_COLOR,
lineText.substring(col, col + length),
NO_COLOR,
lineText.substring(col + length)));
@@ -154,7 +162,7 @@ public class PrettyErrorFormatter extends DefaultErrorFormatter {
// TODO(sigmund): do something more efficient - we currently do a linear
// scan of the file every time an error is reported. This will not scale
// when many errors are reported on the same file.
- while ((currentLine = reader.readLine()) != null && line-- > 1);
+ while ((currentLine = reader.readLine()) != null && line-- > 1){}
return currentLine;
}
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698