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

Side by Side Diff: test/mjsunit/es6/regress/regress-5337.js

Issue 2297303003: Fix bug with nested spreads as patterns (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 (function testNestedSpreadsInPatterns() {
6 (function () {
7 var [...[...x]] = [42, 17];
8 assertArrayEquals([42, 17], x);
9 })();
10 (function () {
11 let [...[...x]] = [42, 17];
12 assertArrayEquals([42, 17], x);
13 })();
14 (function () {
15 const [...[...x]] = [42, 17];
16 assertArrayEquals([42, 17], x);
17 })();
18 (function () {
19 var x; [...[...x]] = [42, 17];
20 assertArrayEquals([42, 17], x);
21 })();
22
23 function f1([...[...x]] = [42, 17]) { return x; }
24 assertArrayEquals([42, 17], f1());
25 assertArrayEquals([1, 2, 3], f1([1, 2, 3]));
26
27 var f2 = function ([...[...x]] = [42, 17]) { return x; }
28 assertArrayEquals([42, 17], f2());
29 assertArrayEquals([1, 2, 3], f2([1, 2, 3]));
30
31 // The following two were failing in debug mode, until v8:5337 was fixed.
32 var f3 = ([...[...x]] = [42, 17]) => { return x; };
33 assertArrayEquals([42, 17], f3());
34 assertArrayEquals([1, 2, 3], f3([1, 2, 3]));
35
36 var f4 = ([...[...x]] = [42, 17]) => x;
37 assertArrayEquals([42, 17], f4());
38 assertArrayEquals([1, 2, 3], f4([1, 2, 3]));
39 })();
OLDNEW
« src/parsing/pattern-rewriter.cc ('K') | « src/parsing/pattern-rewriter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698