render

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package render: name-based execution for the construct emitters that render an ad-hoc view by template name rather than through a typed Render* function.

Package render turns a fully-resolved view (the IR built by the gather phase) into Go source. It does so through templates only: render makes no resolution decisions and imports no metadata or type-mapping packages — every value it needs is already present on the view. Its FuncMap holds pure formatting helpers, never type logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnonConsts added in v0.17.0

func AnonConsts(members []view.EnumMember) ([]byte, error)

AnonConsts renders anonymous-enum members as one untyped const block (e.g. `const ( KAEISHandleCGI = 1935961955 )`), matching the raw layer's treatment of enums the C headers declare without a tag name.

func AsyncMethod

func AsyncMethod(m view.AsyncMethod) ([]byte, error)

AsyncMethod renders a completion-handler method as a blocking, ctx-aware call.

func BoolNSErrorMethod

func BoolNSErrorMethod(m view.BoolNSErrorMethod) ([]byte, error)

BoolNSErrorMethod renders a BOOL+NSError method as an error-returning method.

func ByteArrayStructs added in v0.18.0

func ByteArrayStructs(structs []view.ByteArrayStruct) ([]byte, error)

ByteArrayStructs renders byte-array backing structs (`type X struct{ data [N]byte }`) plus their typed accessor methods for a package.

func Constants

func Constants(constants []view.Constant) ([]byte, error)

Constants renders the global-constant accessor functions for a package as a Go source fragment (before file assembly and gofmt).

func Delegate added in v0.16.0

func Delegate(d view.Delegate) ([]byte, error)

Delegate renders one delegate protocol — the Go interface, the optional upgrade interfaces, and the shim builder — as a Go source fragment (before file assembly and gofmt).

func Enums

func Enums(enums []view.Enum) ([]byte, error)

Enums renders the concrete enum definitions for a package as a Go source fragment (a package body, before file assembly and gofmt). Each enum becomes a `type X <underlying>` declaration with a typed const block and a String method.

func Execute

func Execute(w io.Writer, name string, data any) error

Execute runs a template by name against the single embedded template set shared with the typed renderers.

func Funcs

func Funcs(funcs []view.Func) ([]byte, error)

Funcs renders the C-function wrappers for a package as a Go source fragment (before file assembly and gofmt).

func HandleTypes added in v0.18.0

func HandleTypes(handles []view.HandleType) ([]byte, error)

HandleTypes renders distinct named handle types (`type CFArrayRef struct{ obj.Object }` plus an IsNil method) for a package as a Go source fragment.

func Method

func Method(m view.Method) ([]byte, error)

Method renders one Go method (or package-level function) — signature, doc, and body — from a resolved view.Method. The body comes from the method's Dispatch, so no Go syntax is assembled by string concatenation in the caller.

func Must

func Must(w io.Writer, name string, data any)

Must is Execute, panicking on error — a template failure here is a codegen bug (bad view model or template). Output still flows through gofmt, which catches any malformed Go.

func Protocols added in v0.17.0

func Protocols(protocols []view.Protocol) ([]byte, error)

Protocols renders ObjC protocols as Go interfaces for a package as a Go source fragment (a package body, before file assembly and gofmt).

func Sentinels

func Sentinels(sentinels []view.ErrorSentinel) ([]byte, error)

Sentinels renders the error-sentinel variable declarations for a package as a Go source fragment (before file assembly and gofmt).

func SliceMethod

func SliceMethod(m view.SliceMethod) ([]byte, error)

SliceMethod renders an array-returning getter as a slice-returning method.

func Structs

func Structs(structs []view.Struct) ([]byte, error)

Structs renders the value-struct definitions for a package as a Go source fragment (a package body, before file assembly and gofmt).

func TypedefAliases added in v0.17.0

func TypedefAliases(aliases []view.TypedefAlias) ([]byte, error)

TypedefAliases renders C-typedef Go type aliases (e.g. NSRect = CGRect) for a package as a Go source fragment (a package body, before file assembly and gofmt).

Types

This section is empty.

Jump to

Keyboard shortcuts

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