Documentation
¶
Overview ¶
Package resolver turns syntax imports into project or compiler-known package identities before type checking. Backends therefore never interpret a raw TypeRB import path on their own.
Index ¶
- func CollectExports(statements []ast.Statement) map[string]Export
- func ValidateImportGraph(catalog *Catalog, results map[string]Result) map[string][]diagnostic.Diagnostic
- type Binding
- type Catalog
- type EnumVariant
- type Export
- type ExportKind
- type Import
- type ImportKind
- type Member
- type Module
- type Options
- type RecordField
- type Result
- func (r Result) CompilerOwnedType(name string) (Export, bool)
- func (r Result) ImportedType(typeName string) (Binding, bool)
- func (r Result) Member(alias, name string) (Binding, bool)
- func (r Result) ReceiverMethod(receiver types.Type, name string) (Binding, bool)
- func (r Result) TypeMember(typeName, name string) (Binding, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateImportGraph ¶
func ValidateImportGraph(catalog *Catalog, results map[string]Result) map[string][]diagnostic.Diagnostic
ValidateImportGraph rejects project import cycles with a deterministic path. A single cross-mode rule keeps initialization order independent of Ruby, TypeScript, or Go runtime loader behavior.
Types ¶
type Binding ¶
type Catalog ¶
func NewCatalog ¶
func NewCatalog(modules []Module) (*Catalog, map[string][]diagnostic.Diagnostic)
type EnumVariant ¶
type EnumVariant struct {
Name string
Fields []RecordField
}
type ExportKind ¶
type ExportKind string
const ( ClassExport ExportKind = "class" RecordExport ExportKind = "record" EnumExport ExportKind = "enum" ModuleExport ExportKind = "module" InterfaceExport ExportKind = "interface" FunctionExport ExportKind = "function" ValueExport ExportKind = "value" )
type Import ¶
type Import struct {
Node *ast.ImportStatement
Kind ImportKind
Path string
ModulePath string
Alias string
Symbols []string
Definition *stdlib.Package
Exports map[string]Export
Filename string
}
func (*Import) RuntimePath ¶
type ImportKind ¶
type ImportKind string
const ( StandardImport ImportKind = "standard" OfficialImport ImportKind = "official" ProjectImport ImportKind = "project" )
type Result ¶
type Result struct {
Imports map[*ast.ImportStatement]*Import
Packages map[string]*Import
Symbols map[string]Binding
NativeSyntax bool
Declarations *declaration.Catalog
Catalog *Catalog
}
func Resolve ¶
func Resolve(program *ast.Program, options Options) (Result, []diagnostic.Diagnostic)
func (Result) CompilerOwnedType ¶ added in v0.1.9
CompilerOwnedType returns declarations that were inferred from a portable library result. It supports member checking on inferred values without making the type name available to source annotations that omitted an import.
func (Result) ReceiverMethod ¶
ReceiverMethod returns an implicit portable method binding. The binding is deliberately backed by the same standard package definition as its function form, even though TypeRB source does not need to import the method.