| 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: 23.4.1.1 |
| 5 |
esid: sec-weakset-iterable |
| 6 |
description: > |
| 7 |
Throws TypeError if add is not callable on constructor call. |
| 8 |
info: | |
| 9 |
23.4.1.1 WeakSet ( [ iterable ] ) |
| 10 |
|
| 11 |
... |
| 12 |
5. If iterable is not present, let iterable be undefined. |
| 13 |
6. If iterable is either undefined or null, let iter be undefined. |
| 14 |
7. Else, |
| 15 |
a. Let adder be Get(set, "add"). |
| 16 |
b. ReturnIfAbrupt(adder). |
| 17 |
c. If IsCallable(adder) is false, throw a TypeError exception. |
| 18 |
... |
| 19 |
---*/ |
| 20 |
|
| 21 |
WeakSet.prototype.add = null; |
| 22 |
new WeakSet(); |
| 23 |
|
| 24 |
assert.throws(TypeError, function() { |
| 25 |
new WeakSet([]); |
| 26 |
}); |