Bug 236783 - [WGSL] The lexer should use the functions from wtf/ASCIICType.h
Summary: [WGSL] The lexer should use the functions from wtf/ASCIICType.h
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Robin Morisset
URL:
Keywords: InRadar
Depends on: 233276
Blocks:
  Show dependency treegraph
 
Reported: 2022-02-17 07:56 PST by Robin Morisset
Modified: 2022-03-08 12:16 PST (History)
2 users (show)

See Also:


Attachments
Patch (7.48 KB, patch)
2022-02-17 07:59 PST, Robin Morisset
darin: review+
rmorisset: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (7.19 KB, patch)
2022-03-07 18:28 PST, Robin Morisset
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Morisset 2022-02-17 07:56:40 PST
As suggested by Darin in a post-landing review of https://bugs.webkit.org/show_bug.cgi?id=233276.
Comment 1 Robin Morisset 2022-02-17 07:59:56 PST
Created attachment 452367 [details]
Patch
Comment 2 Darin Adler 2022-02-17 10:07:17 PST
Comment on attachment 452367 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=452367&action=review

> Source/WebGPU/WGSL/Lexer.cpp:163
> +        if (isASCIIDigit (m_current)) {

Stray space here after isASCIIDigit.

> Source/WebGPU/WGSL/Lexer.cpp:191
> -        } else if (isIdentifierStart(m_current)) {
> +        } else if (isASCIIAlpha(m_current)) {

Not sure this change is an improvement. Might want isIdentifierStart so the intent of the code is more apparent. The implementation of that function can use isASCIIAlpha.

> Source/WebGPU/WGSL/Lexer.cpp:194
> -            while (isValidIdentifierCharacter(m_current))
> +            while (isASCIIAlphanumeric(m_current) || m_current == '_')

Ditto.

> Source/WebGPU/WGSL/Lexer.cpp:271
> -    while (isWhiteSpace(m_current)) {
> +    while (isASCIISpace(m_current)) {

It can be ambiguous sometimes which definition of whitespace to use in various contexts. Might still want a named function for that.

> Source/WebGPU/WGSL/Lexer.cpp:301
> -        value += readDecimal(m_current);
> +        value += static_cast<uint64_t>(m_current - '0');

This code looks less elegant than the old.
Comment 3 Robin Morisset 2022-02-17 11:02:34 PST
Comment on attachment 452367 [details]
Patch

Thank you for the review, I've visibly overcorrected in eliminating my code.
I'll fix it and update the patch.
Comment 4 Radar WebKit Bug Importer 2022-02-24 07:57:18 PST
<rdar://problem/89418026>
Comment 5 Robin Morisset 2022-03-07 18:28:15 PST
Created attachment 454058 [details]
Patch for landing
Comment 6 EWS 2022-03-08 12:16:19 PST
Committed r291004 (248180@main): <https://commits.webkit.org/248180@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 454058 [details].