mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-25 00:27:29 +09:00
1326454 - Make TokenStream::skipChars{,IgnoreEOL} accept an unsigned integral number of chars to skip.
This commit is contained in:
parent
c7d3f8e8a3
commit
a91f1769b7
2 changed files with 16 additions and 8 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "frontend/TokenStream.h"
|
#include "frontend/TokenStream.h"
|
||||||
|
|
||||||
|
#include "mozilla/ArrayUtils.h"
|
||||||
#include "mozilla/IntegerTypeTraits.h"
|
#include "mozilla/IntegerTypeTraits.h"
|
||||||
#include "mozilla/PodOperations.h"
|
#include "mozilla/PodOperations.h"
|
||||||
|
|
||||||
|
|
@ -33,6 +34,7 @@
|
||||||
using namespace js;
|
using namespace js;
|
||||||
using namespace js::frontend;
|
using namespace js::frontend;
|
||||||
|
|
||||||
|
using mozilla::ArrayLength;
|
||||||
using mozilla::Maybe;
|
using mozilla::Maybe;
|
||||||
using mozilla::PodAssign;
|
using mozilla::PodAssign;
|
||||||
using mozilla::PodCopy;
|
using mozilla::PodCopy;
|
||||||
|
|
@ -962,7 +964,7 @@ TokenStream::getDirectives(bool isMultiline, bool shouldWarnDeprecated)
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TokenStream::getDirective(bool isMultiline, bool shouldWarnDeprecated,
|
TokenStream::getDirective(bool isMultiline, bool shouldWarnDeprecated,
|
||||||
const char* directive, int directiveLength,
|
const char* directive, uint8_t directiveLength,
|
||||||
const char* errorMsgPragma,
|
const char* errorMsgPragma,
|
||||||
UniqueTwoByteChars* destination)
|
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
|
// developer would like to refer to the source as from the source's actual
|
||||||
// URL.
|
// 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_);
|
"sourceURL", &displayURL_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1046,7 +1051,10 @@ TokenStream::getSourceMappingURL(bool isMultiline, bool shouldWarnDeprecated)
|
||||||
// Match comments of the form "//# sourceMappingURL=<url>" or
|
// Match comments of the form "//# sourceMappingURL=<url>" or
|
||||||
// "/\* //# sourceMappingURL=<url> *\/"
|
// "/\* //# 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_);
|
"sourceMappingURL", &sourceMapURL_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -972,7 +972,7 @@ class MOZ_STACK_CLASS TokenStream
|
||||||
|
|
||||||
MOZ_MUST_USE bool getDirectives(bool isMultiline, bool shouldWarnDeprecated);
|
MOZ_MUST_USE bool getDirectives(bool isMultiline, bool shouldWarnDeprecated);
|
||||||
MOZ_MUST_USE bool getDirective(bool isMultiline, bool shouldWarnDeprecated,
|
MOZ_MUST_USE bool getDirective(bool isMultiline, bool shouldWarnDeprecated,
|
||||||
const char* directive, int directiveLength,
|
const char* directive, uint8_t directiveLength,
|
||||||
const char* errorMsgPragma,
|
const char* errorMsgPragma,
|
||||||
UniquePtr<char16_t[], JS::FreePolicy>* destination);
|
UniquePtr<char16_t[], JS::FreePolicy>* destination);
|
||||||
MOZ_MUST_USE bool getDisplayURL(bool isMultiline, bool shouldWarnDeprecated);
|
MOZ_MUST_USE bool getDisplayURL(bool isMultiline, bool shouldWarnDeprecated);
|
||||||
|
|
@ -996,13 +996,13 @@ class MOZ_STACK_CLASS TokenStream
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void skipChars(int n) {
|
void skipChars(uint8_t n) {
|
||||||
while (--n >= 0)
|
while (n-- > 0)
|
||||||
getChar();
|
getChar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void skipCharsIgnoreEOL(int n) {
|
void skipCharsIgnoreEOL(uint8_t n) {
|
||||||
while (--n >= 0)
|
while (n-- > 0)
|
||||||
getCharIgnoreEOL();
|
getCharIgnoreEOL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue