10883f561a
doc: https://docs.google.com/document/d/1Y9uF3hS2aUrwKU56vGxlvEs_IiGgmWSzau8097Y-XBM/edit Bug: v8:7427 Change-Id: Iedd36c146cefff7e6687fdad48d263889c5c8347 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1778902 Commit-Queue: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Cr-Commit-Position: refs/heads/master@{#63913}
156 lines
2.4 KiB
JavaScript
156 lines
2.4 KiB
JavaScript
// Copyright 2019 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.
|
|
|
|
new class extends Object {
|
|
constructor() {
|
|
super(); this.foo = 1;
|
|
}
|
|
}
|
|
|
|
{
|
|
class Throws extends Object {
|
|
t = 1;
|
|
constructor(t = this.t) {
|
|
super();
|
|
}
|
|
}
|
|
assertThrows(() => new Throws, ReferenceError);
|
|
}
|
|
|
|
{
|
|
class Throws extends Object {
|
|
constructor() {
|
|
this.x = true;
|
|
super();
|
|
}
|
|
}
|
|
assertThrows(() => new Throws, ReferenceError);
|
|
}
|
|
|
|
{
|
|
class Throws extends Object {
|
|
constructor() {
|
|
super(this);
|
|
}
|
|
}
|
|
assertThrows(() => new Throws, ReferenceError);
|
|
}
|
|
|
|
{
|
|
class Throws extends Object {
|
|
constructor() {
|
|
super(eval("this"));
|
|
}
|
|
}
|
|
assertThrows(() => new Throws, ReferenceError);
|
|
}
|
|
|
|
{
|
|
class Throws extends Object {
|
|
constructor() {
|
|
super(eval("(() => this)()"));
|
|
}
|
|
}
|
|
assertThrows(() => new Throws, ReferenceError);
|
|
}
|
|
|
|
{
|
|
class Throws extends Object {
|
|
constructor(t = eval("this")) {
|
|
super();
|
|
}
|
|
}
|
|
assertThrows(() => new Throws, ReferenceError);
|
|
}
|
|
|
|
{
|
|
class Throws extends Object {
|
|
constructor() {
|
|
super();
|
|
super();
|
|
}
|
|
}
|
|
assertThrows(() => new Throws, ReferenceError);
|
|
}
|
|
|
|
{
|
|
class Throws extends Object {
|
|
constructor() {
|
|
if (false) { super(); }
|
|
this.x = true;
|
|
}
|
|
}
|
|
assertThrows(() => new Throws, ReferenceError);
|
|
}
|
|
|
|
{
|
|
class Throws extends Object {
|
|
constructor() {
|
|
super((4 * this.t));
|
|
}
|
|
}
|
|
assertThrows(() => new Throws, ReferenceError);
|
|
}
|
|
|
|
{
|
|
class Throws extends Object {
|
|
constructor() {
|
|
super((() => this)());
|
|
}
|
|
}
|
|
assertThrows(() => new Throws(), ReferenceError);
|
|
}
|
|
|
|
{
|
|
class Throws extends Object {
|
|
constructor() {
|
|
super((()=>{ var x = ()=> this; return x(); })())
|
|
}
|
|
}
|
|
assertThrows(() => new Throws(), ReferenceError);
|
|
}
|
|
|
|
{
|
|
class C extends null {
|
|
constructor() {
|
|
super();
|
|
}
|
|
}
|
|
assertThrows(() => new C(), TypeError);
|
|
}
|
|
|
|
{
|
|
class C extends Object {
|
|
constructor() {
|
|
super();
|
|
(() => {
|
|
this;
|
|
})();
|
|
}
|
|
}
|
|
new C();
|
|
}
|
|
|
|
{
|
|
var count = 0;
|
|
|
|
class A {
|
|
constructor() {
|
|
count++;
|
|
}
|
|
increment() {
|
|
count++;
|
|
}
|
|
}
|
|
|
|
class B extends A {
|
|
constructor() {
|
|
super();
|
|
(_ => super.increment())();
|
|
}
|
|
}
|
|
new B();
|
|
assertEquals(count, 2);
|
|
}
|