summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/TokenStream.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-06-08 15:40:56 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:16 -0400
commit068916b59a847bede7c6c788e803442c1833fe67 (patch)
tree18ac777e5f48a9a3fed7df5e07d2dc415a8730da /js/src/frontend/TokenStream.cpp
parentf6193fd0f4689643f47c6ac9aa5aac3b8cc10213 (diff)
downloadUXP-068916b59a847bede7c6c788e803442c1833fe67.tar
UXP-068916b59a847bede7c6c788e803442c1833fe67.tar.gz
UXP-068916b59a847bede7c6c788e803442c1833fe67.tar.lz
UXP-068916b59a847bede7c6c788e803442c1833fe67.tar.xz
UXP-068916b59a847bede7c6c788e803442c1833fe67.zip
1326454 - Introduce TokenStream::warning that warns at the current offset.
Diffstat (limited to 'js/src/frontend/TokenStream.cpp')
-rw-r--r--js/src/frontend/TokenStream.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/js/src/frontend/TokenStream.cpp b/js/src/frontend/TokenStream.cpp
index 9becaf55e..e8d622d38 100644
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -777,7 +777,7 @@ TokenStream::reportErrorNoOffset(unsigned errorNumber, ...)
}
bool
-TokenStream::reportWarning(unsigned errorNumber, ...)
+TokenStream::warning(unsigned errorNumber, ...)
{
va_list args;
va_start(args, errorNumber);
@@ -958,9 +958,10 @@ TokenStream::getDirective(bool isMultiline, bool shouldWarnDeprecated,
int32_t c;
if (peekChars(directiveLength, peeked) && CharsMatch(peeked, directive)) {
- if (shouldWarnDeprecated &&
- !reportWarning(JSMSG_DEPRECATED_PRAGMA, errorMsgPragma))
- return false;
+ if (shouldWarnDeprecated) {
+ if (!warning(JSMSG_DEPRECATED_PRAGMA, errorMsgPragma))
+ return false;
+ }
skipChars(directiveLength);
tokenbuf.clear();
@@ -1555,10 +1556,11 @@ TokenStream::getTokenInternal(TokenKind* ttp, Modifier modifier)
// grammar. We might not always be so permissive, so we warn
// about it.
if (c >= '8') {
- if (!reportWarning(JSMSG_BAD_OCTAL, c == '8' ? "08" : "09")) {
+ if (!warning(JSMSG_BAD_OCTAL, c == '8' ? "08" : "09"))
goto error;
- }
- goto decimal; // use the decimal scanner for the rest of the number
+
+ // Use the decimal scanner for the rest of the number.
+ goto decimal;
}
c = getCharIgnoreEOL();
}