summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/TokenStream.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-06-08 15:54:42 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:17 -0400
commit0ed4cf321f276d88f80d13daf2644f9bc51b0957 (patch)
tree41620b1fff47407e2538a3db288b2b974c0b904b /js/src/frontend/TokenStream.cpp
parentd400e9491c0be93f34f368227d6a3e4d056d9061 (diff)
downloadUXP-0ed4cf321f276d88f80d13daf2644f9bc51b0957.tar
UXP-0ed4cf321f276d88f80d13daf2644f9bc51b0957.tar.gz
UXP-0ed4cf321f276d88f80d13daf2644f9bc51b0957.tar.lz
UXP-0ed4cf321f276d88f80d13daf2644f9bc51b0957.tar.xz
UXP-0ed4cf321f276d88f80d13daf2644f9bc51b0957.zip
1326454 - Make TokenStream::skipChars{,IgnoreEOL} accept an unsigned integral number of chars to skip.
Diffstat (limited to 'js/src/frontend/TokenStream.cpp')
-rw-r--r--js/src/frontend/TokenStream.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/js/src/frontend/TokenStream.cpp b/js/src/frontend/TokenStream.cpp
index 6c5ea8fe9..619285090 100644
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -8,6 +8,7 @@
#include "frontend/TokenStream.h"
+#include "mozilla/ArrayUtils.h"
#include "mozilla/IntegerTypeTraits.h"
#include "mozilla/PodOperations.h"
@@ -33,6 +34,7 @@
using namespace js;
using namespace js::frontend;
+using mozilla::ArrayLength;
using mozilla::Maybe;
using mozilla::PodAssign;
using mozilla::PodCopy;
@@ -962,7 +964,7 @@ TokenStream::getDirectives(bool isMultiline, bool shouldWarnDeprecated)
bool
TokenStream::getDirective(bool isMultiline, bool shouldWarnDeprecated,
- const char* directive, int directiveLength,
+ const char* directive, uint8_t directiveLength,
const char* errorMsgPragma,
UniqueTwoByteChars* destination)
{
@@ -1036,7 +1038,10 @@ TokenStream::getDisplayURL(bool isMultiline, bool shouldWarnDeprecated)
// developer would like to refer to the source as from the source's actual
// URL.
- return getDirective(isMultiline, shouldWarnDeprecated, " sourceURL=", 11,
+ static const char sourceURLDirective[] = " sourceURL=";
+ constexpr uint8_t sourceURLDirectiveLength = ArrayLength(sourceURLDirective) - 1;
+ return getDirective(isMultiline, shouldWarnDeprecated,
+ sourceURLDirective, sourceURLDirectiveLength,
"sourceURL", &displayURL_);
}
@@ -1046,7 +1051,10 @@ TokenStream::getSourceMappingURL(bool isMultiline, bool shouldWarnDeprecated)
// Match comments of the form "//# sourceMappingURL=<url>" or
// "/\* //# sourceMappingURL=<url> *\/"
- return getDirective(isMultiline, shouldWarnDeprecated, " sourceMappingURL=", 18,
+ static const char sourceMappingURLDirective[] = " sourceMappingURL=";
+ constexpr uint8_t sourceMappingURLDirectiveLength = ArrayLength(sourceMappingURLDirective) - 1;
+ return getDirective(isMultiline, shouldWarnDeprecated,
+ sourceMappingURLDirective, sourceMappingURLDirectiveLength,
"sourceMappingURL", &sourceMapURL_);
}