"use strict";
/**
 * Copyright: (c) Myia SAS 2026.
 * This file and its contents are licensed under the AGPLv3 License.
 * Please see the LICENSE file at the root of this repository
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.HEAL_IGNORE_DIRECTIVE = void 0;
exports.isUnderHealIgnore = isUnderHealIgnore;
exports.HEAL_IGNORE_DIRECTIVE = '@heal-tracer-ignore';
const DIRECTIVE_RE = /@heal-tracer-ignore\b/;
function hasDirectiveComment(node) {
    const comments = node?.leadingComments;
    if (!comments)
        return false;
    for (const comment of comments) {
        if (DIRECTIVE_RE.test(comment.value))
            return true;
    }
    return false;
}
function isUnderHealIgnore(path) {
    for (let current = path; current; current = current.parentPath) {
        if (hasDirectiveComment(current.node))
            return true;
    }
    return false;
}
