Debian Codegraph @

js/src/tests/test262/annexB/built-ins/Array/from/iterator-method-emulates-undefined.js

raw
1 // Copyright (C) 2020 Alexey Shvayka. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-array.from
5 description: >
6 [[IsHTMLDDA]] object as @@iterator method gets called.
7 info: |
8 Array.from ( items [ , mapfn [ , thisArg ] ] )
9
10 [...]
11 4. Let usingIterator be ? GetMethod(items, @@iterator).
12 5. If usingIterator is not undefined, then
13 [...]
14 c. Let iteratorRecord be ? GetIterator(items, sync, usingIterator).
15
16 GetIterator ( obj [ , hint [ , method ] ] )
17
18 [...]
19 4. Let iterator be ? Call(method, obj).
20 5. If Type(iterator) is not Object, throw a TypeError exception.
21 features: [Symbol.iterator, IsHTMLDDA]
22 ---*/
23
24 var items = {};
25 items[Symbol.iterator] = $262.IsHTMLDDA;
26
27 assert.throws(TypeError, function() {
28 Array.from(items);
29 });
30
31 reportCompare(0, 0);