mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 07:18:39 +09:00
1283712 - Part 3: Add Parser::errorWithNotes and Parser::errorWithNotesAt.
This commit is contained in:
parent
98ebeef711
commit
dc06903cd1
5 changed files with 82 additions and 35 deletions
|
|
@ -607,8 +607,8 @@ TokenStream::seek(const Position& pos, const TokenStream& other)
|
|||
}
|
||||
|
||||
bool
|
||||
TokenStream::reportStrictModeErrorNumberVA(uint32_t offset, bool strictMode, unsigned errorNumber,
|
||||
va_list args)
|
||||
TokenStream::reportStrictModeErrorNumberVA(UniquePtr<JSErrorNotes> notes, uint32_t offset,
|
||||
bool strictMode, unsigned errorNumber, va_list args)
|
||||
{
|
||||
// In strict mode code, this is an error, not merely a warning.
|
||||
unsigned flags;
|
||||
|
|
@ -619,7 +619,7 @@ TokenStream::reportStrictModeErrorNumberVA(uint32_t offset, bool strictMode, uns
|
|||
else
|
||||
return true;
|
||||
|
||||
return reportCompileErrorNumberVA(offset, flags, errorNumber, args);
|
||||
return reportCompileErrorNumberVA(Move(notes), offset, flags, errorNumber, args);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -645,8 +645,8 @@ CompileError::throwError(JSContext* cx)
|
|||
}
|
||||
|
||||
bool
|
||||
TokenStream::reportCompileErrorNumberVA(uint32_t offset, unsigned flags, unsigned errorNumber,
|
||||
va_list args)
|
||||
TokenStream::reportCompileErrorNumberVA(UniquePtr<JSErrorNotes> notes, uint32_t offset,
|
||||
unsigned flags, unsigned errorNumber, va_list args)
|
||||
{
|
||||
bool warning = JSREPORT_IS_WARNING(flags);
|
||||
|
||||
|
|
@ -663,6 +663,7 @@ TokenStream::reportCompileErrorNumberVA(uint32_t offset, unsigned flags, unsigne
|
|||
return false;
|
||||
CompileError& err = *tempErrPtr;
|
||||
|
||||
err.notes = Move(notes);
|
||||
err.flags = flags;
|
||||
err.errorNumber = errorNumber;
|
||||
err.filename = filename;
|
||||
|
|
@ -754,7 +755,7 @@ TokenStream::reportStrictModeError(unsigned errorNumber, ...)
|
|||
{
|
||||
va_list args;
|
||||
va_start(args, errorNumber);
|
||||
bool result = reportStrictModeErrorNumberVA(currentToken().pos.begin, strictMode(),
|
||||
bool result = reportStrictModeErrorNumberVA(nullptr, currentToken().pos.begin, strictMode(),
|
||||
errorNumber, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
|
|
@ -765,8 +766,8 @@ TokenStream::reportError(unsigned errorNumber, ...)
|
|||
{
|
||||
va_list args;
|
||||
va_start(args, errorNumber);
|
||||
bool result = reportCompileErrorNumberVA(currentToken().pos.begin, JSREPORT_ERROR, errorNumber,
|
||||
args);
|
||||
bool result = reportCompileErrorNumberVA(nullptr, currentToken().pos.begin, JSREPORT_ERROR,
|
||||
errorNumber, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -776,8 +777,8 @@ TokenStream::reportErrorNoOffset(unsigned errorNumber, ...)
|
|||
{
|
||||
va_list args;
|
||||
va_start(args, errorNumber);
|
||||
bool result = reportCompileErrorNumberVA(NoOffset, JSREPORT_ERROR, errorNumber,
|
||||
args);
|
||||
bool result = reportCompileErrorNumberVA(nullptr, NoOffset, JSREPORT_ERROR,
|
||||
errorNumber, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -787,19 +788,21 @@ TokenStream::warning(unsigned errorNumber, ...)
|
|||
{
|
||||
va_list args;
|
||||
va_start(args, errorNumber);
|
||||
bool result = reportCompileErrorNumberVA(currentToken().pos.begin, JSREPORT_WARNING,
|
||||
bool result = reportCompileErrorNumberVA(nullptr, currentToken().pos.begin, JSREPORT_WARNING,
|
||||
errorNumber, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
TokenStream::reportExtraWarningErrorNumberVA(uint32_t offset, unsigned errorNumber, va_list args)
|
||||
TokenStream::reportExtraWarningErrorNumberVA(UniquePtr<JSErrorNotes> notes, uint32_t offset,
|
||||
unsigned errorNumber, va_list args)
|
||||
{
|
||||
if (!options().extraWarningsOption)
|
||||
return true;
|
||||
|
||||
return reportCompileErrorNumberVA(offset, JSREPORT_STRICT|JSREPORT_WARNING, errorNumber, args);
|
||||
return reportCompileErrorNumberVA(Move(notes), offset, JSREPORT_STRICT|JSREPORT_WARNING,
|
||||
errorNumber, args);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -810,7 +813,7 @@ TokenStream::reportAsmJSError(uint32_t offset, unsigned errorNumber, ...)
|
|||
unsigned flags = options().throwOnAsmJSValidationFailureOption
|
||||
? JSREPORT_ERROR
|
||||
: JSREPORT_WARNING;
|
||||
reportCompileErrorNumberVA(offset, flags, errorNumber, args);
|
||||
reportCompileErrorNumberVA(nullptr, offset, flags, errorNumber, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
|
@ -822,7 +825,8 @@ TokenStream::error(unsigned errorNumber, ...)
|
|||
#ifdef DEBUG
|
||||
bool result =
|
||||
#endif
|
||||
reportCompileErrorNumberVA(currentToken().pos.begin, JSREPORT_ERROR, errorNumber, args);
|
||||
reportCompileErrorNumberVA(nullptr, currentToken().pos.begin, JSREPORT_ERROR,
|
||||
errorNumber, args);
|
||||
MOZ_ASSERT(!result, "reporting an error returned true?");
|
||||
va_end(args);
|
||||
}
|
||||
|
|
@ -835,7 +839,7 @@ TokenStream::errorAt(uint32_t offset, unsigned errorNumber, ...)
|
|||
#ifdef DEBUG
|
||||
bool result =
|
||||
#endif
|
||||
reportCompileErrorNumberVA(offset, JSREPORT_ERROR, errorNumber, args);
|
||||
reportCompileErrorNumberVA(nullptr, offset, JSREPORT_ERROR, errorNumber, args);
|
||||
MOZ_ASSERT(!result, "reporting an error returned true?");
|
||||
va_end(args);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue