| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 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 // Flags: --harmony-classes --harmony-new-target |
| 6 |
| 7 'use strict'; |
| 8 |
| 9 (function TestBasics() { |
| 10 var calls = 0; |
| 11 class Base {} |
| 12 class Derived extends Base { |
| 13 constructor(expected) { |
| 14 super(); |
| 15 assertEquals(expected, new.target); |
| 16 calls++; |
| 17 } |
| 18 } |
| 19 new Derived(Derived); |
| 20 assertEquals(1, calls); |
| 21 |
| 22 class Derived2 extends Derived {} |
| 23 calls = 0; |
| 24 new Derived2(Derived2); |
| 25 assertEquals(1, calls); |
| 26 })(); |
| OLD | NEW |