Changeset 247845 in webkit
- Timestamp:
- Jul 25, 2019 4:55:45 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r247819 r247845 1 2019-07-25 Ross Kirsling <ross.kirsling@sony.com> 2 3 Legacy numeric literals should not permit separators or BigInt 4 https://bugs.webkit.org/show_bug.cgi?id=199984 5 6 Reviewed by Keith Miller. 7 8 * stress/big-int-literals.js: 9 * stress/numeric-literal-separators.js: 10 1 11 2019-07-25 Ross Kirsling <ross.kirsling@sony.com> 2 12 -
trunk/JSTests/stress/big-int-literals.js
r245406 r247845 17 17 // Test 0 conversions 18 18 let n = 0n; 19 assert(n === 0n);20 21 n = 00n;22 19 assert(n === 0n); 23 20 … … 106 103 assertThrowSyntaxError("10E20n"); 107 104 assertThrowSyntaxError("--10n"); 105 assertThrowSyntaxError("00n"); 106 assertThrowSyntaxError("01n"); 107 assertThrowSyntaxError("09n"); -
trunk/JSTests/stress/numeric-literal-separators.js
r245655 r247845 95 95 shouldThrow('1e-2_', SyntaxError); 96 96 shouldThrow('1e-2__2', SyntaxError); 97 98 shouldThrow('01_1', SyntaxError); 99 shouldThrow('01_9', SyntaxError); 100 shouldThrow('09_1', SyntaxError); 101 shouldThrow('0100_001', SyntaxError); 102 shouldThrow('0100_009', SyntaxError); 103 shouldThrow('0900_001', SyntaxError); 104 shouldThrow('010000000000_1', SyntaxError); 105 shouldThrow('010000000000_9', SyntaxError); 106 shouldThrow('090000000000_1', SyntaxError); -
trunk/Source/JavaScriptCore/ChangeLog
r247844 r247845 1 2019-07-25 Ross Kirsling <ross.kirsling@sony.com> 2 3 Legacy numeric literals should not permit separators or BigInt 4 https://bugs.webkit.org/show_bug.cgi?id=199984 5 6 Reviewed by Keith Miller. 7 8 * parser/Lexer.cpp: 9 (JSC::Lexer<T>::parseOctal): 10 (JSC::Lexer<T>::parseDecimal): 11 1 12 2019-07-25 Yusuke Suzuki <ysuzuki@apple.com> 2 13 -
trunk/Source/JavaScriptCore/parser/Lexer.cpp
r247819 r247845 1626 1626 { 1627 1627 ASSERT(isASCIIOctalDigit(m_current)); 1628 ASSERT(!m_buffer8.size() || (m_buffer8.size() == 1 && m_buffer8[0] == '0')); 1629 bool isLegacyLiteral = m_buffer8.size(); 1628 1630 1629 1631 // Optimization: most octal values fit into 4 bytes. … … 1637 1639 do { 1638 1640 if (m_current == '_') { 1639 if (UNLIKELY(!isASCIIOctalDigit(peek(1)) ))1641 if (UNLIKELY(!isASCIIOctalDigit(peek(1)) || isLegacyLiteral)) 1640 1642 return WTF::nullopt; 1641 1643 … … 1657 1659 while (isASCIIOctalDigitOrSeparator(m_current)) { 1658 1660 if (m_current == '_') { 1659 if (UNLIKELY(!isASCIIOctalDigit(peek(1)) ))1661 if (UNLIKELY(!isASCIIOctalDigit(peek(1)) || isLegacyLiteral)) 1660 1662 return WTF::nullopt; 1661 1663 … … 1667 1669 } 1668 1670 1669 if (UNLIKELY(Options::useBigInt() && m_current == 'n') )1671 if (UNLIKELY(Options::useBigInt() && m_current == 'n') && !isLegacyLiteral) 1670 1672 return NumberParseResult { makeIdentifier(m_buffer8.data(), m_buffer8.size()) }; 1671 1673 … … 1680 1682 { 1681 1683 ASSERT(isASCIIDigit(m_current) || m_buffer8.size()); 1684 bool isLegacyLiteral = m_buffer8.size() && isASCIIDigitOrSeparator(m_current); 1682 1685 1683 1686 // Optimization: most decimal values fit into 4 bytes. … … 1695 1698 do { 1696 1699 if (m_current == '_') { 1697 if (UNLIKELY(!isASCIIDigit(peek(1)) ))1700 if (UNLIKELY(!isASCIIDigit(peek(1)) || isLegacyLiteral)) 1698 1701 return WTF::nullopt; 1699 1702 … … 1716 1719 while (isASCIIDigitOrSeparator(m_current)) { 1717 1720 if (m_current == '_') { 1718 if (UNLIKELY(!isASCIIDigit(peek(1)) ))1721 if (UNLIKELY(!isASCIIDigit(peek(1)) || isLegacyLiteral)) 1719 1722 return WTF::nullopt; 1720 1723 … … 1726 1729 } 1727 1730 1728 if (UNLIKELY(Options::useBigInt() && m_current == 'n' ))1731 if (UNLIKELY(Options::useBigInt() && m_current == 'n' && !isLegacyLiteral)) 1729 1732 return NumberParseResult { makeIdentifier(m_buffer8.data(), m_buffer8.size()) }; 1730 1733
Note: See TracChangeset
for help on using the changeset viewer.