Fix statements disappearing from switch statements in HLSL

RemoveSwitchFallThrough now correctly records the existence of
declaration and swizzle statements inside switch statements.

BUG=angleproject:2177
TEST=angle_end2end_tests

Change-Id: I1ef83997db7ae510ded002a9568c29272c00c2fe
Reviewed-on: https://chromium-review.googlesource.com/709195
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/RemoveSwitchFallThrough.cpp b/src/compiler/translator/RemoveSwitchFallThrough.cpp
index 6abf7cd..8a4a0be 100644
--- a/src/compiler/translator/RemoveSwitchFallThrough.cpp
+++ b/src/compiler/translator/RemoveSwitchFallThrough.cpp
@@ -28,9 +28,11 @@
 
     void visitSymbol(TIntermSymbol *node) override;
     void visitConstantUnion(TIntermConstantUnion *node) override;
+    bool visitDeclaration(Visit, TIntermDeclaration *node) override;
     bool visitBinary(Visit, TIntermBinary *node) override;
     bool visitUnary(Visit, TIntermUnary *node) override;
     bool visitTernary(Visit visit, TIntermTernary *node) override;
+    bool visitSwizzle(Visit, TIntermSwizzle *node) override;
     bool visitIfElse(Visit visit, TIntermIfElse *node) override;
     bool visitSwitch(Visit, TIntermSwitch *node) override;
     bool visitCase(Visit, TIntermCase *node) override;
@@ -90,6 +92,13 @@
     mLastStatementWasBreak = false;
 }
 
+bool RemoveSwitchFallThroughTraverser::visitDeclaration(Visit, TIntermDeclaration *node)
+{
+    mPreviousCase->getSequence()->push_back(node);
+    mLastStatementWasBreak = false;
+    return false;
+}
+
 bool RemoveSwitchFallThroughTraverser::visitBinary(Visit, TIntermBinary *node)
 {
     mPreviousCase->getSequence()->push_back(node);
@@ -111,6 +120,13 @@
     return false;
 }
 
+bool RemoveSwitchFallThroughTraverser::visitSwizzle(Visit, TIntermSwizzle *node)
+{
+    mPreviousCase->getSequence()->push_back(node);
+    mLastStatementWasBreak = false;
+    return false;
+}
+
 bool RemoveSwitchFallThroughTraverser::visitIfElse(Visit, TIntermIfElse *node)
 {
     mPreviousCase->getSequence()->push_back(node);