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

Side by Side Diff: test/mjsunit/debug-multiple-var-decl.js

Issue 2497973002: [debug-wrapper] Further extend the debug wrapper (Closed)
Patch Set: Address comments Created 4 years, 1 month 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 | « test/mjsunit/debug-enable-disable-breakpoints.js ('k') | test/mjsunit/debug-referenced-by.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Flags: --expose-debug-as debug
6
7 // Test we break at every assignment in a var-statement with multiple
8 // variable declarations.
9
10 var exception = null;
11 var log = []
12
13 function f() {
14 var l1 = 1, // l
15 l2, // m
16 l3 = 3; // n
17 let l4, // o
18 l5 = 5, // p
19 l6 = 6; // q
20 const l7 = 7, // r
21 l8 = 8, // s
22 l9 = 9; // t
23 return 0; // u
24 } // v
25
26 function listener(event, exec_state, event_data, data) {
27 if (event != Debug.DebugEvent.Break) return;
28 try {
29 var line = exec_state.frame(0).sourceLineText();
30 var col = exec_state.frame(0).sourceColumn();
31 print(line);
32 var match = line.match(/\/\/ (\w)$/);
33 assertEquals(2, match.length);
34 log.push(match[1] + col);
35 if (match[1] != "v") {
36 exec_state.prepareStep(Debug.StepAction.StepIn);
37 }
38 } catch (e) {
39 exception = e;
40 }
41 }
42
43 var Debug = debug.Debug;
44 Debug.setListener(listener);
45
46 debugger; // a
47 var g1 = 1, // b
48 g2 = 2, // c
49 g3; // d
50 let g4 = 4, // e
51 g5, // f
52 g6 = 6; // g
53 const g7 = 7, // h
54 g8 = 8, // i
55 g9 = f(); // j
56
57 Debug.setListener(null);
58
59 assertNull(exception);
60
61 // Note that let declarations, if not explicitly initialized, implicitly
62 // initialize to undefined.
63
64 var expected = [
65 "a0", // debugger statement
66 "b9","c9", // global var
67 "e9","f4","g9", // global let
68 "h11","i11","j11", // global const
69 "l11","n11", // local var
70 "o6","p11","q11", // local let
71 "r13","s13","t13", // local const
72 "u2","v0", // return
73 ];
74 assertEquals(expected, log);
OLDNEW
« no previous file with comments | « test/mjsunit/debug-enable-disable-breakpoints.js ('k') | test/mjsunit/debug-referenced-by.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698