<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [INTL] Implement the caseFirst option for Intl.Collator"
href="https://bugs.webkit.org/show_bug.cgi?id=158188#c6">Comment # 6</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [INTL] Implement the caseFirst option for Intl.Collator"
href="https://bugs.webkit.org/show_bug.cgi?id=158188">bug 158188</a>
from <span class="vcard"><a class="email" href="mailto:sukolsak@gmail.com" title="Sukolsak Sakshuwong <sukolsak@gmail.com>"> <span class="fn">Sukolsak Sakshuwong</span></a>
</span></b>
<pre>Thanks.
(In reply to <a href="show_bug.cgi?id=158188#c5">comment #5</a>)
<span class="quote">> Comment on <span class=""><a href="attachment.cgi?id=280100&action=diff" name="attach_280100" title="Patch">attachment 280100</a> <a href="attachment.cgi?id=280100&action=edit" title="Patch">[details]</a></span>
> Patch
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=280100&action=review">https://bugs.webkit.org/attachment.cgi?id=280100&action=review</a>
>
> > Source/JavaScriptCore/runtime/IntlCollator.cpp:289
> > m_numeric = (result.get(ASCIILiteral("kn")) == "true");
>
> I’d like how this reads better without the parentheses.</span >
Will fix.
<span class="quote">> > Source/JavaScriptCore/runtime/IntlCollator.cpp:290
> > + const String& caseFirst = result.get(ASCIILiteral("kf"));
>
> As with the cases below, I think it’s nicer to have the translation from
> string to CaseFirst be in a helper function. It can be inlined if we like.</span >
Will do. Do you have any name suggestion for the helper function? caseFirstString(CaseFirst) <-> caseFirstFromString(const String&)?
<span class="quote">> > Source/JavaScriptCore/runtime/IntlCollator.cpp:296
> > + ASSERT(caseFirst == "false");
>
> Why can we assert this? What prevents invalid values?</span >
The HashMap "result" which we get the caseFirst value from is sanitized by resolveLocale(...). We test invalid values in the tests.
<span class="quote">> > Source/JavaScriptCore/runtime/IntlCollator.cpp:451
> > +const char* IntlCollator::caseFirstString(CaseFirst caseFirst)
>
> I think we should probably mark this function inline.</span >
Will do.
<span class="quote">> > Source/JavaScriptCore/runtime/IntlCollator.cpp:462
> > + return nullptr;
>
> I think we should return "false" here instead of nullptr.</span >
Why is that? Is it so that the compiler can optimize out the "case CaseFirst::False:" branch?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>