( name: string, symbol: ts.Symbol, location: ts.Node, checker: ts.TypeChecker, cwd: string )
| 2831 | |
| 2832 | function signatureParameterName(parameter: ts.Symbol): string { |
| 2833 | const declaration = signatureParameterDeclaration(parameter) |
| 2834 | if (declaration !== undefined && ts.isIdentifier(declaration.name)) return declaration.name.text |
| 2835 | return parameter.getName() |
| 2836 | } |
| 2837 | |
| 2838 | function signatureFunctionThisKind(type: ts.Type, checker: ts.TypeChecker, location: ts.Node): string { |
| 2839 | const thisParameter = checker.getSignaturesOfType(type, ts.SignatureKind.Call)[0]?.thisParameter |
| 2840 | if (thisParameter === undefined) return "none" |
| 2841 | const thisType = checker.typeToString( |
| 2842 | checker.getTypeOfSymbolAtLocation(thisParameter, location), |
| 2843 | location, |
| 2844 | signatureTypeFormatFlags |
| 2845 | ) |
| 2846 | return thisType === "unassigned" ? "unassigned" : "self" |
| 2847 | } |
| 2848 | |
| 2849 | function isSignatureFunctionKind(kind: string): boolean { |
| 2850 | return kind.startsWith("body:") || kind.startsWith("function:") |
| 2851 | } |
| 2852 | |
| 2853 | function signatureTransformCountKind(count: number): string { |
| 2854 | if (count <= 3) return String(count) |
| 2855 | if (count <= 7) return "4" |
| 2856 | if (count <= 15) return "8" |
| 2857 | return "16" |
| 2858 | } |
| 2859 | |
| 2860 | function signatureParameterKind( |
| 2861 | parameter: ts.Symbol | undefined, |
| 2862 | checker: ts.TypeChecker, |
| 2863 | location: ts.Node |
| 2864 | ): string { |
| 2865 | if (parameter === undefined) return "none" |
| 2866 | const declaration = signatureParameterDeclaration(parameter) |
| 2867 | if (declaration?.dotDotDotToken !== undefined) return "rest" |
| 2868 | const name = signatureParameterName(parameter).replace(/_$/, "").toLowerCase() |
| 2869 | const type = checker.getTypeOfSymbolAtLocation(parameter, declaration ?? location) |
| 2870 | if (name === "self" || name === "that") return "self" |
| 2871 | if (name === "body") return `body:${signatureFunctionThisKind(type, checker, location)}` |
| 2872 | if (name === "name" || name === "spanname") return "name" |
| 2873 | if (name.includes("refinement")) return "refinement" |
| 2874 | if (name.includes("predicate")) return "predicate" |
| 2875 | if (name === "options" || name === "option" || name === "opts" || name === "config" || name === "args") { |
no test coverage detected
searching dependent graphs…