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

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

Issue 1509603005: [runtime] [proxy] implement [[Construct]] (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2015-12-03_JSProxy_Call_1499593003
Patch Set: fimpsing 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/x87/builtins-x87.cc ('k') | test/mjsunit/harmony/proxies-construct.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --allow-natives-syntax --harmony-proxies --harmony-reflect 5 // Flags: --allow-natives-syntax --harmony-proxies --harmony-reflect
6 6
7 function CreateConstructableProxy(handler) { 7 function CreateConstructableProxy(handler) {
8 return Proxy.createFunction(handler, function() {}, function() {}); 8 return new Proxy(function(){}, handler);
9 } 9 }
10 10
11 (function() { 11 (function() {
12 var prototype = { x: 1 }; 12 var prototype = { x: 1 };
13 var log = []; 13 var log = [];
14 14
15 var proxy = CreateConstructableProxy({ 15 var proxy = CreateConstructableProxy({
16 get(k) { 16 get(k) {
17 log.push("get trap"); 17 log.push("get trap");
18 return prototype; 18 return prototype;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 get(k) { 64 get(k) {
65 log.push("get trap"); 65 log.push("get trap");
66 return prototype; 66 return prototype;
67 }}); 67 }});
68 68
69 var o = Reflect.construct(Array, [1, 2, 3], proxy); 69 var o = Reflect.construct(Array, [1, 2, 3], proxy);
70 assertEquals(["get trap"], log); 70 assertEquals(["get trap"], log);
71 assertTrue(Object.getPrototypeOf(o) === prototype); 71 assertTrue(Object.getPrototypeOf(o) === prototype);
72 assertEquals([1, 2, 3], o); 72 assertEquals([1, 2, 3], o);
73 })(); 73 })();
OLDNEW
« no previous file with comments | « src/x87/builtins-x87.cc ('k') | test/mjsunit/harmony/proxies-construct.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698