Debian Codegraph @

js/src/tests/test262/built-ins/Proxy/construct/call-result.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-proxy-object-internal-methods-and-internal-slots-construct-argumentslist-newtarget
5 description: >
6 Return the result from the trap method.
7 info: |
8 [[Construct]] ( argumentsList, newTarget)
9
10 12. Return newObj
11 features: [Proxy]
12 ---*/
13
14 var P = new Proxy(function() {
15 throw new Test262Error('target should not be called');
16 }, {
17 construct: function(t, c, args) {
18 return {
19 sum: 42
20 };
21 }
22 });
23
24 assert.sameValue((new P(1, 2)).sum, 42);
25
26 reportCompare(0, 0);