1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:37:35 +00:00

LibJS: Use the new is_ascii_foo() helpers from AK

These constexpr helpers generate nicer code than the LibC ctype.h
variants, so let's make use of them. :^)
This commit is contained in:
Andreas Kling 2021-06-13 10:47:09 +02:00
parent d476144565
commit 39ad705c13
5 changed files with 30 additions and 31 deletions

View file

@ -6,11 +6,11 @@
*/
#include "Parser.h"
#include <AK/CharacterTypes.h>
#include <AK/HashTable.h>
#include <AK/ScopeGuard.h>
#include <AK/StdLibExtras.h>
#include <AK/TemporaryChange.h>
#include <ctype.h>
namespace JS {
@ -2213,7 +2213,7 @@ Token Parser::consume(TokenType expected_type)
Token Parser::consume_and_validate_numeric_literal()
{
auto is_unprefixed_octal_number = [](const StringView& value) {
return value.length() > 1 && value[0] == '0' && isdigit(value[1]);
return value.length() > 1 && value[0] == '0' && is_ascii_digit(value[1]);
};
auto literal_start = position();
auto token = consume(TokenType::NumericLiteral);