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

Side by Side Diff: test/mjsunit/debug-evaluate-declaration.js

Issue 2491543002: [debug-wrapper] Conditional breaks, locals, evaluate, scopes (Closed)
Patch Set: Rebase 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-evaluate-closure.js ('k') | test/mjsunit/debug-evaluate-locals-capturing.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 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
6
7 // Test that debug-evaluate only resolves variables that are used by
8 // the function inside which we debug-evaluate. This is to avoid
9 // incorrect variable resolution when a context-allocated variable is
10 // shadowed by a stack-allocated variable.
11
12 "use strict";
13
14 var Debug = debug.Debug
15
16 var exception = null;
17 function listener(event, exec_state, event_data, data) {
18 if (event != Debug.DebugEvent.Break) return;
19 try {
20 exec_state.frame(0).evaluate("var x = 2");
21 exec_state.frame(0).evaluate("'use strict'; let y = 3");
22 exec_state.frame(0).evaluate("var z = 4");
23 exec_state.frame(0).evaluate("function bar() { return 5; }");
24 } catch (e) {
25 exception = e;
26 print(e + e.stack);
27 }
28 }
29
30 Debug.setListener(listener);
31
32 var z = 1;
33
34 (function() {
35 debugger;
36 })();
37
38 assertEquals(2, x); // declaration
39 assertThrows(() => y, ReferenceError); // let-declaration does not stick
40 assertEquals(4, z); // re-declaration
41 assertEquals(5, bar()); // function declaration
42
43 Debug.setListener(null);
44 assertNull(exception);
OLDNEW
« no previous file with comments | « test/mjsunit/debug-evaluate-closure.js ('k') | test/mjsunit/debug-evaluate-locals-capturing.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698