Fix parsing numbers with padded whitespaces (#607)

This commit is contained in:
Max Graey
2019-05-27 15:37:07 +03:00
committed by Daniel Wirtz
parent 0339d82781
commit 9c51f1332c
5 changed files with 2287 additions and 1988 deletions

View File

@ -547,6 +547,11 @@ export function parseFloat(str: String): f64 {
// determine sign
var sign: f64;
// trim white spaces
while (isWhiteSpaceOrLineTerminator(code)) {
code = <i32>load<u16>(ptr += 2);
--len;
}
if (code == CharCode.MINUS) {
if (!--len) return NaN;
code = <i32>load<u16>(ptr += 2);