summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/frontend/Parser.cpp')
-rw-r--r--js/src/frontend/Parser.cpp60
1 files changed, 49 insertions, 11 deletions
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
index 2e13910df..923b42870 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -579,7 +579,22 @@ ParserBase::error(unsigned errorNumber, ...)
#ifdef DEBUG
bool result =
#endif
- tokenStream.reportCompileErrorNumberVA(pos().begin, JSREPORT_ERROR, errorNumber, args);
+ tokenStream.reportCompileErrorNumberVA(nullptr, pos().begin, JSREPORT_ERROR,
+ errorNumber, args);
+ MOZ_ASSERT(!result, "reporting an error returned true?");
+ va_end(args);
+}
+
+void
+ParserBase::errorWithNotes(UniquePtr<JSErrorNotes> notes, unsigned errorNumber, ...)
+{
+ va_list args;
+ va_start(args, errorNumber);
+#ifdef DEBUG
+ bool result =
+#endif
+ tokenStream.reportCompileErrorNumberVA(Move(notes), pos().begin, JSREPORT_ERROR,
+ errorNumber, args);
MOZ_ASSERT(!result, "reporting an error returned true?");
va_end(args);
}
@@ -592,7 +607,22 @@ ParserBase::errorAt(uint32_t offset, unsigned errorNumber, ...)
#ifdef DEBUG
bool result =
#endif
- tokenStream.reportCompileErrorNumberVA(offset, JSREPORT_ERROR, errorNumber, args);
+ tokenStream.reportCompileErrorNumberVA(nullptr, offset, JSREPORT_ERROR, errorNumber, args);
+ MOZ_ASSERT(!result, "reporting an error returned true?");
+ va_end(args);
+}
+
+void
+ParserBase::errorWithNotesAt(UniquePtr<JSErrorNotes> notes, uint32_t offset,
+ unsigned errorNumber, ...)
+{
+ va_list args;
+ va_start(args, errorNumber);
+#ifdef DEBUG
+ bool result =
+#endif
+ tokenStream.reportCompileErrorNumberVA(Move(notes), offset, JSREPORT_ERROR,
+ errorNumber, args);
MOZ_ASSERT(!result, "reporting an error returned true?");
va_end(args);
}
@@ -603,7 +633,8 @@ ParserBase::warning(unsigned errorNumber, ...)
va_list args;
va_start(args, errorNumber);
bool result =
- tokenStream.reportCompileErrorNumberVA(pos().begin, JSREPORT_WARNING, errorNumber, args);
+ tokenStream.reportCompileErrorNumberVA(nullptr, pos().begin, JSREPORT_WARNING,
+ errorNumber, args);
va_end(args);
return result;
}
@@ -614,7 +645,8 @@ ParserBase::warningAt(uint32_t offset, unsigned errorNumber, ...)
va_list args;
va_start(args, errorNumber);
bool result =
- tokenStream.reportCompileErrorNumberVA(offset, JSREPORT_WARNING, errorNumber, args);
+ tokenStream.reportCompileErrorNumberVA(nullptr, offset, JSREPORT_WARNING,
+ errorNumber, args);
va_end(args);
return result;
}
@@ -624,7 +656,8 @@ ParserBase::extraWarning(unsigned errorNumber, ...)
{
va_list args;
va_start(args, errorNumber);
- bool result = tokenStream.reportExtraWarningErrorNumberVA(pos().begin, errorNumber, args);
+ bool result = tokenStream.reportExtraWarningErrorNumberVA(nullptr, pos().begin,
+ errorNumber, args);
va_end(args);
return result;
}
@@ -635,7 +668,7 @@ ParserBase::strictModeError(unsigned errorNumber, ...)
va_list args;
va_start(args, errorNumber);
bool res =
- tokenStream.reportStrictModeErrorNumberVA(pos().begin, pc->sc()->strict(),
+ tokenStream.reportStrictModeErrorNumberVA(nullptr, pos().begin, pc->sc()->strict(),
errorNumber, args);
va_end(args);
return res;
@@ -647,7 +680,8 @@ ParserBase::strictModeErrorAt(uint32_t offset, unsigned errorNumber, ...)
va_list args;
va_start(args, errorNumber);
bool res =
- tokenStream.reportStrictModeErrorNumberVA(offset, pc->sc()->strict(), errorNumber, args);
+ tokenStream.reportStrictModeErrorNumberVA(nullptr, offset, pc->sc()->strict(),
+ errorNumber, args);
va_end(args);
return res;
}
@@ -661,17 +695,21 @@ ParserBase::reportNoOffset(ParseReportKind kind, bool strict, unsigned errorNumb
uint32_t offset = TokenStream::NoOffset;
switch (kind) {
case ParseError:
- result = tokenStream.reportCompileErrorNumberVA(offset, JSREPORT_ERROR, errorNumber, args);
+ result = tokenStream.reportCompileErrorNumberVA(nullptr, offset, JSREPORT_ERROR,
+ errorNumber, args);
break;
case ParseWarning:
result =
- tokenStream.reportCompileErrorNumberVA(offset, JSREPORT_WARNING, errorNumber, args);
+ tokenStream.reportCompileErrorNumberVA(nullptr, offset, JSREPORT_WARNING,
+ errorNumber, args);
break;
case ParseExtraWarning:
- result = tokenStream.reportExtraWarningErrorNumberVA(offset, errorNumber, args);
+ result = tokenStream.reportExtraWarningErrorNumberVA(nullptr, offset,
+ errorNumber, args);
break;
case ParseStrictError:
- result = tokenStream.reportStrictModeErrorNumberVA(offset, strict, errorNumber, args);
+ result = tokenStream.reportStrictModeErrorNumberVA(nullptr, offset, strict,
+ errorNumber, args);
break;
}
va_end(args);