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

Side by Side Diff: src/collection.js

Issue 448013005: ES6: Implement WeakMap and WeakSet constructor logic (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/v8natives.js » ('j') | test/mjsunit/es6/collections.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 var $Set = global.Set; 11 var $Set = global.Set;
12 var $Map = global.Map; 12 var $Map = global.Map;
13 13
14 14
15 // TODO(arv): Move these general functions to v8natives.js when Map and Set are
16 // no longer experimental.
17
18
19 // 7.4.1 CheckIterable ( obj )
20 function ToIterable(obj) {
21 if (!IS_SPEC_OBJECT(obj)) {
22 return UNDEFINED;
23 }
24 return obj[symbolIterator];
25 }
26
27
28 // 7.4.2 GetIterator ( obj, method )
29 function GetIterator(obj, method) {
30 if (IS_UNDEFINED(method)) {
31 method = ToIterable(obj);
32 }
33 if (!IS_SPEC_FUNCTION(method)) {
34 throw MakeTypeError('not_iterable', [obj]);
35 }
36 var iterator = %_CallFunction(obj, method);
37 if (!IS_SPEC_OBJECT(iterator)) {
38 throw MakeTypeError('not_an_iterator', [iterator]);
39 }
40 return iterator;
41 }
42
43
44 // ------------------------------------------------------------------- 15 // -------------------------------------------------------------------
45 // Harmony Set 16 // Harmony Set
46 17
47 function SetConstructor(iterable) { 18 function SetConstructor(iterable) {
48 if (!%_IsConstructCall()) { 19 if (!%_IsConstructCall()) {
49 throw MakeTypeError('constructor_not_function', ['Set']); 20 throw MakeTypeError('constructor_not_function', ['Set']);
50 } 21 }
51 22
52 var iter, adder; 23 var iter, adder;
53 24
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 "get", MapGetJS, 263 "get", MapGetJS,
293 "set", MapSetJS, 264 "set", MapSetJS,
294 "has", MapHasJS, 265 "has", MapHasJS,
295 "delete", MapDeleteJS, 266 "delete", MapDeleteJS,
296 "clear", MapClearJS, 267 "clear", MapClearJS,
297 "forEach", MapForEach 268 "forEach", MapForEach
298 )); 269 ));
299 } 270 }
300 271
301 SetUpMap(); 272 SetUpMap();
OLDNEW
« no previous file with comments | « no previous file | src/v8natives.js » ('j') | test/mjsunit/es6/collections.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698