isLineInScope.js (672B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ 4 5 import { getInScopeLines } from "./ast"; 6 import { getVisibleSelectedFrame } from "./pause"; 7 8 // Checks if a line is considered in scope 9 // We consider all lines in scope, if we do not have lines in scope. 10 export function isLineInScope(state, line) { 11 const frame = getVisibleSelectedFrame(state); 12 if (!frame) { 13 return false; 14 } 15 16 const lines = getInScopeLines(state, frame.location); 17 if (!lines) { 18 return true; 19 } 20 21 return lines.includes(line); 22 }