Bug 1611777 - Part 9: Replace an if-statement with an assertion. r=yulia
authorAndré Bargull <andre.bargull@gmail.com>
Wed, 29 Jan 2020 16:27:22 +0000
changeset 512100 fa5be03a588c387639907f7e72b4d86d2bfe880a
parent 512099 958adec635321bfe453ac74672a8e2037b953259
child 512101 e82fbc9dee634c29797c5019b12c2c1ebea3eba1
push id37072
push usercsabou@mozilla.com
push dateThu, 30 Jan 2020 15:44:43 +0000
treeherdermozilla-central@f97c48da9cee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyulia
bugs1611777
milestone74.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 1611777 - Part 9: Replace an if-statement with an assertion. r=yulia `nextMember` is never nullptr, so we don't need to test for it. Differential Revision: https://phabricator.services.mozilla.com/D61156
js/src/frontend/Parser.cpp
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -8987,19 +8987,18 @@ typename ParseHandler::Node GeneralParse
                tt == TokenKind::NoSubsTemplate) {
       error(JSMSG_BAD_OPTIONAL_TEMPLATE);
       return null();
     } else {
       anyChars.ungetToken();
       break;
     }
 
-    if (nextMember) {
-      lhs = nextMember;
-    }
+    MOZ_ASSERT(nextMember);
+    lhs = nextMember;
   }
 
   UnaryNodeType optionalChain = handler_.newOptionalChain(begin, lhs);
   return optionalChain;
 }
 
 template <class ParseHandler, typename Unit>
 typename ParseHandler::Node GeneralParser<ParseHandler, Unit>::unaryExpr(