Debian Codegraph @

js/src/tests/test262/built-ins/Iterator/newtarget-or-active-function-object.js

raw
1 // |reftest| shell-option(--enable-iterator-helpers) skip-if(!this.hasOwnProperty('Iterator')||!xulRuntime.shell) -- iterator-helpers is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2020 Rick Waldron. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-iterator
7 description: >
8 Iterator is not callable or constructable
9 info: |
10 When the Iterator function is called, the following steps are taken:
11
12 If NewTarget is undefined or the active function object, throw a TypeError exception.
13
14 features: [iterator-helpers]
15 ---*/
16
17 assert.throws(TypeError, () => {
18 Iterator();
19 });
20
21 assert.throws(TypeError, () => {
22 new Iterator();
23 });
24
25 reportCompare(0, 0);