OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "use strict"; | 5 "use strict"; |
6 | 6 |
7 // This file relies on the fact that the following declaration has been made | 7 // This file relies on the fact that the following declaration has been made |
8 // in runtime.js: | 8 // in runtime.js: |
9 // var $Array = global.Array; | 9 // var $Array = global.Array; |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 return %SetHas(this, key); | 41 return %SetHas(this, key); |
42 } | 42 } |
43 | 43 |
44 | 44 |
45 function SetDeleteJS(key) { | 45 function SetDeleteJS(key) { |
46 if (!IS_SET(this)) { | 46 if (!IS_SET(this)) { |
47 throw MakeTypeError('incompatible_method_receiver', | 47 throw MakeTypeError('incompatible_method_receiver', |
48 ['Set.prototype.delete', this]); | 48 ['Set.prototype.delete', this]); |
49 } | 49 } |
50 if (%SetHas(this, key)) { | 50 return %SetDelete(this, key); |
51 %SetDelete(this, key); | |
52 return true; | |
53 } else { | |
54 return false; | |
55 } | |
56 } | 51 } |
57 | 52 |
58 | 53 |
59 function SetGetSizeJS() { | 54 function SetGetSizeJS() { |
60 if (!IS_SET(this)) { | 55 if (!IS_SET(this)) { |
61 throw MakeTypeError('incompatible_method_receiver', | 56 throw MakeTypeError('incompatible_method_receiver', |
62 ['Set.prototype.size', this]); | 57 ['Set.prototype.size', this]); |
63 } | 58 } |
64 return %SetGetSize(this); | 59 return %SetGetSize(this); |
65 } | 60 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 "get", MapGetJS, | 213 "get", MapGetJS, |
219 "set", MapSetJS, | 214 "set", MapSetJS, |
220 "has", MapHasJS, | 215 "has", MapHasJS, |
221 "delete", MapDeleteJS, | 216 "delete", MapDeleteJS, |
222 "clear", MapClearJS, | 217 "clear", MapClearJS, |
223 "forEach", MapForEach | 218 "forEach", MapForEach |
224 )); | 219 )); |
225 } | 220 } |
226 | 221 |
227 SetUpMap(); | 222 SetUpMap(); |
OLD | NEW |