Documentation
¶
Overview ¶
Package ir defines the resolved, target-independent representation consumed by every backend. Unlike syntax AST nodes, IR expressions carry semantic types and declarations contain normalized names.
Index ¶
- type Array
- type Assignment
- type Attribute
- type Base
- type Binary
- type Block
- type Break
- type Call
- type CallArgument
- type Case
- type CaseBinding
- type CaseBranch
- type Class
- type CodecField
- type CodecSchema
- type Comment
- type Enum
- type EnumConstruct
- type EnumMember
- type ExprBase
- type Expression
- type ExpressionStatement
- type Field
- type Hash
- type HashEntry
- type Identifier
- type If
- type IfBranch
- type Import
- type Index
- type Interface
- type InterpolatedString
- type Iterate
- type Literal
- type Member
- type Method
- type Module
- type Native
- type NativeBlock
- type NativeExpression
- type Next
- type Parameter
- type Program
- type Range
- type Record
- type RecordField
- type Reference
- type Return
- type Statement
- type StringPart
- type Symbol
- type Transform
- type TypeApply
- type Unary
- type Variable
- type While
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array struct {
ExprBase
Elements []Expression
}
type Assignment ¶
type Assignment struct {
Base
Target Expression
Operator string
Value Expression
}
type Attribute ¶
type Attribute struct {
Name string
Arguments []CallArgument
}
type Binary ¶
type Binary struct {
ExprBase
Left Expression
Operator string
Right Expression
}
type Call ¶
type Call struct {
ExprBase
Callee Expression
Arguments []CallArgument
Block *Block
Codec *CodecSchema
}
type CallArgument ¶
type CallArgument struct {
Name string
Value Expression
Splat string
}
type Case ¶
type Case struct {
Base
Value Expression
Leading []Statement
Branches []CaseBranch
Else []Statement
HasElse bool
}
type CaseBranch ¶
type CaseBranch struct {
Base
Value Expression
EnumName string
Member string
Bindings []CaseBinding
PayloadEnum bool
Body []Statement
}
type Class ¶
type Class struct {
Base
Name string
Superclass Expression
Implements []string
Body []Statement
}
type CodecField ¶
type CodecField struct {
Name string
WireName string
Schema *CodecSchema
}
type CodecSchema ¶
type CodecSchema struct {
Type types.Type
Kind string
Module string
Reference *Reference
Element *CodecSchema
Fields []CodecField
}
CodecSchema is the checked, target-independent shape used by typed JSON encode/decode intrinsics. Backends consume this schema instead of reflecting over a generated target type.
type EnumConstruct ¶
type EnumConstruct struct {
ExprBase
EnumName string
Member string
TypeArguments []types.Type
Arguments []Expression
Reference *Reference
}
EnumConstruct preserves nominal variant construction through lowering. It must not become an ordinary call because every backend uses a different runtime representation for payload enums.
type EnumMember ¶
type Expression ¶
type ExpressionStatement ¶
type ExpressionStatement struct {
Base
Expression Expression
}
type HashEntry ¶
type HashEntry struct {
Key Expression
Value Expression
}
type If ¶
type If struct {
Base
Condition Expression
Then []Statement
ElseIf []IfBranch
Else []Statement
}
type IfBranch ¶
type IfBranch struct {
Condition Expression
Body []Statement
}
type Import ¶
type Import struct {
Base
Path string
Symbols []string
Alias string
Namespace bool
Kind string
Standard bool
Platform bool
Runtime bool
// IntrinsicSymbols are resolved at compile time and have no corresponding
// runtime export in a compiler-owned source module.
IntrinsicSymbols map[string]bool
// SymbolKinds distinguishes value records from reference classes in
// backends whose representation makes that distinction explicit.
SymbolKinds map[string]string
}
type Index ¶
type Index struct {
ExprBase
Receiver Expression
Index Expression
}
type InterpolatedString ¶
type InterpolatedString struct {
ExprBase
Raw string
Parts []StringPart
}
type Iterate ¶
type Iterate struct {
Base
Source Expression
Operation string
SliceSize Expression
WithIndex bool
Item string
Index string
ItemType types.Type
Body []Statement
}
Iterate is a structured loop rather than a callback invocation. Backends can therefore preserve TypeRB control-flow semantics inside an each block.
type NativeExpression ¶
type Range ¶
type Range struct {
ExprBase
Start Expression
End Expression
Exclusive bool
}
type RecordField ¶
type Reference ¶
type Reference struct {
Package string
Alias string
Symbol string
ExportKind string
Intrinsic string
ReceiverMethod bool
}
Reference identifies a symbol resolved from an import or the portable prelude. Intrinsic is non-empty for compiler-known standard/platform calls; project references use Package, Alias, Symbol, and ExportKind for target-specific qualification.
type Return ¶
type Return struct {
Base
Value Expression
}
type StringPart ¶
type StringPart struct {
Text string
Expression Expression
}
type Transform ¶
type Transform struct {
ExprBase
Source Expression
Operation string
Initial Expression
WithIndex bool
Item string
Index string
Accumulator string
ItemType types.Type
Body []Statement
Result Expression
}
Transform is a value-producing collection operation. It is distinct from a target callback so checker-derived item/result types and block semantics are retained until backend lowering.
type Unary ¶
type Unary struct {
ExprBase
Operator string
Operand Expression
}
type While ¶
type While struct {
Base
Condition Expression
Body []Statement
}