LibJS: Make Token use the new double parser

This commit is contained in:
davidot 2022-10-12 02:23:00 +02:00 committed by Linus Groh
parent 9921f80817
commit 7db59124e8
Notes: sideshowbarker 2024-07-17 05:11:53 +09:00

View file

@ -8,6 +8,7 @@
#include "Token.h"
#include <AK/Assertions.h>
#include <AK/CharacterTypes.h>
#include <AK/FloatingPointStringConversions.h>
#include <AK/GenericLexer.h>
#include <AK/StringBuilder.h>
@ -79,7 +80,8 @@ double Token::double_value() const
return static_cast<double>(strtoul(value_string.characters() + 1, nullptr, 8));
}
}
return strtod(value_string.characters(), nullptr);
// This should always be a valid double
return value_string.to_double().release_value();
}
static u32 hex2int(char x)