ir

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package ir is the FFFI2 IDL intermediate representation: typed AST for procedures, methods, factories, enums, code-locations, and argument shapes. Built by the idl/ DSL builders and consumed by every codegen plugin in compiletime/.

Index

Constants

View Source
const DefaultStackDepth = 0

Variables

View Source
var DefaultCode = &DefaultCodeS{}
View Source
var EmptyCode = &EmptyCodeS{}
View Source
var PackageProps = packageprops.Props{
	WASMWASI:         packageprops.WASMCompiles,
	WASMJS:           packageprops.WASMCompiles,
	WASMFreestanding: packageprops.WASMCompiles,
}

PackageProps records this package's curated properties (ADR-0080). Seeded by `boxer code analysis golang wasmsurvey props generate`; curate by hand. The same group's `props verify` reconciles it.

Functions

This section is empty.

Types

type AbstractType

type AbstractType struct {
	// contains filtered or unexported fields
}

func NewAbstractType

func NewAbstractType(name naming.StylableName) AbstractType

func (AbstractType) GetName

func (inst AbstractType) GetName() naming.StylableName

func (AbstractType) ImplementedAbstractTypes

func (inst AbstractType) ImplementedAbstractTypes() iter.Seq[AbstractType]

func (AbstractType) IsAbstract

func (inst AbstractType) IsAbstract() bool

type ArgumentSpec

type ArgumentSpec struct {
	EvaluatedArguments EvaluatedArgumentSpec
	PlainArguments     PlainArgumentSpec
}

type BuilderFactoryCodeGenExprs

type BuilderFactoryCodeGenExprs struct {
	InterpreterLifetime           string
	Id                            string
	Instance                      string
	SendMessage                   string
	MarkReturn                    string
	FuncProcIdOuter               string
	FuncProcIdInner               string
	MethodProcId                  string
	EguiContext                   string
	EguiUiOptionalOuter           string
	EguiUiOptionalInner           string
	EndConsumeFrameIfNecessary    string
	InterpreterDepth              string
	InvokeInterpreterInner        string
	AtomsRegister0Transfer        string
	AtomsRegister0Reference       string
	WidgetTextRegister0Reference  string
	WidgetTextRegister0Transfer   string
	Color32Register0Transfer      string
	CodeViewJobRegister0Reference string
	CodeViewJobRegister0Transfer  string
	// StyledSections is the ADR-0130 L3 overlay channel: a parallel
	// evaluated arg whose register accumulates sparse style spans, kept
	// apart from CodeViewJob so the color-only Section wire struct the
	// read-only codeview producers share stays put.
	StyledSectionsRegister0Reference string
	StyledSectionsRegister0Transfer  string
}

type BuilderFactoryFeaturesSpec

type BuilderFactoryFeaturesSpec struct {
	Immediate     bool
	Retained      bool
	BlockIterator bool
}

type BuilderFactoryNode

type BuilderFactoryNode struct {
	Name              naming.StylableName
	IdentityArguments IdentityArgumentSpec
	Arguments         ArgumentSpec
	BuilderMethods    []Method
	Settings          BuilderFactoryFeaturesSpec
	ConstructionCode  CodeHolder
	ApplyCode         CodeHolder
	ReturnType        TypeI
	DeferredBlockMaps []DeferredBlockMapSpec
}

func (*BuilderFactoryNode) GetName

func (inst *BuilderFactoryNode) GetName() naming.StylableName

type CodeHolder

type CodeHolder struct {
	CodeClientRust VerbatimCodeI
	CodeServerGo   VerbatimCodeI
}

type CodeLocationBufferWriter

type CodeLocationBufferWriter struct {
	// contains filtered or unexported fields
}

func NewCodeLocationBufferWriter

func NewCodeLocationBufferWriter(buf []byte) *CodeLocationBufferWriter

func (*CodeLocationBufferWriter) GetStack

func (inst *CodeLocationBufferWriter) GetStack() (stack *StackCapture)

func (*CodeLocationBufferWriter) GetVerbatimCode

func (inst *CodeLocationBufferWriter) GetVerbatimCode() string

