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

Side by Side Diff: src/proxy.js

Issue 8256015: Implement for-in loop for proxies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Rico's comments. Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/runtime.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 function DerivedHasOwnTrap(name) { 147 function DerivedHasOwnTrap(name) {
148 return !!this.getOwnPropertyDescriptor(name) 148 return !!this.getOwnPropertyDescriptor(name)
149 } 149 }
150 150
151 function DerivedKeysTrap() { 151 function DerivedKeysTrap() {
152 var names = this.getOwnPropertyNames() 152 var names = this.getOwnPropertyNames()
153 var enumerableNames = [] 153 var enumerableNames = []
154 for (var i = 0, count = 0; i < names.length; ++i) { 154 for (var i = 0, count = 0; i < names.length; ++i) {
155 var name = names[i] 155 var name = names[i]
156 if (this.getOwnPropertyDescriptor(TO_STRING_INLINE(name)).enumerable) { 156 var desc = this.getOwnPropertyDescriptor(TO_STRING_INLINE(name))
157 if (!IS_UNDEFINED(desc) && desc.enumerable) {
157 enumerableNames[count++] = names[i] 158 enumerableNames[count++] = names[i]
158 } 159 }
159 } 160 }
160 return enumerableNames 161 return enumerableNames
161 } 162 }
163
164 function DerivedEnumerateTrap() {
165 var names = this.getPropertyNames()
166 var enumerableNames = []
167 for (var i = 0, count = 0; i < names.length; ++i) {
168 var name = names[i]
169 var desc = this.getPropertyDescriptor(TO_STRING_INLINE(name))
170 if (!IS_UNDEFINED(desc) && desc.enumerable) {
171 enumerableNames[count++] = names[i]
172 }
173 }
174 return enumerableNames
175 }
176
177 function ProxyEnumerate(proxy) {
178 var handler = %GetHandler(proxy)
179 if (IS_UNDEFINED(handler.enumerate)) {
180 return %Apply(DerivedEnumerateTrap, handler, [], 0, 0)
181 } else {
182 return ToStringArray(handler.enumerate(), "enumerate")
183 }
184 }
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698