Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Proxy/construct/trap-is-undefined-no-property.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: 9.5.14
5 esid: sec-proxy-object-internal-methods-and-internal-slots-construct-argumentslist-newtarget
6 description: >
7 If the construct trap is not set, propagate the construct to the target object.
8 info: |
9 [[Construct]] (argumentsList, newTarget)
10
11 7. If trap is undefined, then
12 b. Return Construct(target, argumentsList, newTarget).
13 features: [Reflect.construct]
14 ---*/
15
16 var calls = 0;
17
18 function NewTarget() {}
19
20 function Target(a, b) {
21 assert.sameValue(new.target, NewTarget);
22 calls += 1;
23 return {
24 sum: a + b
25 };
26 }
27
28 var P = new Proxy(Target, {});
29 var obj = Reflect.construct(P, [1, 2], NewTarget);
30 assert.sameValue(obj.sum, 3, "`construct` trap is missing");
31 assert.sameValue(calls, 1, "target is called once");