Debian Codegraph @

js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/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.rightContext throws a TypeError for subclass receiver
7 info: |
8 get RegExp.rightContext
9
10 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpRightContext]]).
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 assert.throws(
23 TypeError,
24 function () {
25 MyRegExp.rightContext;
26 },
27 "RegExp.rightContext getter throws for subclass receiver"
28 );
29
30 assert.throws(
31 TypeError,
32 function () {
33 MyRegExp["$'"];
34 },
35 "RegExp.$' getter throws for subclass receiver"
36 );
37
38 reportCompare(0, 0);