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

Unified Diff: compiler/java/com/google/dart/compiler/testing/TestCompilerContext.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/testing/TestCompilerContext.java
diff --git a/compiler/java/com/google/dart/compiler/testing/TestCompilerContext.java b/compiler/java/com/google/dart/compiler/testing/TestCompilerContext.java
index c8732aed1fc8b966364d8b79e9a1f0749ff106b5..45cab033529765b9bacb459af928c5af67ce850b 100644
--- a/compiler/java/com/google/dart/compiler/testing/TestCompilerContext.java
+++ b/compiler/java/com/google/dart/compiler/testing/TestCompilerContext.java
@@ -10,8 +10,10 @@ import com.google.dart.compiler.DartCompilerContext;
import com.google.dart.compiler.DartCompilerListener;
import com.google.dart.compiler.DartSource;
import com.google.dart.compiler.ErrorCode;
+import com.google.dart.compiler.ErrorSeverity;
import com.google.dart.compiler.LibrarySource;
import com.google.dart.compiler.Source;
+import com.google.dart.compiler.SubSystem;
import com.google.dart.compiler.ast.DartUnit;
import com.google.dart.compiler.ast.LibraryUnit;
import com.google.dart.compiler.metrics.CompilerMetrics;
@@ -65,28 +67,23 @@ public class TestCompilerContext extends DartCompilerListener implements DartCom
}
@Override
- public void compilationError(DartCompilationError event) {
- errorCount++;
- handleEvent(event, EventKind.ERROR);
- }
-
- @Override
- public void compilationWarning(DartCompilationError event) {
- warningCount++;
- handleEvent(event, EventKind.WARNING);
- }
-
- @Override
- public void typeError(DartCompilationError event) {
- typeErrorCount++;
- handleEvent(event, EventKind.TYPE_ERROR);
+ public void onError(DartCompilationError event) {
+ if (event.getErrorCode().getSubSystem() == SubSystem.STATIC_TYPE) {
+ typeErrorCount++;
+ handleEvent(event, EventKind.TYPE_ERROR);
+ } else if (event.getErrorCode().getErrorSeverity() == ErrorSeverity.ERROR) {
+ errorCount++;
+ handleEvent(event, EventKind.ERROR);
+ } else if (event.getErrorCode().getErrorSeverity() == ErrorSeverity.WARNING) {
+ warningCount++;
+ handleEvent(event, EventKind.WARNING);
+ }
}
protected void handleEvent(DartCompilationError event, EventKind kind) {
errors.add(event.getErrorCode());
if (!ignoredEvents.contains(kind)) {
- System.err.println("Unexpected Event: " + event + " of kind "
- + kind);
+ System.err.println("Unexpected Event: " + event + " of kind " + kind);
throw new AssertionError(event);
}
}

Powered by Google App Engine
This is Rietveld 408576698