mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 15:28:39 +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
|
|
@ -845,7 +845,7 @@ class FullParseHandler
|
|||
MOZ_MUST_USE ParseNode* setLikelyIIFE(ParseNode* pn) {
|
||||
return parenthesize(pn);
|
||||
}
|
||||
void setPrologue(ParseNode* pn) {
|
||||
void setInDirectivePrologue(ParseNode* pn) {
|
||||
pn->pn_prologue = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -519,7 +519,7 @@ class SyntaxParseHandler
|
|||
MOZ_MUST_USE Node setLikelyIIFE(Node pn) {
|
||||
return pn; // Remain in syntax-parse mode.
|
||||
}
|
||||
void setPrologue(Node pn) {}
|
||||
void setInDirectivePrologue(Node pn) {}
|
||||
|
||||
bool isConstant(Node pn) { return false; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue