| 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.1.1.1 |
| 5 |
description: > |
| 6 |
Returns the new Map object with the new empty list if the iterable argument is |
| 7 |
undefined. |
| 8 |
info: | |
| 9 |
Map ( [ iterable ] ) |
| 10 |
|
| 11 |
... |
| 12 |
2. Let map be OrdinaryCreateFromConstructor(NewTarget, "%MapPrototype%", |
| 13 |
«[[MapData]]» ). |
| 14 |
... |
| 15 |
4. Map map’s [[MapData]] internal slot to a new empty List. |
| 16 |
5. If iterable is not present, let iterable be undefined. |
| 17 |
6. If iterable is either undefined or null, let iter be undefined. |
| 18 |
... |
| 19 |
8. If iter is undefined, return map. |
| 20 |
---*/ |
| 21 |
|
| 22 |
var m1 = new Map(); |
| 23 |
var m2 = new Map(undefined); |
| 24 |
var m3 = new Map(null); |
| 25 |
|
| 26 |
assert.sameValue(m1.size, 0, 'The value of `new Map().size` is `0`'); |
| 27 |
assert.sameValue(m2.size, 0, 'The value of `new Map(undefined).size` is `0`'); |
| 28 |
assert.sameValue(m3.size, 0, 'The value of `new Map(null).size` is `0`'); |
| 29 |
|
| 30 |
assert(m1 instanceof Map); |
| 31 |
assert(m2 instanceof Map); |
| 32 |
assert(m3 instanceof Map); |