mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-21 22:57:31 +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;
|
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>
|
template <typename ParseHandler>
|
||||||
bool
|
bool
|
||||||
Parser<ParseHandler>::reportNoOffset(ParseReportKind kind, bool strict, unsigned errorNumber, ...)
|
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
|
// around names). Use our nicer error message for parenthesized, nested
|
||||||
// patterns.
|
// patterns.
|
||||||
if (handler.isParenthesizedDestructuringPattern(expr)) {
|
if (handler.isParenthesizedDestructuringPattern(expr)) {
|
||||||
reportWithNode(ParseError, false, expr, JSMSG_BAD_DESTRUCT_PARENS);
|
errorAt(expr->pn_pos.begin, JSMSG_BAD_DESTRUCT_PARENS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4104,7 +4091,7 @@ Parser<FullParseHandler>::checkDestructuringName(ParseNode* expr, Maybe<Declarat
|
||||||
// Destructuring patterns in declarations must only contain
|
// Destructuring patterns in declarations must only contain
|
||||||
// unparenthesized names.
|
// unparenthesized names.
|
||||||
if (!handler.isUnparenthesizedName(expr)) {
|
if (!handler.isUnparenthesizedName(expr)) {
|
||||||
reportWithNode(ParseError, false, expr, JSMSG_NO_VARIABLE_NAME);
|
errorAt(expr->pn_pos.begin, JSMSG_NO_VARIABLE_NAME);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4115,11 +4102,8 @@ Parser<FullParseHandler>::checkDestructuringName(ParseNode* expr, Maybe<Declarat
|
||||||
// Otherwise this is an expression in destructuring outside a declaration.
|
// Otherwise this is an expression in destructuring outside a declaration.
|
||||||
if (handler.isNameAnyParentheses(expr)) {
|
if (handler.isNameAnyParentheses(expr)) {
|
||||||
if (const char* chars = handler.nameIsArgumentsEvalAnyParentheses(expr, context)) {
|
if (const char* chars = handler.nameIsArgumentsEvalAnyParentheses(expr, context)) {
|
||||||
if (!reportWithNode(ParseStrictError, pc->sc()->strict(), expr,
|
if (!strictModeErrorAt(expr->pn_pos.begin, JSMSG_BAD_STRICT_ASSIGN, chars))
|
||||||
JSMSG_BAD_STRICT_ASSIGN, chars))
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -4128,7 +4112,7 @@ Parser<FullParseHandler>::checkDestructuringName(ParseNode* expr, Maybe<Declarat
|
||||||
if (handler.isPropertyAccess(expr))
|
if (handler.isPropertyAccess(expr))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
reportWithNode(ParseError, pc->sc()->strict(), expr, JSMSG_BAD_DESTRUCT_TARGET);
|
errorAt(expr->pn_pos.begin, JSMSG_BAD_DESTRUCT_TARGET);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4187,7 +4171,7 @@ Parser<FullParseHandler>::checkDestructuringArray(ParseNode* arrayPattern,
|
||||||
ParseNode* target;
|
ParseNode* target;
|
||||||
if (element->isKind(PNK_SPREAD)) {
|
if (element->isKind(PNK_SPREAD)) {
|
||||||
if (element->pn_next) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
target = element->pn_kid;
|
target = element->pn_kid;
|
||||||
|
|
@ -4250,7 +4234,7 @@ Parser<FullParseHandler>::checkDestructuringPattern(ParseNode* pattern,
|
||||||
PossibleError* possibleError /* = nullptr */)
|
PossibleError* possibleError /* = nullptr */)
|
||||||
{
|
{
|
||||||
if (pattern->isKind(PNK_ARRAYCOMP)) {
|
if (pattern->isKind(PNK_ARRAYCOMP)) {
|
||||||
reportWithNode(ParseError, false, pattern, JSMSG_ARRAY_COMP_LEFTSIDE);
|
errorAt(pattern->pn_pos.begin, JSMSG_ARRAY_COMP_LEFTSIDE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5696,7 +5680,7 @@ Parser<ParseHandler>::forStatement(YieldHandling yieldHandling)
|
||||||
iflags |= JSITER_ENUMERATE;
|
iflags |= JSITER_ENUMERATE;
|
||||||
} else {
|
} else {
|
||||||
if (isForEach) {
|
if (isForEach) {
|
||||||
reportWithNode(ParseError, false, startNode, JSMSG_BAD_FOR_EACH_LOOP);
|
errorAt(begin, JSMSG_BAD_FOR_EACH_LOOP);
|
||||||
return null();
|
return null();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -907,7 +907,6 @@ class Parser final : private JS::AutoGCRooter, public StrictModeGetter
|
||||||
bool reportHelper(ParseReportKind kind, bool strict, uint32_t offset,
|
bool reportHelper(ParseReportKind kind, bool strict, uint32_t offset,
|
||||||
unsigned errorNumber, va_list args);
|
unsigned errorNumber, va_list args);
|
||||||
public:
|
public:
|
||||||
bool reportWithNode(ParseReportKind kind, bool strict, Node pn, unsigned errorNumber, ...);
|
|
||||||
bool reportNoOffset(ParseReportKind kind, bool strict, unsigned errorNumber, ...);
|
bool reportNoOffset(ParseReportKind kind, bool strict, unsigned errorNumber, ...);
|
||||||
|
|
||||||
/* Report the given error at the current offset. */
|
/* Report the given error at the current offset. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue