[webkit-reviews] review granted: [Bug 33319] RegExp.prototype.toString returns "//" for empty regular expressions : [Attachment 46048] Proposed patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 7 09:20:14 PST 2010


Darin Adler <darin at apple.com> has granted Kent Hansen <kent.hansen at nokia.com>'s
request for review:
Bug 33319: RegExp.prototype.toString returns "//" for empty regular expressions
https://bugs.webkit.org/show_bug.cgi?id=33319

Attachment 46048: Proposed patch
https://bugs.webkit.org/attachment.cgi?id=46048&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
> -    return jsNontrivialString(exec, makeString("/",
asRegExpObject(thisValue)->get(exec,
exec->propertyNames().source).toString(exec), postfix));
> +    UString source = asRegExpObject(thisValue)->get(exec,
exec->propertyNames().source).toString(exec);
> +    return jsNontrivialString(exec, makeString("/", source.size() ? source :
UString("(?:)"), postfix));

There should be a comment here explaining that "//" has to be avoided because
it collides with comment syntax. Otherwise, it's non-obvious why that code
exists.

r=me


More information about the webkit-reviews mailing list