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

Unified Diff: src/proxy.js

Issue 6932068: A first skeleton for introducing Harmony proxies (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Addressed Kevin's comments. Created 9 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: src/proxy.js
diff --git a/src/proxy.js b/src/proxy.js
index 25169831a8bdbcb55b479d341989b91fb9e64ab8..01d48b485ac193a19c6cc681b4e88a1533f56945 100644
--- a/src/proxy.js
+++ b/src/proxy.js
@@ -26,3 +26,40 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
global.Proxy = new $Object();
+
+var $Proxy = global.Proxy
+
+var fundamentalTraps = [
+ "getOwnPropertyDescriptor",
+ "getPropertyDescriptor",
+ "getOwnPropertyNames",
+ "getPropertyNames",
+ "defineProperty",
+ "delete",
+ "fix",
+]
+
+var derivedTraps = [
+ "has",
+ "hasOwn",
+ "get",
+ "set",
+ "enumerate",
+ "keys",
+]
+
+var functionTraps = [
+ "callTrap",
+ "constructTrap",
+]
+
+$Proxy.createFunction = function(handler, callTrap, constructTrap) {
+ handler.callTrap = callTrap
+ handler.constructTrap = constructTrap
+ $Proxy.create(handler)
+}
+
+$Proxy.create = function(handler, proto) {
+ if (!IS_SPEC_OBJECT(proto)) proto = $Object.prototype
+ return %CreateJSProxy(handler, proto)
+}
« src/objects-visiting.cc ('K') | « src/objects-visiting.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698