@jqassistant/ts-lce
Version:
Tool to extract language concepts from a TypeScript codebase and export them to a JSON file.
28 lines (27 loc) • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEBUG_LOGGING = void 0;
exports.setDebugLogging = setDebugLogging;
exports.debug = debug;
exports.debugTraversalStack = debugTraversalStack;
const context_keys_1 = require("../context.keys");
exports.DEBUG_LOGGING = false;
function setDebugLogging(enableDebugLogging) {
exports.DEBUG_LOGGING = enableDebugLogging;
}
function debug(logMessage) {
if (exports.DEBUG_LOGGING) {
console.debug(logMessage);
}
}
function debugTraversalStack(localContexts) {
if (exports.DEBUG_LOGGING) {
let astPos = "";
for (const lc of localContexts.contexts) {
const coordNum = lc.get(context_keys_1.CoreContextKeys.TRAVERSER_CONTEXT).parentPropIndex;
const coordName = lc.get(context_keys_1.CoreContextKeys.TRAVERSER_CONTEXT).parentPropName;
astPos = astPos + "/" + coordName + (coordNum !== undefined ? "[" + coordNum + "]" : "");
}
console.debug(astPos);
}
}