mirror of
https://github.com/robertkrimen/otto.git
synced 2025-12-24 12:58:05 +08:00
Do not throw a TypeError when trying to set global, ignoreCase, source, etc.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user