[webkit-reviews] review granted: [Bug 131704] Simple ES6 feature:String prototype additions : [Attachment 238045] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 12 17:56:33 PDT 2014


Darin Adler <darin at apple.com> has granted Diego Pino <dpino at igalia.com>'s
request for review:
Bug 131704: Simple ES6 feature:String prototype additions
https://bugs.webkit.org/show_bug.cgi?id=131704

Attachment 238045: Patch
https://bugs.webkit.org/attachment.cgi?id=238045&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=238045&action=review


> Source/WTF/wtf/text/StringImpl.cpp:1424
> +bool StringImpl::startsWith(StringImpl& matchString, unsigned startOffset,
bool caseSensitive) const
> +{
> +    return equalInner(const_cast<StringImpl&>(*this), startOffset,
matchString, caseSensitive);
> +}

We should follow this up by removing all the const on StringImpl member
functions since it’s an immutable class, and all StringImpl are const; when we
remove the const from this one, we can remove the const_cast.

> Source/WTF/wtf/text/StringImpl.cpp:1455
> +bool StringImpl::endsWith(StringImpl& matchString, unsigned endOffset, bool
caseSensitive) const
> +{
> +    if (endOffset < matchString.length())
> +	   return false;
> +    return equalInner(const_cast<StringImpl&>(*this), endOffset -
matchString.length(), matchString, caseSensitive);
> +}

We should follow this up by removing all the const on StringImpl member
functions since it’s an immutable class, and all StringImpl are const; when we
remove the const from this one, we can remove the const_cast.


More information about the webkit-reviews mailing list