Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/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 es6id: 9.5.14
5 description: >
6 Return the result from the trap method.
7 info: |
8 [[Construct]] ( argumentsList, newTarget)
9
10 12. Return newObj
11 ---*/
12
13 function Target(a, b) {
14 this.sum = a + b;
15 };
16 var handler = {
17 construct: function(t, c, args) {
18 return {
19 sum: 42
20 };
21 }
22 };
23 var P = new Proxy(Target, handler);
24
25 assert.sameValue((new P(1, 2)).sum, 42);