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

Side by Side Diff: test/mjsunit/harmony/destructuring.js

Issue 1128043006: [destructuring] Adapting PatternRewriter to work in for-statements. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 5 years, 7 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/pattern-rewriter.cc ('k') | tools/gyp/v8.gyp » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 // Flags: --harmony-destructuring 5 // Flags: --harmony-destructuring
6 6
7 (function TestObjectLiteralPattern() { 7 (function TestObjectLiteralPattern() {
8 var { x : x, y : y } = { x : 1, y : 2 }; 8 var { x : x, y : y } = { x : 1, y : 2 };
9 assertEquals(1, x); 9 assertEquals(1, x);
10 assertEquals(2, y); 10 assertEquals(2, y);
11 11
12 var {z} = { z : 3 }; 12 var {z} = { z : 3 };
13 assertEquals(3, z); 13 assertEquals(3, z);
14
15
16 var sum = 0;
17 for(var {z} = { z : 3 }; z != 0; z--) {
18 sum += z;
19 }
20 assertEquals(6, sum);
14 }()); 21 }());
22
23
24 (function TestObjectLiteralPatternLexical() {
25 'use strict';
26 let { x : x, y : y } = { x : 1, y : 2 };
27 assertEquals(1, x);
28 assertEquals(2, y);
29
30 let {z} = { z : 3 };
31 assertEquals(3, z);
32
33
34 let sum = 0;
35 for(let {x, z} = { x : 0, z : 3 }; z != 0; z--) {
36 assertEquals(0, x);
37 sum += z;
38 }
39 assertEquals(6, sum);
40 }());
41
42
43 (function TestObjectLiteralPatternLexicalConst() {
44 'use strict';
45 const { x : x, y : y } = { x : 1, y : 2 };
46 assertEquals(1, x);
47 assertEquals(2, y);
48
49 const {z} = { z : 3 };
50 assertEquals(3, z);
51
52
53 for(const {x, z} = { x : 0, z : 3 }; z != 3 || x != 0;) {
54 assertTrue(false);
55 }
56 }());
OLDNEW
« no previous file with comments | « src/pattern-rewriter.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698