Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: test/mjsunit/es6/classes-proxy.js

Issue 1481613003: [Proxies] Support constructable proxy as new.target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax --harmony-proxies --harmony-reflect
6
7 function CreateConstructableProxy(handler) {
8 return Proxy.createFunction(handler, function() {}, function() {});
9 }
10
11 (function() {
12 var prototype = { x: 1 };
13 var log = [];
14
15 var proxy = CreateConstructableProxy({
16 get(k) {
17 log.push("get trap");
18 return prototype;
19 }});
20
21 var o = Reflect.construct(Number, [100], proxy);
22 assertEquals(["get trap"], log);
23 assertTrue(Object.getPrototypeOf(o) === prototype);
24 assertEquals(100, Number.prototype.valueOf.call(o));
25 })();
26
27 (function() {
28 var prototype = { x: 1 };
29 var log = [];
30
31 var proxy = CreateConstructableProxy({
32 get(k) {
33 log.push("get trap");
34 return 10;
35 }});
36
37 var o = Reflect.construct(Number, [100], proxy);
38 assertEquals(["get trap"], log);
39 assertTrue(Object.getPrototypeOf(o) === Object.prototype);
40 assertEquals(100, Number.prototype.valueOf.call(o));
41 })();
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698