irb

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package irb keeps track of IRs being built and how to add them to the package declarations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder[T any] struct {
	// contains filtered or unexported fields
}

Builder are IR nodes already built as well as their declarators.

func New

func New[T any](scope T, pkg *ir.Package) *Builder[T]

New returns a new

func (*Builder[T]) Build

func (ibld *Builder[T]) Build(bld Node[T]) (ir.Node, bool)

Build an IR node or returns the node if it has already been built.

func (*Builder[T]) Cache

func (ibld *Builder[T]) Cache(bld Node[T]) (ir.Node, bool)

Cache return the IR of a node that has already been built.

func (*Builder[T]) Decls

func (ibld *Builder[T]) Decls() *ir.Declarations

Decls returns the IR declarations of everything that has been declared until this point.

func (*Builder[T]) Pkg

func (ibld *Builder[T]) Pkg() *ir.Package

Pkg returns the IR package.

func (*Builder[T]) Register

func (ibld *Builder[T]) Register(decl Declarator)

Register appends a declarator to declare a node in the package declarations.

func (*Builder[T]) Scope

func (ibld *Builder[T]) Scope() T

Scope returns the root scope used to build the IR nodes.

func (*Builder[T]) Set

func (ibld *Builder[T]) Set(bld Node[T], n ir.Node)

Set the IR of a given builder node.

type Declarator

type Declarator func(*ir.Declarations)

Declarator declares a node in the IR package declarations.

type Node

type Node[T any] interface {
	Build(*Builder[T]) (ir.Node, bool)
}

Node builds an IR node.

type NodeF

type NodeF[T any] func(*Builder[T]) (ir.Node, bool)

NodeF builds a node.

func (NodeF[T]) Build

func (f NodeF[T]) Build(ibld *Builder[T]) (ir.Node, bool)

Build the node.

Jump to

Keyboard shortcuts

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