Bug 1434429 - Move TokenStreamSpecific::ungetCharIgnoreEOL into TokenStreamCharsBase. r=arai

--HG--
extra : rebase_source : 15c6b209b8a8509ed957f6b74ee0139714ecb68a
This commit is contained in:
Jeff Walden 2018-01-18 11:34:27 -08:00
parent de083b3ca7
commit 806b664104
2 changed files with 15 additions and 9 deletions

View File

@ -547,7 +547,7 @@ TokenStreamSpecific<CharT, AnyCharsAccess>::getChar(int32_t* cp)
// before it's ungotten.
template<typename CharT, class AnyCharsAccess>
int32_t
TokenStreamSpecific<CharT, AnyCharsAccess>::getCharIgnoreEOL()
GeneralTokenStreamChars<CharT, AnyCharsAccess>::getCharIgnoreEOL()
{
if (MOZ_LIKELY(userbuf.hasRawChars()))
return userbuf.getRawChar();
@ -590,9 +590,9 @@ GeneralTokenStreamChars<CharT, AnyCharsAccess>::ungetChar(int32_t c)
}
}
template<typename CharT, class AnyCharsAccess>
template<typename CharT>
void
TokenStreamSpecific<CharT, AnyCharsAccess>::ungetCharIgnoreEOL(int32_t c)
TokenStreamCharsBase<CharT>::ungetCharIgnoreEOL(int32_t c)
{
if (c == EOF)
return;
@ -1278,11 +1278,9 @@ bool
TokenStreamChars<char16_t, AnyCharsAccess>::matchTrailForLeadSurrogate(char16_t lead,
uint32_t* codePoint)
{
TokenStreamSpecific* ts = asSpecific();
int32_t maybeTrail = ts->getCharIgnoreEOL();
int32_t maybeTrail = getCharIgnoreEOL();
if (!unicode::IsTrailSurrogate(maybeTrail)) {
ts->ungetCharIgnoreEOL(maybeTrail);
ungetCharIgnoreEOL(maybeTrail);
return false;
}

View File

@ -813,6 +813,9 @@ class TokenStreamAnyChars
template<typename CharT>
class TokenStreamCharsBase
{
protected:
void ungetCharIgnoreEOL(int32_t c);
public:
using CharBuffer = Vector<CharT, 32>;
@ -1022,6 +1025,8 @@ class GeneralTokenStreamChars
return static_cast<TokenStreamSpecific*>(this);
}
int32_t getCharIgnoreEOL();
void ungetChar(int32_t c);
};
@ -1035,6 +1040,9 @@ class TokenStreamChars<char16_t, AnyCharsAccess>
using GeneralCharsBase = GeneralTokenStreamChars<char16_t, AnyCharsAccess>;
using CharsSharedBase = TokenStreamCharsBase<char16_t>;
using GeneralCharsBase::getCharIgnoreEOL;
using CharsSharedBase::ungetCharIgnoreEOL;
bool matchTrailForLeadSurrogate(char16_t lead, uint32_t* codePoint);
public:
@ -1131,9 +1139,11 @@ class MOZ_STACK_CLASS TokenStreamSpecific
using CharsSharedBase::appendMultiUnitCodepointToTokenbuf;
using CharsSharedBase::atomizeChars;
using CharsSharedBase::copyTokenbufTo;
using GeneralCharsBase::getCharIgnoreEOL;
using CharsBase::isMultiUnitCodepoint;
using CharsSharedBase::tokenbuf;
using GeneralCharsBase::ungetChar;
using CharsSharedBase::ungetCharIgnoreEOL;
using CharsSharedBase::userbuf;
public:
@ -1411,9 +1421,7 @@ class MOZ_STACK_CLASS TokenStreamSpecific
// and store the character in |*c|. Return false and leave |*c| undefined
// on failure.
MOZ_MUST_USE bool getChar(int32_t* cp);
int32_t getCharIgnoreEOL();
void ungetCharIgnoreEOL(int32_t c);
Token* newToken(ptrdiff_t adjust);
uint32_t peekUnicodeEscape(uint32_t* codePoint);
uint32_t peekExtendedUnicodeEscape(uint32_t* codePoint);