func (*CodeLocationBufferWriter) OverrideCodeLocation

func (inst *CodeLocationBufferWriter) OverrideCodeLocation(loc *StackCapture)

func (*CodeLocationBufferWriter) Reset

func (inst *CodeLocationBufferWriter) Reset()

func (*CodeLocationBufferWriter) String

func (inst *CodeLocationBufferWriter) String() string

func (*CodeLocationBufferWriter) UseDefaultCode

func (inst *CodeLocationBufferWriter) UseDefaultCode() bool

func (*CodeLocationBufferWriter) Write

func (inst *CodeLocationBufferWriter) Write(p []byte) (n int, err error)

func (*CodeLocationBufferWriter) WriteString

func (inst *CodeLocationBufferWriter) WriteString(s string) (n int, err error)

type ColorArgKindE

type ColorArgKindE uint8

ColorArgKindE marks whether an argument is to be surfaced as a unified color type in generated Go signatures. Parallel-slice entries on the argument specs carry one value per argument position; the zero value ColorArgKindNone preserves pre-ADR-0052 behaviour and is emitted for every non-annotated argument so the slice stays index-synchronous with Names and Types.

const (
	// ColorArgKindNone is the zero value: argument is not color-annotated.
	ColorArgKindNone ColorArgKindE = 0
	// ColorArgKindScalar marks a scalar color argument; Go signature surfaces
	// as color.Color regardless of which wire transport (Plain u32 or
	// Evaluated Color32) carries the value.
	ColorArgKindScalar ColorArgKindE = 1
	// ColorArgKindSlice marks a bulk color argument; Go signature surfaces as
	// color.Colors. Valid only on Plain slice (ctabb.U32h) args; ADR-0052 SD9
	// forbids retained values in arrays.
	ColorArgKindSlice ColorArgKindE = 2
)

type ConcreteType

type ConcreteType struct {
	// contains filtered or unexported fields
}

func NewConcreteType

func NewConcreteType(name naming.StylableName, implementedAbstractTypes ...AbstractType) ConcreteType

func (ConcreteType) GetName

func (inst ConcreteType) GetName() naming.StylableName

func (ConcreteType) ImplementedAbstractTypes

func (inst ConcreteType) ImplementedAbstractTypes() iter.Seq[AbstractType]

func (ConcreteType) IsAbstract

func (inst ConcreteType) IsAbstract() bool

type DefaultCodeS

type DefaultCodeS struct {
}

func (*DefaultCodeS) GetVerbatimCode

func (inst *DefaultCodeS) GetVerbatimCode() string

func (*DefaultCodeS) UseDefaultCode

func (inst *DefaultCodeS) UseDefaultCode() bool

type DeferredBlockMapSpec

type DeferredBlockMapSpec struct {
	// Name of the block map variable in the Rust apply code.
	// E.g. "cells" → available as `cells: HashMap<K, Vec<u8>>` in apply code.
	Name string

	// KeyTypes defines the composite key type for addressing blocks.
	// E.g. for a table: [U64, U32] → key is (row: u64, col: u32)
	// E.g. for a tab bar: [U32] → key is (tab_idx: u32)
	// E.g. for a plot: [U32] → key is (series_idx: u32)
	KeyTypes []canonicaltypes.PrimitiveAstNodeI
}

DeferredBlockMapSpec declares a deferred block map on an IDL node.

The code generator uses this to:

  • Go side: generate BeginDeferred/EndDeferred methods and the writer-swap + splicing logic in .Send().
  • Rust side: generate deserialization code in the apply code that reads the block map from the IPC stream into a local HashMap.

type EmptyCodeS

type EmptyCodeS struct {
}

func (*EmptyCodeS) GetVerbatimCode

func (inst *EmptyCodeS) GetVerbatimCode() string

func (*EmptyCodeS) UseDefaultCode

func (inst *EmptyCodeS) UseDefaultCode() bool

type EvaluatedArgumentSpec

type EvaluatedArgumentSpec struct {
	Names         []naming.StylableName
	AcceptedTypes []TypeI
	ColorArgKinds []ColorArgKindE
}

