Debian Codegraph @

js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/index/this-subclass-constructor.js

raw
1 // |reftest| skip -- legacy-regexp is not supported
2 // Copyright (C) 2020 ExE Boss. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: pending
6 description: RegExp.$1-$9 throw a TypeError for subclass receiver
7 info: |
8 get RegExp.$1-$9
9
10 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpParen1-9]]).
11
12 GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
13
14 1. Assert C is an object that has an internal slot named internalSlotName.
15 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
16 3. ...
17 features: [legacy-regexp,class]
18 ---*/
19
20 class MyRegExp extends RegExp {}
21
22 for (let i = 1; i <= 9; i++) {
23 const property = "$" + i;
24 assert.throws(
25 TypeError,
26 function () {
27 MyRegExp[property];
28 },
29 "RegExp." + property + " getter throws for subclass receiver"
30 );
31 }
32
33 reportCompare(0, 0);