summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-04-06 11:18:36 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-04-06 11:18:36 +0200
commit4f62fda966af85252f8345e51d694cd6d3a063c8 (patch)
treefd62fff5e83e4508fb4079fa748f7356dde98441 /js
parent7ea8efe0cb3199566b86a2b7ad4cb99df8620324 (diff)
downloadUXP-4f62fda966af85252f8345e51d694cd6d3a063c8.tar
UXP-4f62fda966af85252f8345e51d694cd6d3a063c8.tar.gz
UXP-4f62fda966af85252f8345e51d694cd6d3a063c8.tar.lz
UXP-4f62fda966af85252f8345e51d694cd6d3a063c8.tar.xz
UXP-4f62fda966af85252f8345e51d694cd6d3a063c8.zip
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.
Diffstat (limited to 'js')
-rw-r--r--js/src/frontend/Parser.cpp30
-rw-r--r--js/src/frontend/Parser.h1
2 files changed, 7 insertions, 24 deletions
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
index 3b1cadbff..c08ba4889 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -679,19 +679,6 @@ Parser<ParseHandler>::strictModeErrorAt(uint32_t offset, unsigned errorNumber, .
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, ...)
{
va_list args;
@@ -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();
}
diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h
index a7e48c1a4..196c71fa5 100644
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -907,7 +907,6 @@ class Parser final : private JS::AutoGCRooter, public StrictModeGetter
bool reportHelper(ParseReportKind kind, bool strict, uint32_t offset,
unsigned errorNumber, va_list args);
public:
- bool reportWithNode(ParseReportKind kind, bool strict, Node pn, unsigned errorNumber, ...);
bool reportNoOffset(ParseReportKind kind, bool strict, unsigned errorNumber, ...);
/* Report the given error at the current offset. */