Revert "Revert "Cover vector dynamic indexing case in SplitSequenceOperator""

This reverts commit d2f59bb6dda4f3548e158a09540829f9ff56bba4.

Change-Id: If2842bce17a0c085e2bc913ff120083fbe90497c
Reviewed-on: https://chromium-review.googlesource.com/376189
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/IntermNodePatternMatcher.h b/src/compiler/translator/IntermNodePatternMatcher.h
index b088633..be6fc61 100644
--- a/src/compiler/translator/IntermNodePatternMatcher.h
+++ b/src/compiler/translator/IntermNodePatternMatcher.h
@@ -19,22 +19,35 @@
 class IntermNodePatternMatcher
 {
   public:
+    static bool IsDynamicIndexingOfVectorOrMatrix(TIntermBinary *node);
+
     enum PatternType
     {
+        // Matches expressions that are unfolded to if statements by UnfoldShortCircuitToIf
         kUnfoldedShortCircuitExpression = 0x0001,
 
         // Matches expressions that return arrays with the exception of simple statements where a
         // constructor or function call result is assigned.
-        kExpressionReturningArray = 0x0002
+        kExpressionReturningArray = 0x0002,
+
+        // Matches dynamic indexing of vectors or matrices in l-values.
+        kDynamicIndexingOfVectorOrMatrixInLValue = 0x0004
     };
     IntermNodePatternMatcher(const unsigned int mask);
 
     bool match(TIntermBinary *node, TIntermNode *parentNode);
+
+    // Use this version for checking binary node matches in case you're using flag
+    // kDynamicIndexingOfVectorOrMatrixInLValue.
+    bool match(TIntermBinary *node, TIntermNode *parentNode, bool isLValueRequiredHere);
+
     bool match(TIntermAggregate *node, TIntermNode *parentNode);
     bool match(TIntermSelection *node);
 
   private:
     const unsigned int mMask;
+
+    bool matchInternal(TIntermBinary *node, TIntermNode *parentNode);
 };
 
 #endif