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 ¶
- func AnonConsts(members []view.EnumMember) ([]byte, error)
- func AsyncMethod(m view.AsyncMethod) ([]byte, error)
- func BoolNSErrorMethod(m view.BoolNSErrorMethod) ([]byte, error)
- func ByteArrayStructs(structs []view.ByteArrayStruct) ([]byte, error)
- func Constants(constants []view.Constant) ([]byte, error)
- func Delegate(d view.Delegate) ([]byte, error)
- func Enums(enums []view.Enum) ([]byte, error)
- func Execute(w io.Writer, name string, data any) error
- func Funcs(funcs []view.Func) ([]byte, error)
- func HandleTypes(handles []view.HandleType) ([]byte, error)
- func Method(m view.Method) ([]byte, error)
- func Must(w io.Writer, name string, data any)
- func Protocols(protocols []view.Protocol) ([]byte, error)
- func Sentinels(sentinels []view.ErrorSentinel) ([]byte, error)
- func SliceMethod(m view.SliceMethod) ([]byte, error)
- func Structs(structs []view.Struct) ([]byte, error)
- func TypedefAliases(aliases []view.TypedefAlias) ([]byte, error)
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 ¶
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
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 ¶
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 ¶
Execute runs a template by name against the single embedded template set shared with the typed renderers.
func Funcs ¶
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 ¶
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 ¶
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
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 ¶
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.