mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +09:00
Remove Parser::reportWithNode and its remaining callers.
All of the callsites have a full ParseNode* at hand, of which the offset can be directly accessed.
This commit is contained in:
parent
a389b4e151
commit
ff81b6b3d8
2 changed files with 7 additions and 24 deletions
|
|
@ -677,19 +677,6 @@ Parser<ParseHandler>::strictModeErrorAt(uint32_t offset, unsigned errorNumber, .
|
|||
return res;
|
||||
}
|
||||
|
||||
template <typename ParseHandler>
|
||||
bool
|
||||
Parser<ParseHandler>::reportWithNode(ParseReportKind kind, bool strict, Node pn, unsigned errorNumber, ...)
|
||||
{
|
||||
uint32_t offset = (pn ? handler.getPosition(pn) : pos()).begin;
|
||||
|
||||
va_list args;
|
||||
va_start(args, errorNumber);
|
||||
bool result = reportHelper(kind, strict, offset, errorNumber, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename ParseHandler>
|
||||
bool
|
||||
Parser<ParseHandler>::reportNoOffset(ParseReportKind kind, bool strict, unsigned errorNumber, ...)
|
||||
|
|
@ -4094,7 +4081,7 @@ Parser<FullParseHandler>::checkDestructuringName(ParseNode* expr, Maybe<Declarat
|
|||
// around names). Use our nicer error message for parenthesized, nested
|
||||
// patterns.
|
||||
if (handler.isParenthesizedDestructuringPattern(expr)) {
|
||||
reportWithNode(ParseError, false, expr, JSMSG_BAD_DESTRUCT_PARENS);
|
||||
errorAt(expr->pn_pos.begin, JSMSG_BAD_DESTRUCT_PARENS);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -4104,7 +4091,7 @@ Parser<FullParseHandler>::checkDestructuringName(ParseNode* expr, Maybe<Declarat
|
|||
// Destructuring patterns in declarations must only contain
|
||||
// unparenthesized names.
|
||||
if (!handler.isUnparenthesizedName(expr)) {
|
||||
reportWithNode(ParseError, false, expr, JSMSG_NO_VARIABLE_NAME);
|
||||
errorAt(expr->pn_pos.begin, JSMSG_NO_VARIABLE_NAME);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -4115,11 +4102,8 @@ Parser<FullParseHandler>::checkDestructuringName(ParseNode* expr, Maybe<Declarat
|
|||
// Otherwise this is an expression in destructuring outside a declaration.
|
||||
if (handler.isNameAnyParentheses(expr)) {
|
||||
if (const char* chars = handler.nameIsArgumentsEvalAnyParentheses(expr, context)) {
|
||||
if (!reportWithNode(ParseStrictError, pc->sc()->strict(), expr,
|
||||
JSMSG_BAD_STRICT_ASSIGN, chars))
|
||||
{
|
||||
if (!strictModeErrorAt(expr->pn_pos.begin, JSMSG_BAD_STRICT_ASSIGN, chars))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -4128,7 +4112,7 @@ Parser<FullParseHandler>::checkDestructuringName(ParseNode* expr, Maybe<Declarat
|
|||
if (handler.isPropertyAccess(expr))
|
||||
return true;
|
||||
|
||||
reportWithNode(ParseError, pc->sc()->strict(), expr, JSMSG_BAD_DESTRUCT_TARGET);
|
||||
errorAt(expr->pn_pos.begin, JSMSG_BAD_DESTRUCT_TARGET);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -4187,7 +4171,7 @@ Parser<FullParseHandler>::checkDestructuringArray(ParseNode* arrayPattern,
|
|||
ParseNode* target;
|
||||
if (element->isKind(PNK_SPREAD)) {
|
||||
if (element->pn_next) {
|
||||
reportWithNode(ParseError, false, element->pn_next, JSMSG_PARAMETER_AFTER_REST);
|
||||
errorAt(element->pn_next->pn_pos.begin, JSMSG_PARAMETER_AFTER_REST);
|
||||
return false;
|
||||
}
|
||||
target = element->pn_kid;
|
||||
|
|
@ -4250,7 +4234,7 @@ Parser<FullParseHandler>::checkDestructuringPattern(ParseNode* pattern,
|
|||
PossibleError* possibleError /* = nullptr */)
|
||||
{
|
||||
if (pattern->isKind(PNK_ARRAYCOMP)) {
|
||||
reportWithNode(ParseError, false, pattern, JSMSG_ARRAY_COMP_LEFTSIDE);
|
||||
errorAt(pattern->pn_pos.begin, JSMSG_ARRAY_COMP_LEFTSIDE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -5696,7 +5680,7 @@ Parser<ParseHandler>::forStatement(YieldHandling yieldHandling)
|
|||
iflags |= JSITER_ENUMERATE;
|
||||
} else {
|
||||
if (isForEach) {
|
||||
reportWithNode(ParseError, false, startNode, JSMSG_BAD_FOR_EACH_LOOP);
|
||||
errorAt(begin, JSMSG_BAD_FOR_EACH_LOOP);
|
||||
return null();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue