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

Side by Side Diff: src/js/runtime.js

Issue 1852703002: Fix treatment of rest pattern in array destructuring. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 8 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
« no previous file with comments | « src/contexts.h ('k') | src/parsing/pattern-rewriter.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 // This files contains runtime support implemented in JavaScript. 5 // This files contains runtime support implemented in JavaScript.
6 6
7 // CAUTION: Some of the functions specified in this file are called 7 // CAUTION: Some of the functions specified in this file are called
8 // directly from compiled code. These are the functions with names in 8 // directly from compiled code. These are the functions with names in
9 // ALL CAPS. The compiled code passes the first argument in 'this'. 9 // ALL CAPS. The compiled code passes the first argument in 'this'.
10 10
(...skipping 24 matching lines...) Expand all
35 }); 35 });
36 36
37 // ---------------------------------------------------------------------------- 37 // ----------------------------------------------------------------------------
38 38
39 39
40 /* --------------------------------- 40 /* ---------------------------------
41 - - - U t i l i t i e s - - - 41 - - - U t i l i t i e s - - -
42 --------------------------------- 42 ---------------------------------
43 */ 43 */
44 44
45 function ConcatIterableToArray(target, iterable) {
46 var index = target.length;
47 for (var element of iterable) {
48 AddIndexedProperty(target, index++, element);
49 }
50 return target;
51 }
52
53 45
54 // This function should be called rather than %AddElement in contexts where the 46 // This function should be called rather than %AddElement in contexts where the
55 // argument might not be less than 2**32-1. ES2015 ToLength semantics mean that 47 // argument might not be less than 2**32-1. ES2015 ToLength semantics mean that
56 // this is a concern at basically all callsites. 48 // this is a concern at basically all callsites.
57 function AddIndexedProperty(obj, index, value) { 49 function AddIndexedProperty(obj, index, value) {
58 if (index === TO_UINT32(index) && index !== kMaxUint32) { 50 if (index === TO_UINT32(index) && index !== kMaxUint32) {
59 %AddElement(obj, index, value); 51 %AddElement(obj, index, value);
60 } else { 52 } else {
61 %AddNamedProperty(obj, TO_STRING(index), value, NONE); 53 %AddNamedProperty(obj, TO_STRING(index), value, NONE);
62 } 54 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // Exports 122 // Exports
131 123
132 utils.Export(function(to) { 124 utils.Export(function(to) {
133 to.AddIndexedProperty = AddIndexedProperty; 125 to.AddIndexedProperty = AddIndexedProperty;
134 to.MaxSimple = MaxSimple; 126 to.MaxSimple = MaxSimple;
135 to.MinSimple = MinSimple; 127 to.MinSimple = MinSimple;
136 to.ToPositiveInteger = ToPositiveInteger; 128 to.ToPositiveInteger = ToPositiveInteger;
137 to.SpeciesConstructor = SpeciesConstructor; 129 to.SpeciesConstructor = SpeciesConstructor;
138 }); 130 });
139 131
140 %InstallToContext([
141 "concat_iterable_to_array", ConcatIterableToArray,
142 ]);
143
144 }) 132 })
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/parsing/pattern-rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698