blob: bc83a11802c9f4706fe5be906f1abd5c73e5c220 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5"use strict";
6var realm = Realm.create();
7var OtherTypeError = Realm.eval(realm, 'TypeError');
8
9class Derived extends Object {
10 constructor() {
11 return null;
12 }
13}
14
15assertThrows(() => { new Derived() }, TypeError);
16
17var OtherDerived = Realm.eval(realm,
18 "'use strict';" +
19 "class Derived extends Object {" +
20 "constructor() {" +
21 "return null;" +
22 "}};");
23
24// Before throwing the TypeError we have to switch to the caller context.
25assertThrows(() => { new OtherDerived() }, TypeError);