RegExp constructor should use Symbol.match and other properties
authorkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2016 18:26:11 +0000 (18:26 +0000)
committerkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2016 18:26:11 +0000 (18:26 +0000)
commitf75f4b6c7ebf5cf661d9a63a20ede0508d5e61e9
treea0e7d6df085900c419550afb09f8749e7ce07f7a
parenta556c17a00c802f43f1e1f822593d18b9576b6c8
RegExp constructor should use Symbol.match and other properties
https://bugs.webkit.org/show_bug.cgi?id=155873

Reviewed by Michael Saboff.

Source/JavaScriptCore:

This patch updates the behavior of the RegExp constructor. Now the constructor
should get the Symbol.match property and check if it exists to decide if something
should be constructed like a regexp object.

* runtime/RegExpConstructor.cpp:
(JSC::toFlags):
(JSC::constructRegExp):
(JSC::constructWithRegExpConstructor):
(JSC::callRegExpConstructor):
* runtime/RegExpConstructor.h:
* tests/stress/regexp-constructor.js: Added.
(assert):
(throw.new.Error.get let):
(throw.new.Error.):
(throw.new.Error.get re):

LayoutTests:

Fix test for new behavior.

* fast/regex/constructor-expected.txt:
* fast/regex/script-tests/constructor.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199106 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/regex/constructor-expected.txt
LayoutTests/fast/regex/script-tests/constructor.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/RegExpConstructor.cpp
Source/JavaScriptCore/runtime/RegExpConstructor.h