summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/Parser.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-06-09 22:35:15 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:38 -0400
commit64fd7ae4546424c42a9e2022e05b83379411109a (patch)
tree54ab581c56d53d80d20b95bacbb8f8e02b977138 /js/src/frontend/Parser.cpp
parentd2aa017a88a4b918ded2159cd202ce6c7c7218d0 (diff)
downloadUXP-64fd7ae4546424c42a9e2022e05b83379411109a.tar
UXP-64fd7ae4546424c42a9e2022e05b83379411109a.tar.gz
UXP-64fd7ae4546424c42a9e2022e05b83379411109a.tar.lz
UXP-64fd7ae4546424c42a9e2022e05b83379411109a.tar.xz
UXP-64fd7ae4546424c42a9e2022e05b83379411109a.zip
1339963 - Part 3: Check IdentifierName in ExportClause without from.
Diffstat (limited to 'js/src/frontend/Parser.cpp')
-rw-r--r--js/src/frontend/Parser.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
index f382ec5e9..ffece5721 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -5124,6 +5124,31 @@ Parser<ParseHandler>::exportBatch(uint32_t begin)
return exportFrom(begin, kid);
}
+template<>
+bool
+Parser<FullParseHandler>::checkLocalExportNames(ParseNode* node)
+{
+ // ES 2017 draft 15.2.3.1.
+ for (ParseNode* next = node->pn_head; next; next = next->pn_next) {
+ ParseNode* name = next->pn_left;
+ MOZ_ASSERT(name->isKind(PNK_NAME));
+
+ RootedPropertyName ident(context, name->pn_atom->asPropertyName());
+ if (!checkLocalExportName(ident, name->pn_pos.begin))
+ return false;
+ }
+
+ return true;
+}
+
+template<>
+bool
+Parser<SyntaxParseHandler>::checkLocalExportNames(Node node)
+{
+ MOZ_ALWAYS_FALSE(abortIfSyntaxParser());
+ return false;
+}
+
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::exportClause(uint32_t begin)
@@ -5211,6 +5236,9 @@ Parser<ParseHandler>::exportClause(uint32_t begin)
if (!matchOrInsertSemicolonAfterNonExpression())
return null();
+ if (!checkLocalExportNames(kid))
+ return null();
+
Node node = handler.newExportDeclaration(kid, TokenPos(begin, pos().end));
if (!node)
return null();