tor-browser

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

member-expr-after-super.js (1163B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 class Base {
      6    get test() {
      7        return "ok";
      8    }
      9 }
     10 
     11 class SuperThenProperty extends Base {
     12    constructor() {
     13        var result = super().test;
     14        return {result};
     15    }
     16 }
     17 assertEq(new SuperThenProperty().result, "ok");
     18 
     19 class SuperThenMember extends Base {
     20    constructor() {
     21        var result = super()["tes" + String.fromCodePoint("t".codePointAt(0))];
     22        return {result};
     23    }
     24 }
     25 assertEq(new SuperThenMember().result, "ok");
     26 
     27 class SuperThenCall extends Function {
     28    constructor() {
     29        var result = super("o, k", "return o + k;")("o", "k");
     30        return {result};
     31    }
     32 }
     33 assertEq(new SuperThenCall().result, "ok");
     34 
     35 class SuperThenTemplateCall extends Function {
     36    constructor() {
     37        var result = super("cooked", "return cooked[0][0] + cooked.raw[0][1];")`ok`;
     38        return {result};
     39    }
     40 }
     41 assertEq(new SuperThenTemplateCall().result, "ok");
     42 
     43 if (typeof reportCompare === "function")
     44    reportCompare(0, 0);