| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Flags: --expose-debug-as debug --harmony-destructuring-assignment | |
| 6 // Flags: --harmony-destructuring-bind | |
| 7 | |
| 8 var exception = null; | |
| 9 var Debug = debug.Debug; | |
| 10 var break_count = 0; | |
| 11 | |
| 12 function listener(event, exec_state, event_data, data) { | |
| 13 if (event != Debug.DebugEvent.Break) return; | |
| 14 try { | |
| 15 var source = exec_state.frame(0).sourceLineText(); | |
| 16 print(source); | |
| 17 assertTrue(source.indexOf(`// B${break_count++}`) > 0); | |
| 18 if (source.indexOf("assertEquals") > 0) { | |
| 19 exec_state.prepareStep(Debug.StepAction.StepNext); | |
| 20 } else { | |
| 21 exec_state.prepareStep(Debug.StepAction.StepIn); | |
| 22 } | |
| 23 } catch (e) { | |
| 24 exception = e; | |
| 25 print(e); | |
| 26 } | |
| 27 }; | |
| 28 | |
| 29 Debug.setListener(listener); | |
| 30 | |
| 31 function f() { | |
| 32 var a, b, c, d; | |
| 33 debugger; // B0 | |
| 34 [ // B1 | |
| 35 a, // B2 | |
| 36 b, // B3 | |
| 37 c = 3 // B4 | |
| 38 ] = [1, 2]; | |
| 39 assertEquals({a:1,b:2,c:3}, {a, b, c}); // B5 | |
| 40 | |
| 41 [ // B6 | |
| 42 a, // B7 | |
| 43 [ | |
| 44 b, // B8 | |
| 45 c // B9 | |
| 46 ], | |
| 47 d // B10 | |
| 48 ] = [5, [6, 7], 8]; | |
| 49 assertEquals({a:5,b:6,c:7,d:8}, {a, b, c, d}); // B11 | |
| 50 | |
| 51 [ // B12 | |
| 52 a, // B13 | |
| 53 b, // B14 | |
| 54 ...c // B15 | |
| 55 ] = [1, 2, 3, 4]; | |
| 56 assertEquals({a:1,b:2,c:[3,4]}, {a, b, c}); // B16 | |
| 57 | |
| 58 ({ // B17 | |
| 59 a, // B18 | |
| 60 b, // B19 | |
| 61 c = 7 // B20 | |
| 62 } = {a: 5, b: 6}); | |
| 63 assertEquals({a:5,b:6,c:7}, {a, b, c}); // B21 | |
| 64 | |
| 65 ({ // B22 | |
| 66 a, // B23 | |
| 67 b = return1(), // B24 | |
| 68 c = return1() // B25 | |
| 69 } = {a: 5, b: 6}); | |
| 70 assertEquals({a:5,b:6,c:1}, {a, b, c}); // B28 | |
| 71 | |
| 72 ({ // B29 | |
| 73 x : a, // B30 | |
| 74 y : b, // B31 | |
| 75 z : c = 3 // B32 | |
| 76 } = {x: 1, y: 2}); | |
| 77 assertEquals({a:1,b:2,c:3}, {a, b, c}); // B33 | |
| 78 } // B34 | |
| 79 | |
| 80 function return1() { | |
| 81 return 1; // B26 | |
| 82 } // B27 | |
| 83 | |
| 84 f(); | |
| 85 Debug.setListener(null); // B35 | |
| 86 assertNull(exception); | |
| OLD | NEW |