| 1 |
// Copyright (C) 2015 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
/*--- |
| 4 |
es6id: 26.1.2 |
| 5 |
description: > |
| 6 |
Throws a TypeError if `newTarget` is not a constructor. |
| 7 |
info: | |
| 8 |
26.1.2 Reflect.construct ( target, argumentsList [, newTarget] ) |
| 9 |
|
| 10 |
... |
| 11 |
2. If newTarget is not present, let newTarget be target. |
| 12 |
3. Else, if IsConstructor(newTarget) is false, throw a TypeError exception. |
| 13 |
... |
| 14 |
---*/ |
| 15 |
|
| 16 |
assert.throws(TypeError, function() { |
| 17 |
Reflect.construct(function() {}, [], 1); |
| 18 |
}); |
| 19 |
|
| 20 |
assert.throws(TypeError, function() { |
| 21 |
Reflect.construct(function() {}, [], null); |
| 22 |
}); |
| 23 |
|
| 24 |
assert.throws(TypeError, function() { |
| 25 |
Reflect.construct(function() {}, [], {}); |
| 26 |
}); |
| 27 |
|
| 28 |
assert.throws(TypeError, function() { |
| 29 |
Reflect.construct(function() {}, [], Date.now); |
| 30 |
}); |