starcgenx

package
v2.26.0-RC1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extractor

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

func NewExtractor(pkg string) *Extractor

NewExtractor returns an extractor for the given package.

func (*Extractor) Bytes

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

Bytes forwards to fmt.Fprint to the extractor buffer.

func (*Extractor) FromAsts

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

FromAsts analyses the contents of a package

func (*Extractor) Generate

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

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

func (e *Extractor) Print(s string)

Print forwards to fmt.Fprint to the extractor buffer.

func (*Extractor) Printf

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

Printf forwards to fmt.Printf to the extractor buffer.

func (*Extractor) Summary

func (e *Extractor) Summary()

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

Jump to

Keyboard shortcuts

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