summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-06-09 01:35:28 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:30 -0400
commitd200a2b02e50b33511ff2ea26a2968301f06b170 (patch)
tree9b5216709e5ee17357501bda7350341a259b5b62 /js
parentc75bd3037aa32d4a2a574feda15f43635bc0c01c (diff)
downloadUXP-d200a2b02e50b33511ff2ea26a2968301f06b170.tar
UXP-d200a2b02e50b33511ff2ea26a2968301f06b170.tar.gz
UXP-d200a2b02e50b33511ff2ea26a2968301f06b170.tar.lz
UXP-d200a2b02e50b33511ff2ea26a2968301f06b170.tar.xz
UXP-d200a2b02e50b33511ff2ea26a2968301f06b170.zip
1337143 - Tweak ExportClause parsing to eliminate a peekToken where a simpler consuming getToken could be performed.
Diffstat (limited to 'js')
-rw-r--r--js/src/frontend/Parser.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
index abb2d51ad..7e43bc3b5 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -4990,12 +4990,17 @@ Parser<FullParseHandler>::exportDeclaration()
// Handle the forms |export {}| and |export { ..., }| (where ...
// is non empty), by escaping the loop early if the next token
// is }.
- if (!tokenStream.peekToken(&tt))
+ if (!tokenStream.getToken(&tt))
return null();
+
if (tt == TOK_RC)
break;
- MUST_MATCH_TOKEN(TOK_NAME, JSMSG_NO_BINDING_NAME);
+ if (tt != TOK_NAME) {
+ error(JSMSG_NO_BINDING_NAME);
+ return null();
+ }
+
Node bindingName = newName(tokenStream.currentName());
if (!bindingName)
return null();
@@ -5019,14 +5024,18 @@ Parser<FullParseHandler>::exportDeclaration()
handler.addList(kid, exportSpec);
- bool matched;
- if (!tokenStream.matchToken(&matched, TOK_COMMA))
+ TokenKind next;
+ if (!tokenStream.getToken(&next))
return null();
- if (!matched)
+
+ if (next == TOK_RC)
break;
- }
- MUST_MATCH_TOKEN(TOK_RC, JSMSG_RC_AFTER_EXPORT_SPEC_LIST);
+ if (next != TOK_COMMA) {
+ error(JSMSG_RC_AFTER_EXPORT_SPEC_LIST);
+ return null();
+ }
+ }
// Careful! If |from| follows, even on a new line, it must start a
// FromClause: