mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:07:35 +00:00
LibJS: Parse digits with parse_ascii_base36_digit in parseInt
This was accidentally replaced with parse_ascii_hex_digit in
bc8d16ad28
which caused radices above
16 (hex) to fail.
This commit is contained in:
parent
2011fcff24
commit
bda32e9440
1 changed files with 2 additions and 2 deletions
|
@ -251,9 +251,9 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::parse_int)
|
||||||
}
|
}
|
||||||
|
|
||||||
auto parse_digit = [&](u32 code_point, i32 radix) -> Optional<i32> {
|
auto parse_digit = [&](u32 code_point, i32 radix) -> Optional<i32> {
|
||||||
if (!is_ascii_hex_digit(code_point) || radix <= 0)
|
if (!is_ascii_alphanumeric(code_point) || radix <= 0)
|
||||||
return {};
|
return {};
|
||||||
auto digit = parse_ascii_hex_digit(code_point);
|
auto digit = parse_ascii_base36_digit(code_point);
|
||||||
if (digit >= (u32)radix)
|
if (digit >= (u32)radix)
|
||||||
return {};
|
return {};
|
||||||
return digit;
|
return digit;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue