Permalink
Browse files

Automated g4 rollback

*** Reason for rollback ***

i screwed this up

*** Original change description ***

add a more robust failsafe mode

DELTA=29  (14 added, 6 deleted, 9 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=4359


git-svn-id: http://closure-compiler.googlecode.com/svn/trunk@1832 b0f006be-c8cd-11de-a2e8-8d36a3108c74
  • Loading branch information...
1 parent f9c410d commit 034bac1a5febfc1b8af9c8000e21f3cde2d091fe nicksantos@google.com committed Mar 13, 2012
Showing with 15 additions and 6 deletions.
  1. +15 −6 src/com/google/javascript/jscomp/ComposeWarningsGuard.java
@@ -47,7 +47,6 @@
private final Comparator<WarningsGuard> guardComparator =
new GuardComparator(orderOfAddition);
- private boolean demoteErrors = false;
private static class GuardComparator
implements Comparator<WarningsGuard>, Serializable {
@@ -107,9 +106,6 @@ public CheckLevel level(JSError error) {
for (WarningsGuard guard : guards) {
CheckLevel newLevel = guard.level(error);
if (newLevel != null) {
- if (demoteErrors && newLevel == CheckLevel.ERROR) {
- return CheckLevel.WARNING;
- }
return newLevel;
}
}
@@ -163,9 +159,22 @@ public boolean enables(DiagnosticGroup group) {
*/
ComposeWarningsGuard makeEmergencyFailSafeGuard() {
ComposeWarningsGuard safeGuard = new ComposeWarningsGuard();
- safeGuard.demoteErrors = true;
for (WarningsGuard guard : guards.descendingSet()) {
- safeGuard.addGuard(guard);
+ if (guard instanceof StrictWarningsGuard) {
+ continue;
+ } else if (guard instanceof DiagnosticGroupWarningsGuard) {
+ DiagnosticGroupWarningsGuard dgGuard =
+ (DiagnosticGroupWarningsGuard) guard;
+ if (dgGuard.level == CheckLevel.ERROR) {
+ safeGuard.addGuard(
+ new DiagnosticGroupWarningsGuard(
+ dgGuard.group, CheckLevel.WARNING));
+ } else {
+ safeGuard.addGuard(guard);
+ }
+ } else {
+ safeGuard.addGuard(guard);
+ }
}
return safeGuard;
}

0 comments on commit 034bac1

Please sign in to comment.