@sudoo/marked
Version:
JavaScript & TypeScript code runner in JavaScript, safe with marked territory, asynchronous
34 lines (33 loc) • 1.2 kB
JavaScript
;
/**
* @author WMXPY
* @namespace Debug_BreakPoint
* @description Line
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.MarkedDebugLineBreakPoint = void 0;
const script_location_1 = require("../../declare/script-location");
const break_point_1 = require("./break-point");
class MarkedDebugLineBreakPoint extends break_point_1.MarkedDebugBreakPoint {
static fromLineNumber(lineNumber, scriptLocation = script_location_1.ScriptLocation.createRoot()) {
return new MarkedDebugLineBreakPoint(scriptLocation, lineNumber);
}
constructor(scriptLocation, lineNumber) {
super(scriptLocation);
this._lineNumber = lineNumber;
}
shouldTrigger(scriptLocation, node) {
if (!this._properToHandle(scriptLocation)) {
return false;
}
const sourceLocation = node.loc;
return this._lineNumber === sourceLocation.start.line;
}
shouldReset(scriptLocation, node) {
if (!this._properToHandle(scriptLocation)) {
return false;
}
return !this.shouldTrigger(scriptLocation, node);
}
}
exports.MarkedDebugLineBreakPoint = MarkedDebugLineBreakPoint;