You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[MERGE #5601@boingoing] Assertion when scanning invalid numeric literal after multi-unit characters
Merge pull request #5601 from boingoing:multiunit_assert
We can throw an error when scanning numeric literals. If the numeric literal is preceeded by multi-unit whitespace (eaten as part of the numeric literal token) we will count up those multi-units into Scanner::m_cMultiUnits. However, if the numeric literal ends up throwing, we should reset the multi-unit counter in scanner to whatever it was before we started to scan the whitespace and numeric literal token. If we don't reset the multi-unit counter, the character offset for the error object will be wrong and debug build will assert.
Fixes#5571
assert.throws(()=>eval('\u20091a'),SyntaxError,'Multi-unit whitespace followed by numeric literal followed by identifier','Unexpected identifier after numeric literal');
91
+
assert.throws(()=>eval('\u20091\\u0065'),SyntaxError,'Multi-unit whitespace followed by numeric literal followed by unicode escape sequence','Unexpected identifier after numeric literal');
92
+
assert.throws(()=>eval('\u20090o1239'),SyntaxError,'Multi-unit whitespace followed by invalid octal numeric literal','Invalid number');
0 commit comments