OLD | NEW |
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: --expose-debug-as debug --harmony-destructuring-assignment | 5 // Flags: --expose-debug-as debug --harmony-destructuring-assignment |
6 // Flags: --harmony-destructuring-bind | 6 // Flags: --harmony-destructuring-bind |
7 | 7 |
8 var exception = null; | 8 var exception = null; |
9 var Debug = debug.Debug; | 9 var Debug = debug.Debug; |
10 var break_count = 0; | 10 var break_count = 0; |
(...skipping 14 matching lines...) Expand all Loading... |
25 print(e); | 25 print(e); |
26 } | 26 } |
27 }; | 27 }; |
28 | 28 |
29 Debug.setListener(listener); | 29 Debug.setListener(listener); |
30 | 30 |
31 function f() { | 31 function f() { |
32 var a, b, c, d; | 32 var a, b, c, d; |
33 debugger; // B0 | 33 debugger; // B0 |
34 [ // B1 | 34 [ // B1 |
35 a, // B3 | 35 a, // B2 |
36 b, // B4 | 36 b, // B3 |
37 c = 3 // B5 | 37 c = 3 // B4 |
38 ] = [1, 2]; // B2 | 38 ] = [1, 2]; |
39 assertEquals({a:1,b:2,c:3}, {a, b, c}); // B6 | 39 assertEquals({a:1,b:2,c:3}, {a, b, c}); // B5 |
40 | 40 |
41 [ // B7 | 41 [ // B6 |
42 a, // B9 | 42 a, // B7 |
43 [ | 43 [ |
44 b, // B10 | 44 b, // B8 |
45 c // B11 | 45 c // B9 |
46 ], | 46 ], |
47 d // B12 | 47 d // B10 |
48 ] = [5, [6, 7], 8]; // B8 | 48 ] = [5, [6, 7], 8]; |
49 assertEquals({a:5,b:6,c:7,d:8}, {a, b, c, d}); // B13 | 49 assertEquals({a:5,b:6,c:7,d:8}, {a, b, c, d}); // B11 |
50 | 50 |
51 [ // B14 | 51 [ // B12 |
52 a, // B16 | 52 a, // B13 |
53 b, // B17 | 53 b, // B14 |
54 ...c // B18 | 54 ...c // B15 |
55 ] = [1, 2, 3, 4]; // B15 | 55 ] = [1, 2, 3, 4]; |
56 assertEquals({a:1,b:2,c:[3,4]}, {a, b, c}); // B19 | 56 assertEquals({a:1,b:2,c:[3,4]}, {a, b, c}); // B16 |
57 | 57 |
58 ({ // B20 | 58 ({ // B17 |
59 a, // B22 | 59 a, // B18 |
60 b, // B23 | 60 b, // B19 |
61 c = 7 // B24 | 61 c = 7 // B20 |
62 } = {a: 5, b: 6}); // B21 | 62 } = {a: 5, b: 6}); |
63 assertEquals({a:5,b:6,c:7}, {a, b, c}); // B25 | 63 assertEquals({a:5,b:6,c:7}, {a, b, c}); // B21 |
64 | 64 |
65 ({ // B26 | 65 ({ // B22 |
66 a, // B28 | 66 a, // B23 |
67 b = return1(), // B29 | 67 b = return1(), // B24 |
68 c = return1() // B30 | 68 c = return1() // B25 |
69 } = {a: 5, b: 6}); // B27 | 69 } = {a: 5, b: 6}); |
70 assertEquals({a:5,b:6,c:1}, {a, b, c}); // B33 | 70 assertEquals({a:5,b:6,c:1}, {a, b, c}); // B28 |
71 | 71 |
72 ({ // B34 | 72 ({ // B29 |
73 x : a, // B36 | 73 x : a, // B30 |
74 y : b, // B37 | 74 y : b, // B31 |
75 z : c = 3 // B38 | 75 z : c = 3 // B32 |
76 } = {x: 1, y: 2}); // B35 | 76 } = {x: 1, y: 2}); |
77 assertEquals({a:1,b:2,c:3}, {a, b, c}); // B39 | 77 assertEquals({a:1,b:2,c:3}, {a, b, c}); // B33 |
78 } // B40 | 78 } // B34 |
79 | 79 |
80 function return1() { | 80 function return1() { |
81 return 1; // B31 | 81 return 1; // B26 |
82 } // B32 | 82 } // B27 |
83 | 83 |
84 f(); | 84 f(); |
85 Debug.setListener(null); // B41 | 85 Debug.setListener(null); // B35 |
86 assertNull(exception); | 86 assertNull(exception); |
OLD | NEW |