beam: Index | Files

package starcgenx

import ""

Package starcgenx is a Static Analysis Type Assertion shim and Registration Code Generator which provides an extractor to extract types from a package, in order to generate approprate shimsr a package so code can be generated for it.

It's written for use by the starcgen tool, but separate to permit alternative "go/importer" Importers for accessing types from imported packages.


Package Files


type Extractor Uses

type Extractor struct {
    Package string

    // Debug enables printing out the analysis information to the output.
    Debug bool

    // LegacyIdentifiers disables parts of the code generator analysis
    // requiring a list of identifiers to be passed in. Notably this
    // disables RegisterDoFn support.
    LegacyIdentifiers bool

    // Ids is an optional slice of package local identifiers
    Ids []string
    // contains filtered or unexported fields

Extractor contains and uniquifies the cache of types and things that need to be generated.

func NewExtractor Uses

func NewExtractor(pkg string) *Extractor

NewExtractor returns an extractor for the given package.

func (*Extractor) Bytes Uses

func (e *Extractor) Bytes() []byte

Bytes forwards to fmt.Fprint to the extractor buffer.

func (*Extractor) FromAsts Uses

func (e *Extractor) FromAsts(imp types.Importer, fset *token.FileSet, files []*ast.File) error

FromAsts analyses the contents of a package

func (*Extractor) Generate Uses

func (e *Extractor) Generate(filename string) []byte

Generate produces an additional file for the Go package that was extracted, to be included in a subsequent compilation.

func (*Extractor) NameType Uses

func (e *Extractor) NameType(t types.Type) string

NameType turns a reflect.Type into a string based on it's name. It prefixes Emit or Iter if the function satisfies the constrains of those types.

func (*Extractor) Print Uses

func (e *Extractor) Print(s string)

Print forwards to fmt.Fprint to the extractor buffer.

func (*Extractor) Printf Uses

func (e *Extractor) Printf(f string, args ...interface{})

Printf forwards to fmt.Printf to the extractor buffer.

func (*Extractor) Summary Uses

func (e *Extractor) Summary()

Summary prints out a summary of the shims and registrations to be generated to the buffer.

Package starcgenx imports 10 packages (graph) and is imported by 1 packages. Updated 2020-10-28. Refresh now. Tools for package owners.