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

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

Issue 8395013: DartC User Warning Framework (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use new ErrorCode enums in single onError() method. Created 9 years, 2 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
Index: compiler/java/com/google/dart/compiler/DefaultDartCompilerListener.java
diff --git a/compiler/java/com/google/dart/compiler/DefaultDartCompilerListener.java b/compiler/java/com/google/dart/compiler/DefaultDartCompilerListener.java
index 3b8abd594054665bcfc27dccdb5b6ca9b9a86c71..ce08479958fa1128af385076bb30476c81fc3a96 100644
--- a/compiler/java/com/google/dart/compiler/DefaultDartCompilerListener.java
+++ b/compiler/java/com/google/dart/compiler/DefaultDartCompilerListener.java
@@ -15,7 +15,7 @@ public class DefaultDartCompilerListener extends DartCompilerListener {
/**
* The number of (fatal) problems that occurred during compilation.
*/
- private int problemCount = 0;
+ private int errorCount = 0;
/**
* The number of (non-fatal) problems that occurred during compilation.
@@ -34,21 +34,15 @@ public class DefaultDartCompilerListener extends DartCompilerListener {
protected ErrorFormatter formatter = new PrettyErrorFormatter(useColor());
@Override
- public void compilationError(DartCompilationError event) {
+ public void onError(DartCompilationError event) {
formatter.format(event);
- incrementProblemCount();
- }
-
- @Override
- public void compilationWarning(DartCompilationError event) {
- formatter.format(event);
- incrementWarningCount();
- }
-
- @Override
- public void typeError(DartCompilationError event) {
- formatter.format(event);
- incrementTypeErrorCount();
+ if (event.getErrorCode().getSubSystem() == SubSystem.STATIC_TYPE) {
+ incrementTypeErrorCount();
+ } else if (event.getErrorCode().getErrorSeverity() == ErrorSeverity.ERROR) {
+ incrementErrorCount();
+ } else if (event.getErrorCode().getErrorSeverity() == ErrorSeverity.WARNING) {
+ incrementWarningCount();
+ }
}
private boolean useColor() {
@@ -56,16 +50,16 @@ public class DefaultDartCompilerListener extends DartCompilerListener {
}
/**
- * Answer the number of (fatal) problems that occurred during compilation.
+ * Answer the number of fatal errors that occurred during compilation.
*
* @return the number of problems
*/
- public int getProblemCount() {
- return problemCount;
+ public int getErrorCount() {
+ return errorCount;
}
/**
- * Answer the number of (non-fatal) problems that occurred during compilation.
+ * Answer the number of non-fatal warnings that occurred during compilation.
*
* @return the number of problems
*/
@@ -74,7 +68,7 @@ public class DefaultDartCompilerListener extends DartCompilerListener {
}
/**
- * Answer the number of (non-fatal) problems that occurred during compilation.
+ * Answer the number of non-fatal type problems that occurred during compilation.
*
* @return the number of problems
*/
@@ -83,10 +77,10 @@ public class DefaultDartCompilerListener extends DartCompilerListener {
}
/**
- * Increment the {@link #problemCount} by 1
+ * Increment the {@link #errorCount} by 1
*/
- protected void incrementProblemCount() {
- problemCount++;
+ protected void incrementErrorCount() {
+ errorCount++;
}
/**

Powered by Google App Engine
This is Rietveld 408576698