regress-4097.js 971 Bytes
Newer Older
1 2 3 4 5
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

(function StoreToSuper () {
dslomov's avatar
dslomov committed
6 7 8 9 10 11
  "use strict";
  class A {
    s() {
      super.bla = 10;
    }
  };
12

dslomov's avatar
dslomov committed
13 14 15 16 17 18 19
  let a = new A();
  (new A).s.call(a);
  assertEquals(10, a.bla);
  assertThrows(function() { (new A).s.call(undefined); }, TypeError);
  assertThrows(function() { (new A).s.call(42); }, TypeError);
  assertThrows(function() { (new A).s.call(null); }, TypeError);
  assertThrows(function() { (new A).s.call("abc"); }, TypeError);
20 21 22 23
})();


(function LoadFromSuper () {
dslomov's avatar
dslomov committed
24 25 26 27 28 29
  "use strict";
  class A {
    s() {
      return super.bla;
    }
  };
30

dslomov's avatar
dslomov committed
31 32 33 34 35 36
  let a = new A();
  assertSame(undefined, (new A).s.call(a));
  assertSame(undefined, (new A).s.call(undefined));
  assertSame(undefined, (new A).s.call(42));
  assertSame(undefined, (new A).s.call(null));
  assertSame(undefined, (new A).s.call("abc"));
37
})();