func (EvaluatedArgumentSpec) IsEmpty

func (inst EvaluatedArgumentSpec) IsEmpty() bool

func (EvaluatedArgumentSpec) Iterate

func (EvaluatedArgumentSpec) Len

func (inst EvaluatedArgumentSpec) Len() int

type FetcherNode

type FetcherNode struct {
	Name        naming.StylableName
	ApplyCode   CodeHolder
	ReturnTypes PlainArgumentSpec
}

func (*FetcherNode) GetName

func (inst *FetcherNode) GetName() naming.StylableName

type IdentityArgumentSpec

type IdentityArgumentSpec struct {
	HasId bool
	// IsReference marks the id as naming an existing widget rather than
	// creating a new one. Generated Go call sites take a
	// widgethandle.WidgetHandle (opaque) instead of WidgetIdCreatorI, and
	// write the resolved raw id directly without going through the
	// duplicate-id guard used by widget factories.
	IsReference bool
}

type LangE

type LangE string
const (
	LangGo   LangE = "go"
	LangRust LangE = "rust"
)

type Method

type Method struct {
	Spec       MethodSpec
	CodeHolder CodeHolder
}

type MethodSpec

type MethodSpec struct {
	Name               naming.StylableName
	PlainArguments     PlainArgumentSpec
	EvaluatedArguments EvaluatedArgumentSpec
	// UnexportedGoName emits the server-side builder method with a
	// lower-camel (unexported) Go name, so it is callable only from within
	// the bindings package. The opcode enum stays UpperCamel and the wire
	// format is unchanged. Used to hide raw wire sub-protocol methods (e.g.
	// the atoms richText/style/endRichText family) behind a hand-written
	// type-safe wrapper, making an unbalanced call a compile error rather
	// than a runtime FFI desync.
	UnexportedGoName bool
}

type NodeI

type NodeI interface {
	GetName() naming.StylableName
}

type PlainArgumentSpec

type PlainArgumentSpec struct {
	Names         []naming.StylableName
	Types         []canonicaltypes.PrimitiveAstNodeI
	ColorArgKinds []ColorArgKindE
}

func (PlainArgumentSpec) IsEmpty

func (inst PlainArgumentSpec) IsEmpty() bool

func (PlainArgumentSpec) Iterate

func (PlainArgumentSpec) Len

func (inst PlainArgumentSpec) Len() int

type ProceduralNode

type ProceduralNode struct {
	Name              naming.StylableName
	IdentityArguments IdentityArgumentSpec
	Arguments         ArgumentSpec
	Settings          ProcedureFeaturesSpec
	ApplyCode         CodeHolder
	ReturnType        TypeI
}

func (*ProceduralNode) GetName

func (inst *ProceduralNode) GetName() naming.StylableName

type ProcedureFeaturesSpec

type ProcedureFeaturesSpec struct {
	BlockIterator bool
}

type StackCapture

type StackCapture struct {
	Files []string
	Lines []int
	Funcs []string
}

func NewStackCapture

func NewStackCapture(skip int, depth int) (inst *StackCapture)

type StringVerbatimCode

type StringVerbatimCode struct {
	Default      bool
	VerbatimCode string
}

func (*StringVerbatimCode) GetVerbatimCode

func (inst *StringVerbatimCode) GetVerbatimCode() string

func (*StringVerbatimCode) UseDefaultCode

func (inst *StringVerbatimCode) UseDefaultCode() bool

type TypeI

type TypeI interface {
	IsAbstract() bool
	GetName() naming.StylableName
	ImplementedAbstractTypes() iter.Seq[AbstractType]
}

type VerbatimCodeI

type VerbatimCodeI interface {
	UseDefaultCode() bool
	GetVerbatimCode() string
}

func MergeVerbatimCode

func MergeVerbatimCode(code ...VerbatimCodeI) VerbatimCodeI

Directories

Path Synopsis
Package idl is the embedded Go DSL for declaring FFFI2 IDL definitions.
Package idl is the embedded Go DSL for declaring FFFI2 IDL definitions.

Jump to

Keyboard shortcuts

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