Bug 1441523 - Remove the first declaration of "start" and set it in each condition r=erahm
authorVictor <miraty@lilo.org>
Tue, 27 Feb 2018 14:37:19 +0100
changeset 406074 01d017ee38c0
parent 406073 3ce55799da20
child 406075 2e915e01f05d
push id100359
push usersledru@mozilla.com
push dateThu, 01 Mar 2018 19:58:32 +0000
treeherdermozilla-inbound@01d017ee38c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1441523
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1441523 - Remove the first declaration of "start" and set it in each condition r=erahm
dom/xslt/xpath/txExprLexer.cpp
--- a/dom/xslt/xpath/txExprLexer.cpp
+++ b/dom/xslt/xpath/txExprLexer.cpp
@@ -89,18 +89,18 @@ txExprLexer::nextIsOperatorToken(Token* 
 }
 
 /**
  * Parses the given string into a sequence of Tokens
  */
 nsresult
 txExprLexer::parse(const nsAString& aPattern)
 {
-  iterator start, end;
-  start = aPattern.BeginReading(mPosition);
+  iterator end;
+  aPattern.BeginReading(mPosition);
   aPattern.EndReading(end);
 
   //-- initialize previous token, this will automatically get
   //-- deleted when it goes out of scope
   Token nullToken(nullptr, nullptr, Token::NULL_TOKEN);
 
   Token::Type defType;
   Token* newToken = nullptr;
@@ -120,17 +120,17 @@ txExprLexer::parse(const nsAString& aPat
     }
     // just reuse the QName parsing, which will use defType
     // the token to construct
 
     if (XMLUtils::isLetter(*mPosition)) {
       // NCName, can get QName or OperatorName;
       //  FunctionName, NodeName, and AxisSpecifier may want whitespace,
       //  and are dealt with below
-      start = mPosition;
+      iterator start = mPosition;
       while (++mPosition < end && XMLUtils::isNCNameChar(*mPosition)) {
         /* just go */
       }
       if (mPosition < end && *mPosition == COLON) {
         // try QName or wildcard, might need to step back for axis
         if (++mPosition == end) {
           return NS_ERROR_XPATH_UNEXPECTED_END;
         }
@@ -165,17 +165,17 @@ txExprLexer::parse(const nsAString& aPat
           // XXX QUESTION: spec is not too precise
           // badops is sure an error, but is bad:ops, too? We say yes!
           return NS_ERROR_XPATH_OPERATOR_EXPECTED;
         }
       }
       newToken = new Token(start, mPosition, defType);
     }
     else if (isXPathDigit(*mPosition)) {
-      start = mPosition;
+      iterator start = mPosition;
       while (++mPosition < end && isXPathDigit(*mPosition)) {
         /* just go */
       }
       if (mPosition < end && *mPosition == '.') {
         while (++mPosition < end && isXPathDigit(*mPosition)) {
           /* just go */
         }
       }
@@ -188,34 +188,36 @@ txExprLexer::parse(const nsAString& aPat
       case TX_TAB:
       case TX_CR:
       case TX_LF:
         ++mPosition;
         isToken = false;
         break;
       case S_QUOTE :
       case D_QUOTE :
-        start = mPosition;
+      {
+        iterator start = mPosition;
         while (++mPosition < end && *mPosition != *start) {
           // eat literal
         }
         if (mPosition == end) {
           mPosition = start;
           return NS_ERROR_XPATH_UNCLOSED_LITERAL;
         }
         newToken = new Token(start + 1, mPosition, Token::LITERAL);
         ++mPosition;
-        break;
+      }
+      break;
       case PERIOD:
         // period can be .., .(DIGITS)+ or ., check next
         if (++mPosition == end) {
           newToken = new Token(mPosition - 1, Token::SELF_NODE);
         }
         else if (isXPathDigit(*mPosition)) {
-          start = mPosition - 1;
+          iterator start = mPosition - 1;
           while (++mPosition < end && isXPathDigit(*mPosition)) {
             /* just go */
           }
           newToken = new Token(start, mPosition, Token::NUMBER);
         }
         else if (*mPosition == PERIOD) {
           ++mPosition;
           newToken = new Token(mPosition - 2, mPosition, Token::PARENT_NODE);