UNPKG

@sudoo/marked

Version:

JavaScript & TypeScript code runner in JavaScript, safe with marked territory, asynchronous

43 lines (42 loc) 1.4 kB
"use strict"; /** * @author WMXPY * @namespace Debug_Snapshot * @description Snapshot */ Object.defineProperty(exports, "__esModule", { value: true }); exports.MarkedDebugSnapshot = void 0; const location_1 = require("./location"); const node_1 = require("./node"); const scope_1 = require("./scope"); class MarkedDebugSnapshot { static fromScopeAndNode(sourceCode, scope, node, trace) { const snapshotScope = scope_1.MarkedDebugSnapshotScope.fromScope(scope); const snapshotLocation = location_1.MarkedDebugSnapshotLocation.fromNode(node, trace); const snapshotNode = node_1.MarkedDebugSnapshotNode.fromNode(node); return new MarkedDebugSnapshot(sourceCode, trace.scriptLocation, snapshotScope, snapshotLocation, snapshotNode); } constructor(sourceCode, scriptLocation, scope, location, node) { this._sourceCode = sourceCode; this._scriptLocation = scriptLocation; this._scope = scope; this._location = location; this._node = node; } get scope() { return this._scope; } get location() { return this._location; } get node() { return this._node; } getScriptLocation() { return this._scriptLocation; } sliceCodeClip() { return this._location.sliceCodeClip(this._sourceCode); } } exports.MarkedDebugSnapshot = MarkedDebugSnapshot;