tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

target-super-identifier-reference-null.js (960B)


      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.x = 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);