Documentation
¶
Overview ¶
Package declaration defines compiler-owned type information supplied by runtime-library providers. It is deliberately independent of syntax ASTs: RBS, .d.ts, Go export data, and dynamic framework indexers can all target the same representation without making application authors maintain shadow declaration files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶ added in v0.2.0
type Block struct {
Parameters []types.Type
// ControlBoundary prevents return, break, and next from crossing a
// backend callback whose target-language ownership would otherwise differ.
// Nested functions and loops still own their local control transfers.
ControlBoundary bool
// Return makes the block value-producing. The final expression must be
// assignable to this type.
Return types.Type
// ResultBoundary makes prefix try abort this structured operation with its
// declared Result error. A value-producing block uses Return as the success
// type; a structured iteration uses the enclosing member's Result success.
// It is not an authored block parameter. Authored return is rejected until
// lexical transfer and resource cleanup share one portable contract; use try
// to abort this boundary with Err.
ResultBoundary types.Type
// Structured keeps the block in typed IR instead of lowering it to a
// backend callback. Structured blocks may be assigned or returned while
// preserving return, break, and next in their lexical owner.
Structured bool
}
type Catalog ¶
type Catalog struct {
Types map[string]*Type
Modules map[string]*Module
FunctionBlockRules []FunctionBlockRule
FunctionArgumentReferenceRules []FunctionArgumentReferenceRule
ClassBodyDeclarationRules []ClassBodyDeclarationRule
// RuntimeTypesByModule names compiler-owned value representations required
// by generated declarations in a particular application module.
RuntimeTypesByModule map[string][]types.Type
}
func NewCatalog ¶
func NewCatalog() *Catalog
type ClassBodyDeclarationRule ¶ added in v0.3.34
type ClassBodyDeclarationRule struct {
Package string
Function string
Owner DeclarationReference
}
ClassBodyDeclarationRule marks a package function call directly inside one project class as declarative metadata. The checker still validates the ordinary call signature, but backends do not execute the call at runtime. Exact owner identity keeps this capability scoped to declarations already discovered by a bundled project-aware provider.
type DeclarationReference ¶ added in v0.2.28
DeclarationReference identifies a project declaration that a provider makes visible only in one declarative call position. It does not create a source import or make the declaration generally visible in the module.
type FunctionArgumentReferenceRule ¶ added in v0.2.28
type FunctionArgumentReferenceRule struct {
Package string
Function string
Argument int
Owner DeclarationReference
Targets []DeclarationReference
}
FunctionArgumentReferenceRule describes a positional argument whose values are compiler-resolved project declarations. Language tooling uses the same provider metadata as the compiler instead of hard-coding individual DSLs.
type FunctionBlockRule ¶ added in v0.2.0
type FunctionBlockRule struct {
Package string
Function string
EnclosingSuperclass string
TypeArgument int
ParameterTypeSuffix string
}
FunctionBlockRule describes a package function whose block type is derived from one of the call arguments. Providers use this for declarative DSLs without teaching the checker package-specific syntax.
type Member ¶
type Member struct {
Name string
Kind MemberKind
Intrinsic string
// Specializer identifies a package-extension call provider. The provider
// receives resolved, serializable semantic facts and returns ordinary
// TypeRB helper source plus a narrow call replacement.
Specializer string
Parameters []Parameter
MinimumArguments int
MaximumArguments int
Return types.Type
Variadic bool
Class bool
TypeParameters []string
Provider string
Alternatives []Signature
Block *Block
}
type MemberKind ¶
type MemberKind string
const ( Method MemberKind = "method" Property MemberKind = "property" )
type Module ¶
type Parameter ¶
type Parameter struct {
Name string
Type types.Type
Keyword bool
Optional bool
// RepresentationBoundary accepts a source type when its runtime
// representation is assignable to Type. Package providers use this only at
// typed serialization or persistence boundaries; ordinary TypeRB calls keep
// nominal newtypes distinct.
RepresentationBoundary bool
LiteralValues []string
LiteralArrays [][]string
LiteralArrayElements []string
}
type Type ¶
type Type struct {
Name string
// Provider identifies the package-owned declaration provider that supplied
// this type. Built-in and project-derived declarations leave it empty.
Provider string
TypeParameters []string
Superclass string
// SourceModule identifies a provider declaration backed by a project
// source type. Outside that module, ordinary source references still need
// an explicit import even though provider members remain available after
// the type flows through another declaration.
SourceModule string
InstanceMembers map[string]Member
ClassMembers map[string]Member
}