tor-browser

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

prop-dot-cls-val-from-eval.js (1510B)


      1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-super-keyword
      5 es6id: 12.3.5
      6 description: >
      7  Value of reference returned by SuperProperty (from eval code)
      8 info: |
      9  1. Let propertyKey be StringValue of IdentifierName.
     10  2. If the code matched by the syntactic production that is being evaluated is
     11     strict mode code, let strict be true, else let strict be false.
     12  3. Return ? MakeSuperPropertyReference(propertyKey, strict).
     13 
     14  12.3.5.3 Runtime Semantics: MakeSuperPropertyReference
     15 
     16  1. Let env be GetThisEnvironment( ).
     17  2. If env.HasSuperBinding() is false, throw a ReferenceError exception.
     18  3. Let actualThis be ? env.GetThisBinding().
     19  4. Let baseValue be ? env.GetSuperBase().
     20  5. Let bv be ? RequireObjectCoercible(baseValue).
     21  6. Return a value of type Reference that is a Super Reference whose base
     22     value component is bv, whose referenced name component is propertyKey,
     23     whose thisValue component is actualThis, and whose strict reference flag
     24     is strict.
     25 features: [class]
     26 ---*/
     27 
     28 var fromA, fromB;
     29 class A {}
     30 class B extends A {}
     31 class C extends B {
     32  method() {
     33    fromA = eval('super.fromA;');
     34    fromB = eval('super.fromB;');
     35  }
     36 }
     37 
     38 A.prototype.fromA = 'a';
     39 A.prototype.fromB = 'a';
     40 B.prototype.fromB = 'b';
     41 C.prototype.fromA = 'c';
     42 C.prototype.fromB = 'c';
     43 
     44 C.prototype.method();
     45 
     46 assert.sameValue(fromA, 'a');
     47 assert.sameValue(fromB, 'b');
     48 
     49 reportCompare(0, 0);