OLD | NEW |
---|---|
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 return enumerableNames | 185 return enumerableNames |
186 } | 186 } |
187 | 187 |
188 function DerivedEnumerateTrap() { | 188 function DerivedEnumerateTrap() { |
189 var names = this.getPropertyNames() | 189 var names = this.getPropertyNames() |
190 var enumerableNames = [] | 190 var enumerableNames = [] |
191 for (var i = 0, count = 0; i < names.length; ++i) { | 191 for (var i = 0, count = 0; i < names.length; ++i) { |
192 var name = names[i] | 192 var name = names[i] |
193 if (IS_SYMBOL(name)) continue | 193 if (IS_SYMBOL(name)) continue |
194 var desc = this.getPropertyDescriptor(TO_STRING_INLINE(name)) | 194 var desc = this.getPropertyDescriptor(TO_STRING_INLINE(name)) |
195 if (!IS_UNDEFINED(desc) && desc.enumerable) { | 195 if (!IS_UNDEFINED(desc)) { |
196 enumerableNames[count++] = names[i] | 196 if (!desc.configurable) { |
197 throw MakeTypeError("proxy_prop_not_configurable", | |
198 [this, "getPropertyDescriptor", name]) | |
199 } | |
200 if (desc.enumerable) enumerableNames[count++] = names[i] | |
Yang
2013/07/19 12:05:43
We use semicolons pretty sparingly in this file. I
rossberg
2013/07/19 14:05:02
Aesthetics? :)
| |
197 } | 201 } |
198 } | 202 } |
199 return enumerableNames | 203 return enumerableNames |
200 } | 204 } |
201 | 205 |
202 function ProxyEnumerate(proxy) { | 206 function ProxyEnumerate(proxy) { |
203 var handler = %GetHandler(proxy) | 207 var handler = %GetHandler(proxy) |
204 if (IS_UNDEFINED(handler.enumerate)) { | 208 if (IS_UNDEFINED(handler.enumerate)) { |
205 return %Apply(DerivedEnumerateTrap, handler, [], 0, 0) | 209 return %Apply(DerivedEnumerateTrap, handler, [], 0, 0) |
206 } else { | 210 } else { |
207 return ToNameArray(handler.enumerate(), "enumerate", false) | 211 return ToNameArray(handler.enumerate(), "enumerate", false) |
208 } | 212 } |
209 } | 213 } |
OLD | NEW |