1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:27:45 +00:00

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

View file

@ -8,6 +8,7 @@
#include "Token.h" #include "Token.h"
#include <AK/Assertions.h> #include <AK/Assertions.h>
#include <AK/CharacterTypes.h> #include <AK/CharacterTypes.h>
#include <AK/FloatingPointStringConversions.h>
#include <AK/GenericLexer.h> #include <AK/GenericLexer.h>
#include <AK/StringBuilder.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 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) static u32 hex2int(char x)