[webkit-reviews] review granted: [Bug 215058] [JSC] Implement Intl Language Tag Parser : [Attachment 405815] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 4 16:22:33 PDT 2020


Ross Kirsling <ross.kirsling at sony.com> has granted Yusuke Suzuki
<ysuzuki at apple.com>'s request for review:
Bug 215058: [JSC] Implement Intl Language Tag Parser
https://bugs.webkit.org/show_bug.cgi?id=215058

Attachment 405815: Patch

https://bugs.webkit.org/attachment.cgi?id=405815&action=review




--- Comment #4 from Ross Kirsling <ross.kirsling at sony.com> ---
Comment on attachment 405815
  --> https://bugs.webkit.org/attachment.cgi?id=405815
Patch

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

Looks good overall.

It sucks that ICU canonicalization isn't sufficient, but I think you're right
that this is unavoidable if we want cross-engine consistency, so thanks for
doing what I was too stubborn to do. ;)

I think Darin will likely have comments regarding the string manipulation
parts.


> Source/JavaScriptCore/runtime/IntlObject.cpp:851
> +    struct Code {
> +	   LChar characters[8] { };
> +    };

Is it necessary that this be wrapped in a struct?

> Source/JavaScriptCore/runtime/IntlObject.cpp:875
> +static bool isUnicodeExtensionAttribute(StringView string)

We could probably merge this with isUnicodeExtensionTypeComponent...

> Source/JavaScriptCore/runtime/IntlObject.cpp:888
> +static bool isUnicodeExtensionTypeComponent(StringView string)

...but note that isUnicodeLocaleIdentifierType also exists, so this already
feels a bit duplicative?

> Source/JavaScriptCore/runtime/IntlObject.cpp:917
> +static bool isUnicodeTValue(StringView string)

This appears to be just a TValue "component"?

(And also is matching the two functions above...perhaps we should have an
alphanum{i,j} helper function?)

> Source/JavaScriptCore/runtime/IntlObject.cpp:1078
> +    bool isTLangOrTField = false;

Seems like this should be renamed to something like `found`...

> Source/JavaScriptCore/runtime/IntlObject.cpp:1109
> +    if (!isTLangOrTField)
>	   return false;
> -    ++cursor;
> +    return true;

...and then you can just return it directly.

> Source/JavaScriptCore/runtime/IntlObject.cpp:1125
> +	   if (!isUnicodeOtherExtensionValue(m_current))
> +	       return true;
> +	   if (!next())
> +	       return true;

Seems like in a case like this you could conjoin the conditions, but I
understand if you prefer to keep parallelism with the rest of the logic.

> Source/JavaScriptCore/runtime/IntlObject.cpp:1231
> +    if (!parser.parseUnicodeLocaleId())
> +	   return false;
> +    if (!parser.isEOS())
> +	   return false;
> +    return true;

(There's a part of me that really wants to write this as a single return
statement, but I do see what you're aiming to convey with this code style. ;D)


More information about the webkit-reviews mailing list