const localBindingKinds = new Set(["local", "param", "var", "const", "let"]);
export function doesNodePathHaveBinding(path, checkProgramScope = false) {
    const elementScope = path.scope;
    let hasLocalBinding = false;
    path.traverse({
        Identifier(path) {
            const identifierBinding = path.scope.getBinding(path.node.name);
            if (identifierBinding && localBindingKinds.has(identifierBinding.kind)) {
                // simple case, the binding is in the same function scope (avoids having to traverse up the whole tree)
                if (identifierBinding?.scope.uid === elementScope.uid) {
                    hasLocalBinding = true;
                    path.stop();
                }
                // we need to double check with to see if the scope is the module, so some sort of global
                const programScope = path.scope.getProgramParent();
                if (checkProgramScope &&
                    programScope.uid === identifierBinding?.scope.uid) {
                    hasLocalBinding = true;
                    path.stop();
                }
            }
        },
    });
    return hasLocalBinding;
}
//# sourceMappingURL=bindings.js.map