Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Reflect/construct/arguments-list-is-not-array-like.js

raw
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: 26.1.2
5 description: >
6 Return abrupt if argumentsList is not an ArrayLike object.
7 info: |
8 26.1.2 Reflect.construct ( target, argumentsList [, newTarget] )
9
10 ...
11 4. Let args be CreateListFromArrayLike(argumentsList).
12 5. ReturnIfAbrupt(args).
13 ...
14
15 7.3.17 CreateListFromArrayLike (obj [, elementTypes] )
16
17 ...
18 3. If Type(obj) is not Object, throw a TypeError exception.
19 4. Let len be ToLength(Get(obj, "length")).
20 5. ReturnIfAbrupt(len).
21 ...
22 ---*/
23
24 function fn() {}
25 var o = {};
26
27 Object.defineProperty(o, 'length', {
28 get: function() {
29 throw new Test262Error();
30 }
31 });
32
33 assert.throws(Test262Error, function() {
34 Reflect.construct(fn, o);
35 });
36
37 assert.throws(TypeError, function() {
38 Reflect.construct(fn, 1);
39 });