UNPKG

prepack

Version:

Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.

58 lines (46 loc) 1.88 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StopEventManager = void 0; var _invariant = _interopRequireDefault(require("./../common/invariant.js")); var _Breakpoint = require("./Breakpoint.js"); var _Stepper = require("./Stepper.js"); var _types = require("@babel/types"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Copyright (c) 2017-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ /* strict-local */ // Manage whether the debuggee should stop // All stopping related logic is centralized here class StopEventManager { // stoppables is a list of objects the debuggee should be stopped on // (e.g. breakpoint, completed steppers). The debuggee should stop if there // is at least one element in the list. Currently the reason of the first element // is chosen as the reason sent to the UI getDebuggeeStopReason(ast, stoppables) { if (stoppables.length === 0) return; let stoppable = stoppables[0]; let stoppedReason; if (stoppable instanceof _Breakpoint.Breakpoint) { stoppedReason = "Breakpoint"; } else if (stoppable instanceof _Stepper.StepIntoStepper) { stoppedReason = "Step Into"; } else if (stoppable instanceof _Stepper.StepOverStepper) { stoppedReason = "Step Over"; } else if (stoppable instanceof _Stepper.StepOutStepper) { stoppedReason = "Step Out"; } else { (0, _invariant.default)(false, "Invalid stoppable object"); } return stoppedReason; } } exports.StopEventManager = StopEventManager; //# sourceMappingURL=StopEventManager.js.map