Debian Codegraph @

js/src/tests/test262/language/expressions/delete/super-property-uninitialized-this.js

raw
1 // Copyright (C) 2024 André Bargull. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-delete-operator-runtime-semantics-evaluation
6 description: >
7 Element expression in delete super not evaluated when this is uninitialized.
8 info: |
9 13.5.1.2 Runtime Semantics: Evaluation
10
11 UnaryExpression : delete UnaryExpression
12
13 1. Let ref be ? Evaluation of UnaryExpression.
14 ...
15
16 13.3.7.1 Runtime Semantics: Evaluation
17
18 SuperProperty : super [ Expression ]
19
20 ...
21 2. Let actualThis be ? env.GetThisBinding().
22 3. Let propertyNameReference be ? Evaluation of Expression.
23 ...
24
25 9.1.1.3.4 GetThisBinding ( )
26 ...
27 2. If envRec.[[ThisBindingStatus]] is uninitialized, throw a ReferenceError exception.
28 ...
29 ---*/
30
31 class Base {
32 constructor() {
33 throw new Test262Error("base constructor called");
34 }
35 }
36
37 class Derived extends Base {
38 constructor() {
39 delete super[(super(), 0)];
40 }
41 }
42
43 assert.throws(ReferenceError, () => new Derived);
44
45 reportCompare(0, 0);