| 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.2.1.1 |
| 5 |
description: > |
| 6 |
Set ( [ iterable ] ) |
| 7 |
|
| 8 |
When the Set function is called with optional argument iterable the following steps are taken: |
| 9 |
|
| 10 |
... |
| 11 |
7. Else, |
| 12 |
a. Let adder be Get(set, "add"). |
| 13 |
b. ReturnIfAbrupt(adder). |
| 14 |
c. If IsCallable(adder) is false, throw a TypeError exception. |
| 15 |
d. Let iter be GetIterator(iterable). |
| 16 |
e. ReturnIfAbrupt(iter). |
| 17 |
... |
| 18 |
9. Repeat |
| 19 |
a. Let next be IteratorStep(iter). |
| 20 |
b. ReturnIfAbrupt(next). |
| 21 |
c. If next is false, return set. |
| 22 |
d. Let nextValue be IteratorValue(next). |
| 23 |
e. ReturnIfAbrupt(nextValue). |
| 24 |
f. Let status be Call(adder, set, «nextValue.[[value]]»). |
| 25 |
g. If status is an abrupt completion, return IteratorClose(iter, status). |
| 26 |
|
| 27 |
---*/ |
| 28 |
|
| 29 |
Set.prototype.add = null; |
| 30 |
|
| 31 |
var s = new Set(); |
| 32 |
|
| 33 |
assert.sameValue(s.size, 0, "The value of `s.size` is `0`"); |