| // Copyright 2017 the V8 project authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| return x; // Check scopes |
| let scopes_checked = false; |
| function listener(event, exec_state, event_data, data) { |
| if (event != Debug.DebugEvent.Break) return; |
| if (exec_state.frame().sourceLineText().includes("Check scopes")) { |
| let expected = [ debug.ScopeType.Block, |
| debug.ScopeType.Global ]; |
| for (let i = 0; i < exec_state.frame().scopeCount(); i++) { |
| assertEquals(expected[i], exec_state.frame().scope(i).scopeType()); |
| if (step_count++ < 3) exec_state.prepareStep(Debug.StepAction.StepNext); |
| Debug.setListener(listener); |
| assertEquals(4, step_count); |
| assertTrue(scopes_checked); |