generator

package
v0.0.0-...-8e12632 Latest Latest
Warning

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

Go to latest
Published: May 24, 2018 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation interface {
	Render() string
}

Annotation is an interface.

type DelegateAnnotation

type DelegateAnnotation struct {
	AssemblyName string
	TypeName     string
	MethodName   string

	Params  []DelegateParam
	Returns []DelegateReturn

	*ast.FuncDecl
	*Input
}

DelegateAnnotation contains parameters required for generating delegate code

func (DelegateAnnotation) Render

func (d DelegateAnnotation) Render() string

Render compiles the template using the available info. TODO: avoid dup code when matching types

type DelegateParam

type DelegateParam struct {
	Name string
	Type DelegateType
}

DelegateParam contains information about a function param.

type DelegateReturn

type DelegateReturn struct {
	Name string
	Type DelegateType
}

DelegateReturn contains information about a function return value.

type DelegateType

type DelegateType int

DelegateType is used by the code generator to guess equivalent types.

const (

	// DelegateIntParam represents the int type.
	DelegateIntParam DelegateType
)

func (DelegateType) CGoWrap

func (d DelegateType) CGoWrap() (t string)

CGoWrap returns the appropriate CGO wrap.

func (DelegateType) CType

func (d DelegateType) CType() (t string)

CType returns the appropriate C type.

func (DelegateType) GoType

func (d DelegateType) GoType() (t string)

GoType returns the appropriate Golang type.

func (DelegateType) GoWrap

func (d DelegateType) GoWrap() (t string)

GoWrap returns the appropriate Go wrap.

type Generator

type Generator struct {
	PkgName string
	Input   []*Input
}

Generator generates code for interoperability between Go and .NET.

func New

func New(input []string) *Generator

New initializes a generator.

func (*Generator) Generate

func (g *Generator) Generate() (err error)

Generate performs the code generation step.

func (*Generator) Parse

func (g *Generator) Parse() (err error)

Parse iterates through every input file, calling the parse method.

func (*Generator) Verbose

func (g *Generator) Verbose(mode bool) *Generator

Verbose modifies the verbosity level.

type Input

type Input struct {
	// contains filtered or unexported fields
}

Input is a data structure used for every parsed file, contains the AST, path information and annotations.

func (*Input) Parse

func (i *Input) Parse() (err error)

Parse builds the AST and extracts information useful for the generation step.

Jump to

Keyboard shortcuts

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