Prune no-op statements with a single traverser

We put pruning literal statements and pruning empty declarations in
the same traverser, as some of the required logic is the same. This
pruning of no-ops is always done as one of the first processing steps
after parsing, so further processing of the AST is simpler.

Since we now prune pure literals before removing no-op cases from the
end of switch statements, we also don't need any sort of special
handling for switch statements in pruning pure literals.

BUG=angleproject:2181
TEST=angle_unittests

Change-Id: I2d86efaeb80baab63ac3cc803f3fd9e7ec02908a
Reviewed-on: https://chromium-review.googlesource.com/727803
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/RemoveSwitchFallThrough.cpp b/src/compiler/translator/RemoveSwitchFallThrough.cpp
index ab2045d..dea949f 100644
--- a/src/compiler/translator/RemoveSwitchFallThrough.cpp
+++ b/src/compiler/translator/RemoveSwitchFallThrough.cpp
@@ -97,10 +97,10 @@
 
 void RemoveSwitchFallThroughTraverser::visitConstantUnion(TIntermConstantUnion *node)
 {
-    // Conditions of case labels are not traversed, so this is some other constant
-    // Could be just a statement like "0;"
-    mPreviousCase->getSequence()->push_back(node);
-    mLastStatementWasBreak = false;
+    // Conditions of case labels are not traversed, so this is a constant statement like "0;".
+    // These are no-ops so there's no need to add them back to the statement list. Should have
+    // already been pruned out of the AST, in fact.
+    UNREACHABLE();
 }
 
 bool RemoveSwitchFallThroughTraverser::visitDeclaration(Visit, TIntermDeclaration *node)