declaration

package
v0.2.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 1 Imported by: 0

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
	// Return makes the block a value-producing control-flow boundary. The
	// final expression must be assignable to this type, and return or Result
	// propagation exits the block rather than the enclosing method.
	Return 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
	// 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

func (*Catalog) Member

func (c *Catalog) Member(typeName, name string, class bool) (Member, bool)

func (*Catalog) Merge

func (c *Catalog) Merge(other *Catalog)

func (*Catalog) Module

func (c *Catalog) Module(name string) (*Module, bool)

func (*Catalog) Type

func (c *Catalog) Type(name string) (*Type, bool)

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
	Parameters       []Parameter
	MinimumArguments int
	MaximumArguments int
	Return           types.Type
	Fails            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 Module struct {
	Name            string
	InstanceMembers map[string]Member
}

func NewModule

func NewModule(name string) *Module

type Parameter

type Parameter struct {
	Name                 string
	Type                 types.Type
	Keyword              bool
	Optional             bool
	LiteralValues        []string
	LiteralArrays        [][]string
	LiteralArrayElements []string
}

type Signature added in v0.2.0

type Signature struct {
	Parameters []Parameter
	Return     types.Type
	Fails      types.Type
	Variadic   bool
}

type Type

type Type struct {
	Name            string
	TypeParameters  []string
	Superclass      string
	InstanceMembers map[string]Member
	ClassMembers    map[string]Member
}

func NewType

func NewType(name, superclass string) *Type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL