Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
Analyzer performs semantic analysis on the AST
func (*Analyzer) ReturnCounts ¶ added in v0.0.2
func (a *Analyzer) ReturnCounts() map[ast.Expression]int
ReturnCounts returns the inferred return counts for expressions. Call after Analyze() to pass these to codegen.
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope represents a lexical scope
type Symbol ¶
type Symbol struct {
Name string
Kind SymbolKind
Type *TypeInfo
Defined ast.Position
Mutable bool
Exported bool
}
Symbol represents a symbol in the symbol table
type SymbolKind ¶
type SymbolKind int
SymbolKind represents the kind of symbol
const ( SymbolVariable SymbolKind = iota SymbolParameter SymbolFunction SymbolType SymbolInterface )
func (SymbolKind) String ¶
func (sk SymbolKind) String() string
type SymbolTable ¶
type SymbolTable struct {
// contains filtered or unexported fields
}
SymbolTable manages scopes and symbols
func (*SymbolTable) CurrentScope ¶
func (st *SymbolTable) CurrentScope() *Scope
CurrentScope returns the current scope
func (*SymbolTable) Define ¶
func (st *SymbolTable) Define(symbol *Symbol) error
Define adds a symbol to the current scope
func (*SymbolTable) ExitScope ¶
func (st *SymbolTable) ExitScope()
ExitScope removes the current scope
func (*SymbolTable) Resolve ¶
func (st *SymbolTable) Resolve(name string) *Symbol
Resolve looks up a symbol
type TypeInfo ¶
type TypeInfo struct {
Kind TypeKind
Name string // For named types and placeholders
ElementType *TypeInfo // For lists, channels, references
KeyType *TypeInfo // For maps
ValueType *TypeInfo // For maps
Params []*TypeInfo // For functions
Returns []*TypeInfo // For functions
Constraint string // For placeholders: "any", "comparable", "cmp.Ordered"
Variadic bool // For functions: true if last param is variadic
ParamNames []string // For functions: parameter names (for named argument validation)
DefaultCount int // For functions: number of parameters with default values
}
TypeInfo represents type information
Click to show internal directories.
Click to hide internal directories.