[webkit-reviews] review granted: [Bug 217115] [JSC] Implement item method proposal : [Attachment 410087] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Sep 30 10:59:49 PDT 2020
Yusuke Suzuki <ysuzuki at apple.com> has granted Ross Kirsling
<ross.kirsling at sony.com>'s request for review:
Bug 217115: [JSC] Implement item method proposal
https://bugs.webkit.org/show_bug.cgi?id=217115
Attachment 410087: Patch
https://bugs.webkit.org/attachment.cgi?id=410087&action=review
--- Comment #3 from Yusuke Suzuki <ysuzuki at apple.com> ---
Comment on attachment 410087
--> https://bugs.webkit.org/attachment.cgi?id=410087
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=410087&action=review
> Source/JavaScriptCore/builtins/StringPrototype.js:358
> +function item(index)
> +{
> + "use strict";
> +
> + if (@isUndefinedOrNull(this))
> + @throwTypeError("String.prototype.item requires that |this| not be
null or undefined");
> +
> + var string = @toString(this);
> + var length = string.length;
> +
> + var k = @toInteger(index);
> + if (k < 0)
> + k += length;
> +
> + return (k >= 0 && k < length) ? string[k] : @undefined;
> +}
Can you file a bug making String#item accelerated like String#charAt? And can
you add FIXME to that bug here?
I think item and charAt are super similar.
More information about the webkit-reviews
mailing list