Documentation
¶
Index ¶
- func BuildKotlinIndices(kotlinFiles []string, contentReader vcs.ContentReader) (map[string][]string, map[string]map[string][]string, map[string]string)
- func ExtractCalledFunctionNames(sourceCode []byte) []string
- func ExtractPackageDeclaration(sourceCode []byte) string
- func ExtractTopLevelFunctionNames(sourceCode []byte) []string
- func ExtractTopLevelTypeNames(sourceCode []byte) []string
- func ExtractTypeIdentifiers(sourceCode []byte) []string
- func IsTestFile(filePath string) bool
- func ResolveKotlinProjectImports(absPath string, filePath string, kotlinPackageIndex map[string][]string, ...) ([]string, error)
- type ExternalImport
- type InternalImport
- type KotlinImport
- type Provider
- type StandardLibraryImport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildKotlinIndices ¶
func ExtractCalledFunctionNames ¶ added in v0.27.0
ExtractCalledFunctionNames returns the callee names of unqualified call expressions (e.g. `foo()` but not `x.foo()`). Used to resolve same-package top-level function calls, which ExtractTypeIdentifiers deliberately ignores (it captures only type references). Resolution stays precise: a name only produces an edge when the package index holds exactly one declaring file.
func ExtractPackageDeclaration ¶
ExtractPackageDeclaration extracts the package declaration from Kotlin source code
func ExtractTopLevelFunctionNames ¶ added in v0.27.0
ExtractTopLevelFunctionNames returns the names of functions declared at the top level of the file. Kotlin same-package free-function calls carry no import, so these must be indexed for an unqualified call to resolve to its defining file.
func ExtractTopLevelTypeNames ¶
ExtractTopLevelTypeNames returns the class/object/interface/typealias names declared at the top level of the file
func ExtractTypeIdentifiers ¶
ExtractTypeIdentifiers returns all type identifiers referenced within the file
func IsTestFile ¶
IsTestFile reports whether the given Kotlin file path is a test file.
Types ¶
type ExternalImport ¶
type ExternalImport struct {
// contains filtered or unexported fields
}
ExternalImport represents an external library import
func (ExternalImport) IsWildcard ¶
func (e ExternalImport) IsWildcard() bool
func (ExternalImport) Package ¶
func (e ExternalImport) Package() string
func (ExternalImport) Path ¶
func (e ExternalImport) Path() string
type InternalImport ¶
type InternalImport struct {
// contains filtered or unexported fields
}
InternalImport represents an internal project import
func (InternalImport) IsWildcard ¶
func (i InternalImport) IsWildcard() bool
func (InternalImport) Package ¶
func (i InternalImport) Package() string
func (InternalImport) Path ¶
func (i InternalImport) Path() string
type KotlinImport ¶
KotlinImport represents an import in a Kotlin file
func ClassifyWithProjectPackages ¶
func ClassifyWithProjectPackages(imports []KotlinImport, projectPackages map[string]bool) []KotlinImport
ClassifyWithProjectPackages reclassifies imports with knowledge of project packages This is used during graph building when we know all project packages
func KotlinImports ¶
func KotlinImports(filePath string) ([]KotlinImport, error)
KotlinImports parses a Kotlin file and returns its imports
func ParseKotlinImports ¶
func ParseKotlinImports(sourceCode []byte) ([]KotlinImport, error)
ParseKotlinImports parses Kotlin source code and extracts imports
type Provider ¶ added in v0.27.0
type Provider struct{}
func (Provider) Extensions ¶ added in v0.27.0
func (Provider) IsTestFile ¶ added in v0.27.0
func (Provider) IsTestFile(filePath string, _ vcs.ContentReader) bool
func (Provider) Maturity ¶ added in v0.27.0
func (Provider) Maturity() moduleapi.MaturityLevel
func (Provider) NewResolver ¶ added in v0.27.0
type StandardLibraryImport ¶
type StandardLibraryImport struct {
// contains filtered or unexported fields
}
StandardLibraryImport represents a Kotlin/Java/Android standard library import
func (StandardLibraryImport) IsWildcard ¶
func (s StandardLibraryImport) IsWildcard() bool
func (StandardLibraryImport) Package ¶
func (s StandardLibraryImport) Package() string
func (StandardLibraryImport) Path ¶
func (s StandardLibraryImport) Path() string