| 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 |
Throws a TypeError if `set` is not callable on Map constructor with a |
| 7 |
iterable argument. |
| 8 |
info: | |
| 9 |
Map ( [ iterable ] ) |
| 10 |
|
| 11 |
When the Map function is called with optional argument the following steps are |
| 12 |
taken: |
| 13 |
|
| 14 |
... |
| 15 |
5. If iterable is not present, let iterable be undefined. |
| 16 |
6. If iterable is either undefined or null, let iter be undefined. |
| 17 |
7. Else, |
| 18 |
a. Let adder be Get(map, "set"). |
| 19 |
b. ReturnIfAbrupt(adder). |
| 20 |
c. If IsCallable(adder) is false, throw a TypeError exception. |
| 21 |
---*/ |
| 22 |
|
| 23 |
Map.prototype.set = null; |
| 24 |
|
| 25 |
assert.throws(TypeError, function() { |
| 26 |
new Map([ |
| 27 |
[1, 1], |
| 28 |
[2, 2] |
| 29 |
]); |
| 30 |
}); |