[X2Go-Commits] [pale-moon] 227/294: Introduce Parser::warningAt
git-admin at x2go.org
git-admin at x2go.org
Sat Apr 27 08:58:20 CEST 2019
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch upstream/28.5.0
in repository pale-moon.
commit 940a6ceb9a5b3d8c7c2ed53da67f5c14cc84925c
Author: wolfbeast <mcwerewolf at wolfbeast.com>
Date: Sat Apr 6 10:33:24 2019 +0200
Introduce Parser::warningAt
This reduces reporting an warning at a particular offset to its bare
essentials, simplifying calls.
---
js/src/frontend/Parser.cpp | 26 ++++++++++++++++----------
js/src/frontend/Parser.h | 5 +++--
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
index a265204..43f39dc 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -635,6 +635,17 @@ Parser<ParseHandler>::warning(unsigned errorNumber, ...)
template <typename ParseHandler>
bool
+Parser<ParseHandler>::warningAt(uint32_t offset, unsigned errorNumber, ...)
+{
+ va_list args;
+ va_start(args, errorNumber);
+ bool result = reportHelper(ParseWarning, false, offset, errorNumber, args);
+ va_end(args);
+ return result;
+}
+
+template <typename ParseHandler>
+bool
Parser<ParseHandler>::extraWarning(unsigned errorNumber, ...)
{
va_list args;
@@ -3858,8 +3869,7 @@ Parser<ParseHandler>::maybeParseDirective(Node list, Node possibleDirective, boo
} else if (directive == context->names().useAsm) {
if (pc->isFunctionBox())
return asmJS(list);
- return reportWithOffset(ParseWarning, false, directivePos.begin,
- JSMSG_USE_ASM_DIRECTIVE_FAIL);
+ return warningAt(directivePos.begin, JSMSG_USE_ASM_DIRECTIVE_FAIL);
}
}
return true;
@@ -3903,11 +3913,9 @@ Parser<ParseHandler>::statementList(YieldHandling yieldHandling)
if (!warnedAboutStatementsAfterReturn) {
if (afterReturn) {
if (!handler.isStatementPermittedAfterReturnStatement(next)) {
- if (!reportWithOffset(ParseWarning, false, statementBegin,
- JSMSG_STMT_AFTER_RETURN))
- {
+ if (!warningAt(statementBegin, JSMSG_STMT_AFTER_RETURN))
return null();
- }
+
warnedAboutStatementsAfterReturn = true;
}
} else if (handler.isReturnStatement(next)) {
@@ -5836,11 +5844,9 @@ Parser<ParseHandler>::switchStatement(YieldHandling yieldHandling)
if (!warnedAboutStatementsAfterReturn) {
if (afterReturn) {
if (!handler.isStatementPermittedAfterReturnStatement(stmt)) {
- if (!reportWithOffset(ParseWarning, false, statementBegin,
- JSMSG_STMT_AFTER_RETURN))
- {
+ if (!warningAt(statementBegin, JSMSG_STMT_AFTER_RETURN))
return null();
- }
+
warnedAboutStatementsAfterReturn = true;
}
} else if (handler.isReturnStatement(stmt)) {
diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h
index 27a1045..6bd7e58 100644
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -909,8 +909,6 @@ class Parser final : private JS::AutoGCRooter, public StrictModeGetter
public:
bool reportWithNode(ParseReportKind kind, bool strict, Node pn, unsigned errorNumber, ...);
bool reportNoOffset(ParseReportKind kind, bool strict, unsigned errorNumber, ...);
- bool reportWithOffset(ParseReportKind kind, bool strict, uint32_t offset, unsigned errorNumber,
- ...);
/* Report the given error at the current offset. */
void error(unsigned errorNumber, ...);
@@ -935,6 +933,9 @@ class Parser final : private JS::AutoGCRooter, public StrictModeGetter
/* Report the given warning at the current offset. */
MOZ_MUST_USE bool warning(unsigned errorNumber, ...);
+ /* Report the given warning at the given offset. */
+ MOZ_MUST_USE bool warningAt(uint32_t offset, unsigned errorNumber, ...);
+
/*
* If extra warnings are enabled, report the given warning at the current
* offset.
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pale-moon.git
More information about the x2go-commits
mailing list