/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
export { describe, it } from "mocha";
export { expect } from "chai";
export { runOverloadCollectionPass, runOverloadFamilyConsistencyPass, } from "../index.js";
export const assertDefined = (value, msg) => {
    if (value === null || value === undefined) {
        throw new Error(msg ?? "Expected value to be defined");
    }
    return value;
};
export const createModule = (body, overloadsApiLocalName = "O") => ({
    kind: "module",
    filePath: "test.ts",
    namespace: "Test",
    className: "Test",
    isStaticContainer: false,
    imports: [
        {
            kind: "import",
            source: "@tsonic/core/lang.js",
            isLocal: false,
            isClr: false,
            specifiers: [
                {
                    kind: "named",
                    name: "overloads",
                    localName: overloadsApiLocalName,
                },
            ],
        },
    ],
    body,
    exports: [],
});
export const makeIdentifier = (name) => ({
    kind: "identifier",
    name,
});
export const makeReferenceType = (name) => ({
    kind: "referenceType",
    name,
});
export const makePrimitiveType = (name) => ({
    kind: "primitiveType",
    name,
});
export const makeUnknownType = () => ({
    kind: "unknownType",
    explicit: true,
});
export const makeAnyType = () => ({
    kind: "anyType",
});
export const makeMemberAccess = (object, property) => ({
    kind: "memberAccess",
    object,
    property,
    isComputed: false,
    isOptional: false,
});
export const makeCall = (callee, args, typeArguments) => ({
    kind: "call",
    callee,
    arguments: args,
    isOptional: false,
    ...(typeArguments ? { typeArguments } : {}),
});
export const makeLiteral = (value) => ({
    kind: "literal",
    value,
    raw: JSON.stringify(value),
});
export const makeParameter = (name) => ({
    kind: "parameter",
    pattern: { kind: "identifierPattern", name },
    type: undefined,
    initializer: undefined,
    isOptional: false,
    isRest: false,
    passing: "value",
});
export const makeTypedParameter = (name, type) => ({
    ...makeParameter(name),
    type,
});
export const makeBlock = () => ({
    kind: "blockStatement",
    statements: [],
});
export const makeFunctionDeclaration = (name, parameters, returnType, options) => ({
    kind: "functionDeclaration",
    name,
    parameters,
    returnType,
    body: makeBlock(),
    ...(options?.isDeclarationOnly ? { isDeclarationOnly: true } : {}),
    isAsync: false,
    isGenerator: false,
    isExported: options?.isExported ?? true,
});
export const makeMethodDeclaration = (name, parameters, returnType, options) => ({
    kind: "methodDeclaration",
    name,
    parameters,
    returnType,
    ...(options?.hasBody === false ? {} : { body: makeBlock() }),
    isStatic: options?.isStatic ?? false,
    isAsync: false,
    isGenerator: false,
    accessibility: options?.accessibility ?? "public",
});
export const makeMethodSignature = (name, parameters, returnType) => ({
    kind: "methodSignature",
    name,
    parameters,
    returnType,
});
export const makeSelector = (memberName) => ({
    kind: "arrowFunction",
    parameters: [makeParameter("x")],
    isAsync: false,
    body: makeMemberAccess(makeIdentifier("x"), memberName),
});
export const makeBadSelector = (memberName) => ({
    kind: "arrowFunction",
    parameters: [makeParameter("x")],
    isAsync: false,
    body: makeCall(makeMemberAccess(makeIdentifier("x"), memberName), []),
});
export const makeFunctionMarkerCall = (functionName, familyName, apiObjectName = "O") => ({
    kind: "expressionStatement",
    expression: makeCall(makeMemberAccess(makeCall(makeIdentifier(apiObjectName), [makeIdentifier(functionName)]), "family"), [makeIdentifier(familyName)]),
});
export const makeMethodMarkerCall = (typeName, memberName, familyName, _isStatic = false, apiObjectName = "O") => ({
    kind: "expressionStatement",
    expression: makeCall(makeMemberAccess(makeCall(makeMemberAccess(makeCall(makeIdentifier(apiObjectName), [], [makeReferenceType(typeName)]), "method"), [makeSelector(memberName)]), "family"), [makeSelector(familyName)]),
});
export const makeMethodMarkerCallWithSelector = (typeName, selector, familyName, _isStatic = false, apiObjectName = "O") => ({
    kind: "expressionStatement",
    expression: makeCall(makeMemberAccess(makeCall(makeMemberAccess(makeCall(makeIdentifier(apiObjectName), [], [makeReferenceType(typeName)]), "method"), [selector]), "family"), [makeSelector(familyName)]),
});
//# sourceMappingURL=helpers.js.map