diff options
Diffstat (limited to 'deps/v8/test/mjsunit/regress/regress-v8-10513.js')
-rw-r--r-- | deps/v8/test/mjsunit/regress/regress-v8-10513.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/regress/regress-v8-10513.js b/deps/v8/test/mjsunit/regress/regress-v8-10513.js new file mode 100644 index 00000000000..e9b91f5b4d6 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-v8-10513.js @@ -0,0 +1,25 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +const access_log = []; +const handler = { + get: function(obj, prop) { + access_log.push(prop); + return prop in obj ? obj[prop] : "z"; + } +}; + +class ProxiedGroupRegExp extends RegExp { + exec(s) { + var result = super.exec(s); + if (result) { + result.groups = new Proxy(result.groups, handler); + } + return result; + } +} + +let re = new ProxiedGroupRegExp("(?<x>.)"); +assertEquals("a z", "a".replace(re, "$<x> $<y>")); +assertEquals(["x", "y"], access_log); |