Bug 1433909 - Part 3: Rename TokenStream::undoGetChar for clarity. r=Waldo

--HG--
extra : rebase_source : 38442029923125d20e94c0e372e09bedcf586d1c
extra : histedit_source : fd0fcd8b0788238448eb28e5c92ba7c298642597
This commit is contained in:
André Bargull 2018-03-29 06:21:56 -07:00
parent 780fa12108
commit 9a6b5da848
2 changed files with 12 additions and 12 deletions

View File

@ -474,6 +474,15 @@ TokenStreamAnyChars::internalUpdateLineInfoForEOL(uint32_t lineStartOffset)
return srcCoords.add(lineno, linebase);
}
void
TokenStreamAnyChars::undoInternalUpdateLineInfoForEOL()
{
MOZ_ASSERT(prevLinebase != size_t(-1)); // we should never get more than one EOL
linebase = prevLinebase;
prevLinebase = size_t(-1);
lineno--;
}
template<typename CharT, class AnyCharsAccess>
MOZ_MUST_USE MOZ_ALWAYS_INLINE bool
TokenStreamSpecific<CharT, AnyCharsAccess>::updateLineInfoForEOL()
@ -545,15 +554,6 @@ GeneralTokenStreamChars<CharT, AnyCharsAccess>::getCharIgnoreEOL()
return EOF;
}
void
TokenStreamAnyChars::undoGetChar()
{
MOZ_ASSERT(prevLinebase != size_t(-1)); // we should never get more than one EOL
linebase = prevLinebase;
prevLinebase = size_t(-1);
lineno--;
}
template<typename CharT, class AnyCharsAccess>
void
GeneralTokenStreamChars<CharT, AnyCharsAccess>::ungetChar(int32_t c)
@ -573,7 +573,7 @@ GeneralTokenStreamChars<CharT, AnyCharsAccess>::ungetChar(int32_t c)
if (!userbuf.atStart())
userbuf.matchRawCharBackwards('\r');
anyCharsAccess().undoGetChar();
anyCharsAccess().undoInternalUpdateLineInfoForEOL();
} else {
MOZ_ASSERT(userbuf.peekRawChar() == c);
}

View File

@ -520,8 +520,6 @@ class TokenStreamAnyChars
private:
PropertyName* reservedWordToPropertyName(TokenKind tt) const;
void undoGetChar();
public:
PropertyName* currentName() const {
if (isCurrentTokenType(TokenKind::Name))
@ -749,6 +747,8 @@ class TokenStreamAnyChars
private:
MOZ_MUST_USE MOZ_ALWAYS_INLINE bool internalUpdateLineInfoForEOL(uint32_t lineStartOffset);
void undoInternalUpdateLineInfoForEOL();
public:
const Token& nextToken() const {
MOZ_ASSERT(hasLookahead());