Documentation
¶
Overview ¶
Package callgraph provides function-level call graph construction and backward tracing for linking cryptographic findings in dependencies back to user code entry points.
Index ¶
- Constants
- func BaseFunctionName(name string) string
- func EdgeResolutionKey(callerKey, calleeKey string, resolution EdgeResolution) string
- func EdgeResolutionKeyPrefix(callerKey, calleeKey string) string
- func ExternalMethodSignatureKey(id FunctionID) string
- func InferReturnTypes(graph *CallGraph, kb *contracts.KnowledgeBase) error
- type Builder
- type BytecodeIndexCache
- type CachedBytecodeIndex
- type CallChain
- type CallChainStep
- type CallGraph
- type DiskBytecodeIndexCache
- type EdgeKind
- type EdgeResolution
- type ExternalMethodSignature
- type FileAnalysis
- type FunctionCall
- type FunctionDecl
- type FunctionID
- type FunctionParameter
- type GoParser
- func (p *GoParser) PackageSeparator() string
- func (p *GoParser) ParseDirectory(dir, packagePath string) ([]*FileAnalysis, error)
- func (p *GoParser) ParseFile(filePath, packagePath string) (*FileAnalysis, error)
- func (p *GoParser) SkipDirs() map[string]bool
- func (p *GoParser) SubPackagePath(parentPath, dirName string) string
- type InferredReturn
- type JavaBytecodeTypeResolver
- type JavaParser
- type JavaPlatformSignatureMetadata
- type PackageDir
- type Parser
- type ParserOption
- type PythonParser
- type RustParser
- type SourceLocation
- type SourceNode
- type StrictResolver
- type Tracer
- type TypeRef
- type TypeResolver
Constants ¶
const ( // OriginConstructor indicates the inferred type comes directly from a // constructor call expression (new ClassName(...)). OriginConstructor = "constructor" // OriginKBDirect indicates the inferred type comes from an unconditional // KB contract match (e.g. KeyGenerator.generateKey → SecretKey). OriginKBDirect = "kb-direct" // OriginKBConditional indicates the inferred type comes from an // argument-conditional KB contract match (e.g. Cipher.unwrap with SECRET_KEY). OriginKBConditional = "kb-conditional" // OriginPropagated indicates the inferred type was propagated from a callee // that already has an inference result. OriginPropagated = "propagated" // OriginJoinFailed is an internal-only origin used for telemetry and logging. // It is set when the lattice join of multiple return-branch candidates produces // no useful common ancestor (e.g. SecretKey ∪ String). The export layer treats // this identically to a nil InferredReturn and omits the field entirely. OriginJoinFailed = "join-failed" )
Origin constants for InferredReturn.Origin. These values appear verbatim in the exported call graph JSON and in telemetry logs. OriginJoinFailed is internal-only: the export layer omits the inferred_return field entirely when the origin is join-failed.
const ( // ConfidenceHigh indicates a deterministic, single-path inference with no // ambiguity (direct constructor, direct KB hit, or unambiguous conditional). ConfidenceHigh = "high" // ConfidenceMedium indicates an inference with some ambiguity: joined // branches, single-plausible conditional match, or a propagated chain // whose root was high-confidence but traversed a join point. ConfidenceMedium = "medium" // ConfidenceLow indicates a low-confidence inference, e.g. a KB authoring // conflict where multiple unconditional contracts matched the same key. ConfidenceLow = "low" )
Confidence constants for InferredReturn.Confidence.
const ( VisibilityPublic = "public" VisibilityProtected = "protected" VisibilityPrivate = "private" VisibilityPackagePrivate = "package-private" )
Java visibility values exported in call graph metadata.
Variables ¶
This section is empty.
Functions ¶
func BaseFunctionName ¶
BaseFunctionName strips the Java/Go arity suffix and any overload decoration from a function name. For example, "encrypt#1" returns "encrypt", and "signWith#2$SignatureAlgorithm,byte[]" returns "signWith".
func EdgeResolutionKey ¶ added in v0.6.0
func EdgeResolutionKey(callerKey, calleeKey string, resolution EdgeResolution) string
EdgeResolutionKey is the stable map key for one resolved caller->callee call-site/dispatch variant.
func EdgeResolutionKeyPrefix ¶ added in v0.6.0
EdgeResolutionKeyPrefix returns the stable prefix shared by all resolution variants for one caller->callee pair.
func ExternalMethodSignatureKey ¶
func ExternalMethodSignatureKey(id FunctionID) string
ExternalMethodSignatureKey returns the stable graph key for resolver-provided method signatures. The key normalizes overload decoration down to name+arity.
func InferReturnTypes ¶
func InferReturnTypes(graph *CallGraph, kb *contracts.KnowledgeBase) error
InferReturnTypes runs the return-type inference pass over the entire call graph. It:
- Computes SCCs via Tarjan.
- Processes SCCs in reverse-topological order (callees first).
- For each SCC, iterates inferenceSCC up to inferenceMaxIterations times.
- Emits a structured telemetry log line with per-origin counts.
Error handling follows the "inference:" package prefix convention. The engine is language-agnostic: it operates only on CallGraph + KnowledgeBase.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder constructs a CallGraph from multiple packages using a language-specific parser.
func NewBuilder ¶
NewBuilder creates a new call graph builder with the given parser. An optional TypeResolver can be set via SetTypeResolver for language-native type resolution (bytecode analysis, go/types, etc.).
func (*Builder) BuildFromDirectories ¶
func (b *Builder) BuildFromDirectories(packages, typeOnlyPackages []PackageDir) (*CallGraph, error)
BuildFromDirectories analyzes source files and builds a call graph.
Two-phase approach for performance:
- packages: get full source parsing (user code + deps with findings)
- typeOnlyPackages: used only for bytecode type indexing (no source parsing), preserving type resolution accuracy for fluent chains across dependency boundaries
func (*Builder) PackageSeparator ¶
PackageSeparator exposes the parser's package separator for use by the tracer.
func (*Builder) SetTypeResolver ¶
func (b *Builder) SetTypeResolver(resolver TypeResolver)
SetTypeResolver configures the builder to use a language-specific type resolver after tree-sitter parsing. This enriches the call graph with full type information.
type BytecodeIndexCache ¶
type BytecodeIndexCache interface {
Get(ctx context.Context, key string) (*CachedBytecodeIndex, bool, error)
Put(ctx context.Context, key string, value *CachedBytecodeIndex) error
}
BytecodeIndexCache stores per-artifact bytecode indexes. Implementations can back this with disk, memory, Redis, S3, etc.
type CachedBytecodeIndex ¶
type CachedBytecodeIndex struct {
SchemaVersion int
ArtifactKey string
MethodsIndex map[string][]methodSignature
TypeHierarchy map[string][]string
}
CachedBytecodeIndex stores the derived bytecode index for a single artifact.
func (CachedBytecodeIndex) MarshalJSON ¶
func (c CachedBytecodeIndex) MarshalJSON() ([]byte, error)
MarshalJSON serializes a cached bytecode index using the stable JSON schema.
func (*CachedBytecodeIndex) UnmarshalJSON ¶
func (c *CachedBytecodeIndex) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes a cached bytecode index from the stable JSON schema.
type CallChain ¶
type CallChain struct {
// Steps is ordered from user entry point to crypto call site
Steps []CallChainStep
}
CallChain represents a traced path from user code to a crypto finding.
type CallChainStep ¶
type CallChainStep struct {
Function FunctionID
FilePath string
Line int
}
CallChainStep represents a single step in a call chain.
type CallGraph ¶
type CallGraph struct {
// Functions maps FunctionID.String() to its declaration
Functions map[string]*FunctionDecl
// Callers maps callee FunctionID.String() to list of caller FunctionID.String()
// This is the reverse index for walking backwards from a crypto finding.
Callers map[string][]string
// TypeHierarchy maps a fully qualified type name to its fully qualified parent
// interfaces/superclasses. E.g., "io.jsonwebtoken.JwtBuilder" →
// ["io.jsonwebtoken.ClaimsMutator"]. Populated by TypeResolver from bytecode.
TypeHierarchy map[string][]string
// ExternalMethodSignatures stores resolver-derived signatures for methods that
// are known to the graph by symbol but do not have a source declaration.
// Keyed by fully qualified method + arity via ExternalMethodSignatureKey.
ExternalMethodSignatures map[string][]ExternalMethodSignature
// JavaPlatformSignatures records whether Java platform signatures from the
// pinned runtime were available and used for this graph build.
JavaPlatformSignatures *JavaPlatformSignatureMetadata
// EdgeResolutions records how each caller->callee call-site/dispatch variant
// was resolved. Keyed by EdgeResolutionKey(callerKey, calleeKey, resolution).
// An edge with no entry is an exact, directly-resolved source call. Consumers
// (the graph fragment export and the mining-service stitcher) use this to
// refuse to present over-broad name/arity dispatch guesses as typed
// reachability proof.
EdgeResolutions map[string]EdgeResolution
}
CallGraph is the complete call graph across all analyzed packages.
type DiskBytecodeIndexCache ¶
type DiskBytecodeIndexCache struct {
// contains filtered or unexported fields
}
DiskBytecodeIndexCache implements BytecodeIndexCache using local JSON files.
func NewDiskBytecodeIndexCache ¶
func NewDiskBytecodeIndexCache() (*DiskBytecodeIndexCache, error)
NewDiskBytecodeIndexCache creates a bytecode cache under ~/.scanoss/crypto-finder/cache/bytecode/.
func NewDiskBytecodeIndexCacheWithDir ¶
func NewDiskBytecodeIndexCacheWithDir(dir string) (*DiskBytecodeIndexCache, error)
NewDiskBytecodeIndexCacheWithDir creates a bytecode cache at a custom directory. Useful for testing.
func (*DiskBytecodeIndexCache) Get ¶
func (c *DiskBytecodeIndexCache) Get(_ context.Context, key string) (*CachedBytecodeIndex, bool, error)
Get loads a cached bytecode index entry by key.
func (*DiskBytecodeIndexCache) Put ¶
func (c *DiskBytecodeIndexCache) Put(_ context.Context, key string, value *CachedBytecodeIndex) error
Put stores a cached bytecode index entry by key.
type EdgeKind ¶ added in v0.6.0
type EdgeKind string
EdgeKind classifies how confidently a caller->callee edge was resolved.
const ( // EdgeKindExact means the receiver's static type was known and the method // resolved to a unique declared target (or an overload on that exact type). EdgeKindExact EdgeKind = "exact" // EdgeKindInterfaceDispatch is a synthesized edge from an interface/abstract // method call site to a concrete implementation matched by name+arity within // a namespace root. EdgeKindInterfaceDispatch EdgeKind = "interface_dispatch" // EdgeKindNameOnly is a fluent-fallback edge matched by method name+arity (and // namespace heuristics) with no receiver type anchor. EdgeKindNameOnly EdgeKind = "name_only" )
type EdgeResolution ¶ added in v0.6.0
type EdgeResolution struct {
Kind EdgeKind
DeclaredType string // interface/static type for dispatch edges (e.g. "dep.Sink")
MethodName string // base method name (no arity decoration)
Arity int
CallSite int // source line of the call expression
}
EdgeResolution describes how one caller->callee edge was resolved, plus the call-site identity needed to group ambiguous dispatch siblings downstream.
type ExternalMethodSignature ¶
type ExternalMethodSignature struct {
ParameterTypes []string
ReturnType string
ParameterTypeRefs []TypeRef
ReturnTypeRef TypeRef
}
ExternalMethodSignature stores resolver-derived signature data for methods that may not have a source-backed FunctionDecl in the graph.
type FileAnalysis ¶
type FileAnalysis struct {
FilePath string
PackageName string
PackagePath string
Imports map[string]string // alias (or last path segment) -> full import path
ImportedTypes map[string]bool // imported symbol alias -> inferred class/type
WildcardImports []string // wildcard import prefixes (e.g., "java.security")
StaticWildcardImports []string // static wildcard owner types (e.g., "java.util.Collections")
Functions []FunctionDecl
}
FileAnalysis contains all extracted information from a single source file.
type FunctionCall ¶
type FunctionCall struct {
// Callee is the resolved target function
Callee FunctionID
// ReceiverVar preserves the original receiver variable name for selector calls
// like `cipher.Encrypt()` when static type information is incomplete.
ReceiverVar string
// Raw is the raw call expression text (e.g., "aes.NewCipher")
Raw string
// FilePath is the file containing this call
FilePath string
// Line is the line number of the call
Line int
// Arguments are the raw argument expressions passed in this invocation.
Arguments []string
// ArgumentSources traces where each argument value comes from.
// Parallel to Arguments — same indices. Populated by the parser's data flow analysis.
ArgumentSources [][]SourceNode
}
FunctionCall represents a call expression within a function body.
type FunctionDecl ¶
type FunctionDecl struct {
ID FunctionID
FilePath string
StartLine int
EndLine int
OwnerType string
OwnerName string
FunctionType string
ReturnType string
ReturnTypeRef TypeRef
Visibility string
OwnerVisibility string
Parameters []FunctionParameter
Calls []FunctionCall
// ReturnSources traces where return values originate; populated by parsers (v1: Java only).
ReturnSources []SourceNode
// InferredReturn is the result of the post-build inference pass; nil when no inference fires.
InferredReturn *InferredReturn
}
FunctionDecl represents a function or method declaration with its location and outgoing calls.
type FunctionID ¶
type FunctionID struct {
// Package is the full package/module path (e.g., "crypto/aes" or "javax.crypto")
Package string
// Type is the owning type for methods (Go: receiver like "*Block", Java: class like "Cipher").
// Empty for plain functions.
Type string
// Name is the function/method name (e.g., "NewCipher")
Name string
}
FunctionID uniquely identifies a function or method across packages.
func ParseFunctionID ¶
func ParseFunctionID(s string) (FunctionID, error)
ParseFunctionID parses a fully-qualified function string back into a FunctionID. It handles both plain functions ("crypto/aes.NewCipher") and methods with a type receiver ("crypto/aes.(*Block).Encrypt").
ParseFunctionID splits plain function identifiers at the last "." in the input, treating everything before that point as the package or fully-qualified class name and everything after it as the function name. Go package paths may contain "/" before that final ".", while Java package and class names use "." throughout.
func (FunctionID) String ¶
func (f FunctionID) String() string
String returns a human-readable representation of the function ID. This includes the arity suffix (e.g., "javax.crypto.(Cipher).getInstance#1").
type FunctionParameter ¶
FunctionParameter describes a declared function parameter.
type GoParser ¶
type GoParser struct {
// contains filtered or unexported fields
}
GoParser extracts function declarations, calls, and imports from Go source files using tree-sitter for fast, accurate parsing.
func NewGoParser ¶
func NewGoParser(opts ...ParserOption) *GoParser
NewGoParser creates a new Go source parser backed by tree-sitter.
func (*GoParser) PackageSeparator ¶
PackageSeparator returns "/" — Go uses forward slashes in import paths.
func (*GoParser) ParseDirectory ¶
func (p *GoParser) ParseDirectory(dir, packagePath string) ([]*FileAnalysis, error)
ParseDirectory parses all .go files in a directory.
func (*GoParser) ParseFile ¶
func (p *GoParser) ParseFile(filePath, packagePath string) (*FileAnalysis, error)
ParseFile extracts function declarations, imports, and calls from a single Go file. packagePath is the Go import path for the package containing this file.
func (*GoParser) SubPackagePath ¶
SubPackagePath constructs a child import path by appending the dir name with "/".
type InferredReturn ¶
type InferredReturn struct {
// Type is the inferred fully-qualified return type name, e.g. "javax.crypto.SecretKey".
Type string
// TypeRef is the structured generic form when applicable; zero value when none.
TypeRef TypeRef
// Confidence is the inference confidence level: "high", "medium", or "low".
Confidence string
// Origin is one of: "constructor", "kb-direct", "kb-conditional", "propagated",
// or the internal-only "join-failed" (never exported).
Origin string
// Provenance is the recursive provenance chain (subset of ReturnSources, normalised).
Provenance []SourceNode
}
InferredReturn carries the result of static return-type inference for a function. Fields mirror what the export layer surfaces, plus the internal-only join-failed origin. The join-failed origin is never emitted in exported output; when a join fails the entire field is omitted.
type JavaBytecodeTypeResolver ¶
type JavaBytecodeTypeResolver struct {
// contains filtered or unexported fields
}
JavaBytecodeTypeResolver reads compiled .class files from Maven-cached JARs to extract method signatures with full type information. This provides accurate parameter and return types without requiring a JDK or compilation.
func NewJavaBytecodeTypeResolver ¶
func NewJavaBytecodeTypeResolver(runtimeConfig javaruntime.Config) *JavaBytecodeTypeResolver
NewJavaBytecodeTypeResolver creates a resolver that reads bytecode from Maven JARs.
func (*JavaBytecodeTypeResolver) ResolveTypes ¶
func (r *JavaBytecodeTypeResolver) ResolveTypes(graph *CallGraph, sourceRoots []PackageDir) error
ResolveTypes enriches the call graph with type information from Java bytecode.
func (*JavaBytecodeTypeResolver) SetBytecodeIndexCache ¶
func (r *JavaBytecodeTypeResolver) SetBytecodeIndexCache(cache BytecodeIndexCache)
SetBytecodeIndexCache configures an optional per-artifact bytecode cache.
func (*JavaBytecodeTypeResolver) StrictFailure ¶
func (r *JavaBytecodeTypeResolver) StrictFailure() bool
StrictFailure reports whether Java runtime selection failures should fail the build.
type JavaParser ¶
type JavaParser struct {
// contains filtered or unexported fields
}
JavaParser extracts function declarations, calls, and imports from Java source files using tree-sitter for fast, accurate parsing.
func NewJavaParser ¶
func NewJavaParser(opts ...ParserOption) *JavaParser
NewJavaParser creates a new Java source parser backed by tree-sitter.
func (*JavaParser) PackageSeparator ¶
func (p *JavaParser) PackageSeparator() string
PackageSeparator returns "." — Java uses dots in package paths.
func (*JavaParser) ParseDirectory ¶
func (p *JavaParser) ParseDirectory(dir, packagePath string) ([]*FileAnalysis, error)
ParseDirectory parses all .java files in a directory.
func (*JavaParser) SkipDirs ¶
func (p *JavaParser) SkipDirs() map[string]bool
SkipDirs returns directory names to skip during Java source traversal.
func (*JavaParser) SubPackagePath ¶
func (p *JavaParser) SubPackagePath(parentPath, dirName string) string
SubPackagePath constructs a child package path using "." separator.
type JavaPlatformSignatureMetadata ¶
type JavaPlatformSignatureMetadata struct {
RequestedMajor string
RuntimeVersion string
SignaturesUsed bool
SignatureSource string
}
JavaPlatformSignatureMetadata records whether Java platform signatures from a pinned runtime were available and used during type enrichment.
type PackageDir ¶
type PackageDir struct {
Dir string // Absolute filesystem path
ImportPath string // Package/module path (e.g., "crypto/aes" or "javax.crypto")
Version string // Dependency version when applicable (e.g., "1.2.3")
CompiledArtifactPath string // Absolute path to a compiled artifact for type-only resolution
}
PackageDir associates a filesystem directory with its package/module path.
type Parser ¶
type Parser interface {
// ParseDirectory parses all relevant source files in dir.
// packagePath is the canonical namespace (Go import path, Java package, etc.).
ParseDirectory(dir string, packagePath string) ([]*FileAnalysis, error)
// SkipDirs returns directory names to skip during recursive traversal.
SkipDirs() map[string]bool
// SubPackagePath constructs a child package path from parent + directory name.
SubPackagePath(parentPath, dirName string) string
// PackageSeparator returns the separator used in package paths ("/" for Go, "." for Java).
PackageSeparator() string
}
Parser extracts function declarations, calls, and imports from source files in a language-specific way. Each supported language implements this interface.
func NewParserForEcosystem ¶
func NewParserForEcosystem(ecosystem string, opts ...ParserOption) Parser
NewParserForEcosystem returns the call graph parser for the given ecosystem. Returns nil if no parser is available for the ecosystem.
type ParserOption ¶
type ParserOption func(*parserConfig)
ParserOption customizes parser behavior for call graph construction.
func WithIncludeTests ¶
func WithIncludeTests(include bool) ParserOption
WithIncludeTests controls whether parser implementations include test files and directories.
type PythonParser ¶
type PythonParser struct {
// contains filtered or unexported fields
}
PythonParser extracts function declarations, calls, and imports from Python source files using tree-sitter for fast, accurate parsing.
func NewPythonParser ¶
func NewPythonParser(opts ...ParserOption) *PythonParser
NewPythonParser creates a new Python source parser backed by tree-sitter.
func (*PythonParser) PackageSeparator ¶
func (p *PythonParser) PackageSeparator() string
PackageSeparator returns "." — Python uses dots in module paths.
func (*PythonParser) ParseDirectory ¶
func (p *PythonParser) ParseDirectory(dir, packagePath string) ([]*FileAnalysis, error)
ParseDirectory parses all .py files in a directory.
func (*PythonParser) SkipDirs ¶
func (p *PythonParser) SkipDirs() map[string]bool
SkipDirs returns directory names to skip during Python source traversal.
func (*PythonParser) SubPackagePath ¶
func (p *PythonParser) SubPackagePath(parentPath, dirName string) string
SubPackagePath constructs a child module path using "." separator.
type RustParser ¶
type RustParser struct {
// contains filtered or unexported fields
}
RustParser extracts function declarations, calls, and imports from Rust source files using tree-sitter for fast, accurate parsing.
func NewRustParser ¶
func NewRustParser(opts ...ParserOption) *RustParser
NewRustParser creates a new Rust source parser backed by tree-sitter.
func (*RustParser) PackageSeparator ¶
func (p *RustParser) PackageSeparator() string
PackageSeparator returns "::" — Rust uses double colons in module paths.
func (*RustParser) ParseDirectory ¶
func (p *RustParser) ParseDirectory(dir, packagePath string) ([]*FileAnalysis, error)
ParseDirectory parses all .rs files in a directory.
func (*RustParser) SkipDirs ¶
func (p *RustParser) SkipDirs() map[string]bool
SkipDirs returns directory names to skip during Rust source traversal.
func (*RustParser) SubPackagePath ¶
func (p *RustParser) SubPackagePath(parentPath, dirName string) string
SubPackagePath constructs a child module path using "::" separator. In Rust, src/ is the crate root directory and does not correspond to a module — it is transparent in the module path. e.g., ring/src/aead/ maps to "ring::aead", not "ring::src::aead".
type SourceLocation ¶
SourceLocation identifies a position in source code.
type SourceNode ¶
type SourceNode struct {
// Type classifies the origin: VALUE, VARIABLE, FIELD, PARAMETER, CALL_RESULT, EXPRESSION
Type string
// Name is the variable/field/parameter name (e.g., "secret", "algorithm")
Name string
// DeclaredType is the type if known (e.g., "byte[]", "io.jsonwebtoken.SignatureAlgorithm")
DeclaredType string
// Value is the actual value for VALUE nodes (e.g., "\"AES\"", "256")
Value string
// ParameterIndex is set for PARAMETER nodes — which param (0-based)
ParameterIndex int
// CallTarget is set for CALL_RESULT nodes — the function that produced this value
CallTarget *FunctionID
// Location is where this source is defined
Location *SourceLocation
// SourceNodes traces where THIS node's value came from (recursive)
SourceNodes []SourceNode
}
SourceNode describes where a value comes from in the data flow. Nodes are recursive: each node can have its own SourceNodes showing deeper origins.
type StrictResolver ¶
type StrictResolver interface {
StrictFailure() bool
}
StrictResolver reports whether resolver failures should fail the graph build instead of being downgraded to a warning.
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer walks a CallGraph backwards from crypto findings to user entry points.
func NewTracer ¶
NewTracer creates a new backward tracer for the given call graph. pkgSep is the package path separator ("/" for Go, "." for Java).
func (*Tracer) TraceBackLimited ¶
func (t *Tracer) TraceBackLimited(target FunctionID, userPackages map[string]bool, maxDepth, maxChains int) ([]CallChain, bool)
TraceBackLimited behaves like TraceBack but can stop early after collecting maxChains complete chains. A maxChains value of 0 means unlimited.
type TypeRef ¶
TypeRef describes a type reference, optionally carrying nested generic parameters. Name holds the erased type name (e.g. "Map", "byte[]"), while GenericParameters captures parametrized type arguments recursively (e.g. Map<String, List<Foo>> → Name="Map", GenericParameters=[
{Name:"String"},
{Name:"List", GenericParameters:[{Name:"Foo"}]}]).
func (TypeRef) HasGenerics ¶
HasGenerics reports whether the TypeRef carries any generic parameters.
type TypeResolver ¶
type TypeResolver interface {
// ResolveTypes enriches function declarations and calls in the graph with
// type information that tree-sitter alone cannot provide. It receives the
// full graph and the source/artifact directories, and modifies calls in-place.
ResolveTypes(graph *CallGraph, sourceRoots []PackageDir) error
}
TypeResolver provides language-specific type resolution capabilities. Each language implements this using its best-fit approach (bytecode analysis, go/types, type stubs, LSP, etc.). The builder calls it after tree-sitter parsing to enrich the call graph with full type information.
func NewTypeResolverForEcosystem ¶
func NewTypeResolverForEcosystem(ecosystem string, javaRuntime javaruntime.Config) TypeResolver
NewTypeResolverForEcosystem returns the type resolver for the given ecosystem. Returns nil if no type resolver is available (tree-sitter-only resolution).