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

Side by Side Diff: test/debugger/regress/regress-6085.js

Issue 2744213003: [debugger] fix switch block source positions. (Closed)
Patch Set: address comment Created 3 years, 9 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/parsing/parser-base.h ('k') | no next file » | 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 2017 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* serialize() {
6 debugger;
7 switch (0) {
8 case 0:
9 let x = 1;
10 return x; // Check scopes
11 }
12 }
13
14 let exception = null;
15 let step_count = 0;
16 let scopes_checked = false;
17
18 function listener(event, exec_state, event_data, data) {
19 if (event != Debug.DebugEvent.Break) return;
20 try {
21 if (exec_state.frame().sourceLineText().includes("Check scopes")) {
22 let expected = [ debug.ScopeType.Block,
23 debug.ScopeType.Local,
24 debug.ScopeType.Script,
25 debug.ScopeType.Global ];
26 for (let i = 0; i < exec_state.frame().scopeCount(); i++) {
27 assertEquals(expected[i], exec_state.frame().scope(i).scopeType());
28 }
29 scopes_checked = true;
30 }
31 if (step_count++ < 3) exec_state.prepareStep(Debug.StepAction.StepNext);
32 } catch (e) {
33 exception = e;
34 print(e, e.stack);
35 }
36 }
37
38
39
40 let Debug = debug.Debug;
41 Debug.setListener(listener);
42
43 let gen = serialize();
44 gen.next();
45
46 Debug.setListener(null);
47 assertNull(exception);
48 assertEquals(4, step_count);
49 assertTrue(scopes_checked);
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698