summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/Parser.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-04-05 21:30:52 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-04-05 21:30:52 +0200
commit1ee96e39db760004c33a235ea691ab06bac21375 (patch)
tree072c69413e081c47e258f7b0b7f5443e357cc756 /js/src/frontend/Parser.cpp
parent2950deb043a403377a589046acaa38cfe3dc9876 (diff)
downloadUXP-1ee96e39db760004c33a235ea691ab06bac21375.tar
UXP-1ee96e39db760004c33a235ea691ab06bac21375.tar.gz
UXP-1ee96e39db760004c33a235ea691ab06bac21375.tar.lz
UXP-1ee96e39db760004c33a235ea691ab06bac21375.tar.xz
UXP-1ee96e39db760004c33a235ea691ab06bac21375.zip
Specify an explicit offset when warning about "use asm" found in the
directive prologue of a script (rather than a function body).
Diffstat (limited to 'js/src/frontend/Parser.cpp')
-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 8ad8813b5..afbf4c4c9 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -3811,10 +3811,10 @@ Parser<FullParseHandler>::asmJS(Node list)
*/
template <typename ParseHandler>
bool
-Parser<ParseHandler>::maybeParseDirective(Node list, Node pn, bool* cont)
+Parser<ParseHandler>::maybeParseDirective(Node list, Node possibleDirective, bool* cont)
{
TokenPos directivePos;
- JSAtom* directive = handler.isStringExprStatement(pn, &directivePos);
+ JSAtom* directive = handler.isStringExprStatement(possibleDirective, &directivePos);
*cont = !!directive;
if (!*cont)
@@ -3831,7 +3831,7 @@ Parser<ParseHandler>::maybeParseDirective(Node list, Node pn, bool* cont)
// directive in the future. We don't want to interfere with people
// taking advantage of directive-prologue-enabled features that appear
// in other browsers first.
- handler.setPrologue(pn);
+ handler.setInDirectivePrologue(possibleDirective);
if (directive == context->names().useStrict) {
// Functions with non-simple parameter lists (destructuring,
@@ -3867,7 +3867,8 @@ Parser<ParseHandler>::maybeParseDirective(Node list, Node pn, bool* cont)
} else if (directive == context->names().useAsm) {
if (pc->isFunctionBox())
return asmJS(list);
- return reportWithNode(ParseWarning, false, pn, JSMSG_USE_ASM_DIRECTIVE_FAIL);
+ return reportWithOffset(ParseWarning, false, directivePos.begin,
+ JSMSG_USE_ASM_DIRECTIVE_FAIL);
}
}
return true;