Debian Codegraph @

js/src/tests/test262/built-ins/Proxy/create-target-is-not-a-constructor.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 esid: sec-proxycreate
5 description: >
6 A Proxy exotic object only accepts a constructor call if target is
7 constructor.
8 info: |
9 ProxyCreate ( target, handler )
10
11 If IsCallable(target) is true, then
12 Set P.[[Call]] as specified in 9.5.12.
13 If IsConstructor(target) is true, then
14 Set P.[[Construct]] as specified in 9.5.13.
15 ...
16
17 Runtime Semantics: EvaluateNew(constructProduction, arguments)
18
19 8. If IsConstructor (constructor) is false, throw a TypeError exception.
20 includes: [isConstructor.js]
21 features: [Proxy, Reflect.construct, arrow-function]
22 ---*/
23
24 var proxy = new Proxy(eval, {});
25
26 proxy(); // the Proxy object is callable
27
28 assert.sameValue(isConstructor(proxy), false, 'isConstructor(proxy) must return false');
29 assert.throws(TypeError, () => {
30 new proxy();
31 });
32
33 reportCompare(0, 0);