Do not throw a TypeError when trying to set global, ignoreCase, source, etc.

This commit is contained in:
Robert Krimen
2013-05-02 20:23:07 +02:00
parent 596af0a836
commit fb974ca5db
2 changed files with 9 additions and 1 deletions

View File

@@ -199,6 +199,14 @@ func TestRegExp_source(t *testing.T) {
var def = new RegExp(abc);
[ abc.source, def.source, abc.source === def.source ];
`, ".,.,true")
test(`
var abc = /./i;
var def = abc.hasOwnProperty("source");
var ghi = abc.source;
abc.source = "xyzzy";
[ def, abc.source ];
`, "true,.")
}
func TestRegExp_newRegExp(t *testing.T) {

View File

@@ -306,7 +306,7 @@ func (self *_regExpStash) put(name string, value Value) {
switch name {
case "global", "ignoreCase", "multiline", "source":
// TODO Is this good enough? Check DefineOwnProperty
panic(newTypeError())
return
case "lastIndex":
self._regExpObject.LastIndex = value
return