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

Unified Diff: src/runtime.js

Issue 7035007: Implement get trap for proxies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Implementing get trap for proxies. 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
« src/objects.cc ('K') | « src/runtime.cc ('k') | src/v8globals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index 4f53efe0b064c1c6e508ae6c455566276f8fd794..66e1661b759cc6ed66888d0f69d5cee4f9e3b6f6 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -644,6 +644,23 @@ function DefaultString(x) {
// NOTE: Setting the prototype for Array must take place as early as
// possible due to code generation for array literals. When
// generating code for a array literal a boilerplate array is created
-// that is cloned when running the code. It is essiential that the
+// that is cloned when running the code. It is essential that the
// boilerplate gets the right prototype.
%FunctionSetPrototype($Array, new $Array(0));
+
+
+/* ------------------------------------------
+- - - H a r m o n y P r o x i e s - - -
+---------------------------------------------
+*/
+
+function DERIVED_GET_TRAP(receiver, name) {
+ var desc = this.getPropertyDescriptor(name);
+ if (IS_UNDEFINED(desc)) { return desc; }
+ if ('value' in desc) {
+ return desc.value;
+ } else {
+ if (IS_UNDEFINED(desc.get)) { return desc.get; }
+ return desc.get().call(receiver); // The proposal says so...
+ }
+}
« src/objects.cc ('K') | « src/runtime.cc ('k') | src/v8globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698