Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 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 | var Debug = debug.Debug; |
| 8 | var steps = 0; |
| 9 | var exception = null; |
| 10 | |
| 11 | function listener(event, execState, eventData, data) { |
| 12 | if (event != Debug.DebugEvent.Break) return; |
| 13 | try { |
| 14 | assertEquals([ debug.ScopeType.Local, |
| 15 | debug.ScopeType.Script, |
| 16 | debug.ScopeType.Global], |
| 17 | execState.frame().allScopes().map(s => s.scopeType())); |
| 18 | var x_value = execState.frame().evaluate("x").value(); |
| 19 | if (steps < 2) { |
| 20 | assertEquals(undefined, x_value); |
| 21 | execState.prepareStep(Debug.StepAction.StepIn); |
| 22 | } else { |
| 23 | assertEquals("l => l", x_value.toString()); |
| 24 | } |
| 25 | steps++; |
| 26 | } catch (e) { |
| 27 | exception = e; |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | Debug.setListener(listener); |
| 32 | |
| 33 | (function() { |
| 34 | debugger; |
| 35 | var x = l => l; |
| 36 | })(); |
| 37 | |
| 38 | Debug.setListener(null); |
| 39 | assertNull(exception); |
| 40 | assertEquals(3, steps); |