summaryrefslogtreecommitdiffstats
path: root/js/src/frontend
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-04-05 21:38:21 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-04-05 21:38:21 +0200
commitdcf64bd2ffd24d1c0d046af810c3270656081663 (patch)
tree1a4024e5e9285c76ea6e308291769e0b52c88579 /js/src/frontend
parent11a1f58b9a0ebf83c17087a89e6b4ba83748374a (diff)
downloadUXP-dcf64bd2ffd24d1c0d046af810c3270656081663.tar
UXP-dcf64bd2ffd24d1c0d046af810c3270656081663.tar.gz
UXP-dcf64bd2ffd24d1c0d046af810c3270656081663.tar.lz
UXP-dcf64bd2ffd24d1c0d046af810c3270656081663.tar.xz
UXP-dcf64bd2ffd24d1c0d046af810c3270656081663.zip
Track strict mode errors in for...in and for...of correctly when
syntax-parsing.
Diffstat (limited to 'js/src/frontend')
-rw-r--r--js/src/frontend/Parser.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
index f625595a2..5981881d3 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -4458,6 +4458,10 @@ Parser<ParseHandler>::initializerInNameDeclaration(Node decl, Node binding,
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_ASSIGN));
+ uint32_t initializerOffset;
+ if (!tokenStream.peekOffset(&initializerOffset, TokenStream::Operand))
+ return false;
+
Node initializer = assignExpr(forHeadKind ? InProhibited : InAllowed,
yieldHandling, TripledotProhibited);
if (!initializer)
@@ -4491,11 +4495,8 @@ Parser<ParseHandler>::initializerInNameDeclaration(Node decl, Node binding,
// This leaves only initialized for-in |var| declarations. ES6
// forbids these; later ES un-forbids in non-strict mode code.
*forHeadKind = PNK_FORIN;
- if (!reportWithNode(ParseStrictError, pc->sc()->strict(), initializer,
- JSMSG_INVALID_FOR_IN_DECL_WITH_INIT))
- {
+ if (!strictModeErrorAt(initializerOffset, JSMSG_INVALID_FOR_IN_DECL_WITH_INIT))
return false;
- }
*forInOrOfExpression = expressionAfterForInOrOf(PNK_FORIN, yieldHandling);
if (!*forInOrOfExpression)