65 lines
6.6 KiB
JavaScript
65 lines
6.6 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.StopEventManager = undefined;
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
|
* 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.
|
|
*/
|
|
|
|
var _invariant = require("./../common/invariant.js");
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _Breakpoint = require("./Breakpoint.js");
|
|
|
|
var _Stepper = require("./Stepper.js");
|
|
|
|
var _babelTypes = require("babel-types");
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
// Manage whether the debuggee should stop
|
|
// All stopping related logic is centralized here
|
|
|
|
var StopEventManager = exports.StopEventManager = function () {
|
|
function StopEventManager() {
|
|
_classCallCheck(this, StopEventManager);
|
|
}
|
|
|
|
_createClass(StopEventManager, [{
|
|
key: "getDebuggeeStopReason",
|
|
|
|
// 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
|
|
value: function getDebuggeeStopReason(ast, stoppables) {
|
|
if (stoppables.length === 0) return;
|
|
var stoppable = stoppables[0];
|
|
var stoppedReason = void 0;
|
|
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 {
|
|
(0, _invariant2.default)(false, "Invalid stoppable object");
|
|
}
|
|
return stoppedReason;
|
|
}
|
|
}]);
|
|
|
|
return StopEventManager;
|
|
}();
|
|
//# sourceMappingURL=StopEventManager.js.map
|