mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 06:48:38 +09:00
Specify an explicit offset when warning about "use asm" found in the
directive prologue of a script (rather than a function body).
This commit is contained in:
parent
a652eb1916
commit
1f00dc49d4
3 changed files with 7 additions and 6 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue