Debian Codegraph @

js/src/tests/test262/language/expressions/assignment/target-super-computed-reference-null.js

raw
1 // Copyright (C) 2021 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-assignment-operators
6 description: Assignment Operator evaluates the value prior validating a SuperProperty's reference (null)
7 info: |
8 # 13.15.2 Runtime Semantics: Evaluation
9 AssignmentExpression : LeftHandSideExpression = AssignmentExpression
10
11 1. If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral,
12 then
13 a. Let lref be the result of evaluating LeftHandSideExpression.
14 [...]
15 e. Perform ? PutValue(lref, rval).
16
17 # 6.2.4.5 PutValue ( V, W )
18
19 [...]
20 5. If IsPropertyReference(V) is true, then
21 a. Let baseObj be ? ToObject(V.[[Base]]).
22 ---*/
23
24 var count = 0;
25 class C {
26 static m() {
27 super[0] = count += 1;
28 }
29 }
30
31 Object.setPrototypeOf(C, null);
32
33 assert.throws(TypeError, function() {
34 C.m();
35 });
36
37 assert.sameValue(count, 1);
38
39 reportCompare(0, 0);