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

Side by Side Diff: test/mjsunit/harmony/optional-arguments-debug.js

Issue 1104223002: [es6] implement optional parameters via desugaring (with scoping) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add a debugger test Created 5 years, 7 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 | « test/mjsunit/harmony/optional-arguments.js ('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 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
6 // Flags: --expose-debug-as debug
7
8 // Get the Debug object exposed from the debug context global object.
9 Debug = debug.Debug
10
11 listenerComplete = false;
12 breakPointCount = 0;
13
14 function listener(event, exec_state, event_data, data) {
15 if (event == Debug.DebugEvent.Break) {
16 breakPointCount++;
17 if (breakPointCount == 1) {
18 // Break point in initializer for parameter `a`, invoked by
19 // initializer for parameter `b`
20 assertEquals('default', exec_state.frame(1).evaluate('mode').value());
21
22 // initializer for `b` can't refer to `b`
23 assertThrows(function() {
24 return exec_state.frame(1).evaluate('b').value();
25 }, ReferenceError);
26
27 assertThrows(function() {
28 return exec_state.frame(1).evaluate('c');
29 }, ReferenceError);
30 } else if (breakPointCount == 2) {
31 // Break point in IIFE initializer for parameter `c`
32 assertEquals('modeFn', exec_state.frame(1).evaluate('a.name').value());
33 assertEquals('default', exec_state.frame(1).evaluate('b').value());
34 assertThrows(function() {
35 return exec_state.frame(1).evaluate('c');
36 }, ReferenceError);
37 } else if (breakPointCount == 3) {
38 // Break point in function body --- `c` parameter is shadowed
39 assertEquals('modeFn', exec_state.frame(0).evaluate('a.name').value());
40 assertEquals('default', exec_state.frame(0).evaluate('b').value());
41 assertEquals(true, exec_state.frame(0).evaluate('c').value());
42 }
43 }
44 };
45
46 // Add the debug event listener.
47 Debug.setListener(listener);
48
49 function f(a = function modeFn(mode) {
50 debugger;
51 return mode;
52 },
53 b = a("default"),
54 c = (function() {
55 debugger;
56 })()) {
57 var c = true;
58 debugger;
59 };
60
61 f();
62
63 // Make sure that the debug event listener vas invoked.
64 assertEquals(3, breakPointCount);
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/optional-arguments.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698