Bug 1339963 - Part 2: Use MUST_MATCH_TOKEN for contextual keyword where it can be used. r=jwalden
authorTooru Fujisawa <arai_a@mac.com>
Wed, 22 Feb 2017 16:11:35 +0900
changeset 344208 b27d839625c20ad1cb632eb450036ca5412a0efe
parent 344207 58d90297f0bf6ae03a5e7ffa359b626c35099c1f
child 344209 7e9cf4a61aec21800f6f59a3e1a32d685bb3871a
push id31402
push usercbook@mozilla.com
push dateWed, 22 Feb 2017 13:33:50 +0000
treeherdermozilla-central@f5372cb6c3c7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs1339963
milestone54.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 1339963 - Part 2: Use MUST_MATCH_TOKEN for contextual keyword where it can be used. r=jwalden
js/src/frontend/Parser.cpp
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -4865,23 +4865,17 @@ Parser<FullParseHandler>::importDeclarat
                 if (!namedImportsOrNamespaceImport(tt, importSpecSet))
                     return null();
             }
         } else {
             error(JSMSG_DECLARATION_AFTER_IMPORT);
             return null();
         }
 
-        if (!tokenStream.getToken(&tt))
-            return null();
-
-        if (tt != TOK_FROM) {
-            error(JSMSG_FROM_AFTER_IMPORT_CLAUSE);
-            return null();
-        }
+        MUST_MATCH_TOKEN(TOK_FROM, JSMSG_FROM_AFTER_IMPORT_CLAUSE);
 
         MUST_MATCH_TOKEN(TOK_STRING, JSMSG_MODULE_SPEC_AFTER_FROM);
     }
 
     Node moduleSpec = stringLiteral();
     if (!moduleSpec)
         return null();
 
@@ -5075,23 +5069,17 @@ Parser<ParseHandler>::exportBatch(uint32
     // Handle the form |export *| by adding a special export batch
     // specifier to the list.
     Node exportSpec = handler.newNullary(PNK_EXPORT_BATCH_SPEC, JSOP_NOP, pos());
     if (!exportSpec)
         return null();
 
     handler.addList(kid, exportSpec);
 
-    TokenKind tt;
-    if (!tokenStream.getToken(&tt))
-        return null();
-    if (tt != TOK_FROM) {
-        error(JSMSG_FROM_AFTER_EXPORT_STAR);
-        return null();
-    }
+    MUST_MATCH_TOKEN(TOK_FROM, JSMSG_FROM_AFTER_EXPORT_STAR);
 
     return exportFrom(begin, kid);
 }
 
 template <typename ParseHandler>
 typename ParseHandler::Node
 Parser<ParseHandler>::exportClause(uint32_t begin)
 {