Changeset 244038 in webkit for trunk/Source/JavaScriptCore/parser/Lexer.cpp
- Timestamp:
- Apr 8, 2019, 1:43:18 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/Lexer.cpp
r244028 r244038 1692 1692 if (isLineTerminator(m_current)) { 1693 1693 shiftLineTerminator(); 1694 m_ terminator= true;1694 m_hasLineTerminatorBeforeToken = true; 1695 1695 } else 1696 1696 shift(); … … 1771 1771 1772 1772 template <typename T> 1773 JSTokenType Lexer<T>::lex (JSToken* tokenRecord, unsigned lexerFlags, bool strictMode)1773 JSTokenType Lexer<T>::lexWithoutClearingLineTerminator(JSToken* tokenRecord, unsigned lexerFlags, bool strictMode) 1774 1774 { 1775 1775 JSTokenData* tokenData = &tokenRecord->m_data; … … 1782 1782 1783 1783 JSTokenType token = ERRORTOK; 1784 m_terminator = false;1785 1784 1786 1785 start: 1787 1786 skipWhitespace(); 1788 1787 1789 if (atEnd())1790 return EOFTOK;1791 1792 1788 tokenLocation->startOffset = currentOffset(); 1793 1789 ASSERT(currentOffset() >= currentLineStartOffset()); 1794 1790 tokenRecord->m_startPosition = currentPosition(); 1791 1792 if (atEnd()) { 1793 token = EOFTOK; 1794 goto returnToken; 1795 } 1795 1796 1796 1797 CharacterType type; … … 1903 1904 if (m_current == '+') { 1904 1905 shift(); 1905 token = (!m_ terminator) ? PLUSPLUS : AUTOPLUSPLUS;1906 token = (!m_hasLineTerminatorBeforeToken) ? PLUSPLUS : AUTOPLUSPLUS; 1906 1907 break; 1907 1908 } … … 1917 1918 if (m_current == '-') { 1918 1919 shift(); 1919 if ((m_atLineStart || m_ terminator) && m_current == '>') {1920 if ((m_atLineStart || m_hasLineTerminatorBeforeToken) && m_current == '>') { 1920 1921 if (m_scriptMode == JSParserScriptMode::Classic) { 1921 1922 shift(); … … 1923 1924 } 1924 1925 } 1925 token = (!m_ terminator) ? MINUSMINUS : AUTOMINUSMINUS;1926 token = (!m_hasLineTerminatorBeforeToken) ? MINUSMINUS : AUTOMINUSMINUS; 1926 1927 break; 1927 1928 } … … 2294 2295 shiftLineTerminator(); 2295 2296 m_atLineStart = true; 2296 m_ terminator= true;2297 m_hasLineTerminatorBeforeToken = true; 2297 2298 m_lineStart = m_code; 2298 2299 goto start; … … 2334 2335 2335 2336 while (!isLineTerminator(m_current)) { 2336 if (atEnd()) 2337 return EOFTOK; 2337 if (atEnd()) { 2338 token = EOFTOK; 2339 fillTokenInfo(tokenRecord, token, lineNumber, endOffset, lineStartOffset, endPosition); 2340 return token; 2341 } 2338 2342 shift(); 2339 2343 } 2340 2344 shiftLineTerminator(); 2341 2345 m_atLineStart = true; 2342 m_ terminator= true;2346 m_hasLineTerminatorBeforeToken = true; 2343 2347 m_lineStart = m_code; 2344 2348 if (!lastTokenWasRestrKeyword())
Note:
See TracChangeset
for help on using the changeset viewer.