Documentation
¶
Overview ¶
Package module implements module loading and dependency resolution for AILANG.
Package module provides path resolution utilities for AILANG modules.
Index ¶
- type Loader
- type Module
- type ModuleError
- type Resolver
- func (r *Resolver) GetModuleIdentity(filePath string) (string, error)
- func (r *Resolver) GetResolutionOrder(importPath, currentFile string) []string
- func (r *Resolver) NormalizePath(path string) (string, error)
- func (r *Resolver) ResolveImport(importPath string, currentFile string) (string, error)
- func (r *Resolver) ValidateModuleName(declaredName, filePath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader handles module loading and dependency resolution
func (*Loader) DumpModules ¶
Writer interface for dumping module information
func (*Loader) GetDependencyGraph ¶
GetDependencyGraph returns the full dependency graph
func (*Loader) TopologicalSort ¶
TopologicalSort returns modules in dependency order
type Module ¶
type Module struct {
// Identity is the canonical module path (e.g., "std/list", "data/tree")
Identity string
// FilePath is the absolute path to the module file
FilePath string
// AST is the parsed module AST
AST *ast.Module
// Program is the full parsed program including the module
Program *ast.Program
// Dependencies are the modules this module imports
Dependencies []string
// Exports are the symbols exported by this module
Exports map[string]ast.Node
}
Module represents a parsed AILANG module
type ModuleError ¶
type ModuleError struct {
Code string // Error code (e.g., LDR001)
Message string // Human-readable message
Path string // Module path that caused the error
Cycle []string // For circular dependencies
Trace []string // Resolution trace
Cause error // Underlying error
}
ModuleError represents a module loading error with structured information
func (*ModuleError) Error ¶
func (e *ModuleError) Error() string
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver handles module path resolution with platform-specific normalization
func (*Resolver) GetModuleIdentity ¶
GetModuleIdentity derives a module identity from a file path
func (*Resolver) GetResolutionOrder ¶
GetResolutionOrder returns the order in which paths will be searched
func (*Resolver) NormalizePath ¶
NormalizePath normalizes a file path for the current platform
func (*Resolver) ResolveImport ¶
ResolveImport resolves an import path to a file path
func (*Resolver) ValidateModuleName ¶
ValidateModuleName checks if a module name matches its expected name based on file path