зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1296814 - Introduce Parser::warningAt for warnings at specified offsets. r=arai
--HG-- extra : rebase_source : 8860a1c0892bbce10ab367d58d0bf632785821bc
This commit is contained in:
Родитель
75f5a2dd55
Коммит
101a97496d
|
@ -627,6 +627,17 @@ Parser<ParseHandler>::warning(unsigned errorNumber, ...)
|
|||
return result;
|
||||
}
|
||||
|
||||
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, ...)
|
||||
|
@ -684,18 +695,6 @@ Parser<ParseHandler>::reportNoOffset(ParseReportKind kind, bool strict, unsigned
|
|||
return result;
|
||||
}
|
||||
|
||||
template <typename ParseHandler>
|
||||
bool
|
||||
Parser<ParseHandler>::reportWithOffset(ParseReportKind kind, bool strict, uint32_t offset,
|
||||
unsigned errorNumber, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, errorNumber);
|
||||
bool result = reportHelper(kind, strict, offset, errorNumber, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool
|
||||
Parser<FullParseHandler>::abortIfSyntaxParser()
|
||||
|
@ -3778,8 +3777,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;
|
||||
|
@ -3823,11 +3821,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)) {
|
||||
|
@ -5775,11 +5771,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)) {
|
||||
|
|
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче