[webkit-reviews] review granted: [Bug 213708] Use more efficient makeString() instead of StringBuilder : [Attachment 403024] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jun 28 20:12:18 PDT 2020


Sam Weinig <sam at webkit.org> has granted Alexey Shvayka
<shvaikalesh at gmail.com>'s request for review:
Bug 213708: Use more efficient makeString() instead of StringBuilder
https://bugs.webkit.org/show_bug.cgi?id=213708

Attachment 403024: Patch

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




--- Comment #3 from Sam Weinig <sam at webkit.org> ---
Comment on attachment 403024
  --> https://bugs.webkit.org/attachment.cgi?id=403024
Patch

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

Nice improvement.

>> Source/WebCore/bindings/js/JSDOMExceptionHandling.cpp:174
>> +	    functionName ? interfaceName : "the ",
> 
> I find this approach more readable then prefix/suffix + empty strings.

I wonder if there is a nicer alternative. something akin to:

return makeString("Argument ", argumentIndex + 1, " ('", argumentName, "') to
", functionName ? substring("the ", interfaceName, " constructor") :
substring(interfaceName, ".", functionName), " must be ", strings...);


where makeSubstring(...) is implemented as something like:

template<typename... Args>
auto makeSubstring(Args... args) -> decltype(auto)
{
     return make_tuple(std::forward<Args...>(args...));
}

and then a general StringTypeAdapter<std::tuple<T...>> implementation to go
along with it.


More information about the webkit-reviews mailing list