codegen

package
v0.0.0-...-0dbbd9f Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindStructMembers

func FindStructMembers(topLevelTypes []*types.Type) ([]*types.Type, error)

Find all the member types that need custom unpackers.

func LoadStarlarkGenTypes

func LoadStarlarkGenTypes(pkg string) (*types.Package, []*types.Type, error)

Find all top-level types with the tilt:starlark-gen=true tag.

func OpenOutputFile

func OpenOutputFile(outDir string) (w io.Writer, path string, err error)

Opens the output file.

func WritePreamble

func WritePreamble(pkg *types.Package, w io.Writer) error

Writes the package header.

func WriteStarlarkAPIObjectFunction

func WriteStarlarkAPIObjectFunction(t *types.Type, pkg *types.Package, w io.Writer) error

Given a gengo Type, create a starlark function that reads that type.

func WriteStarlarkRegistrationFunc

func WriteStarlarkRegistrationFunc(types []*types.Type, pkg *types.Package, w io.Writer) error

Writes a function that registers all the starlark methods.

func WriteStarlarkStructFunction

func WriteStarlarkStructFunction(t *types.Type, pkg *types.Package, w io.Writer) error

Given a member struct type, we need to 3 pieces: 1) A starlark type so that this struct can be passed around. 2) An Unpack() function so that this struct can be read from a dict. 3) A built-in function that constructs the object natively.

func WriteStarlarkStructListFunction

func WriteStarlarkStructListFunction(t *types.Type, pkg *types.Package, w io.Writer) error

Given a member list struct type, we need to 2 pieces: 1) A starlark type so that this struct can be passed around. 2) An Unpack() function so that this struct can be read from a list.

Types

This section is empty.

Jump to

Keyboard shortcuts

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