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

Side by Side Diff: test/mjsunit/harmony/default-parameters-debug.js

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

Powered by Google App Engine
This is Rietveld 408576698