rendering

package
v0.22.5 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BasicBool       = BasicLookup("bool")
	BasicInt        = BasicLookup("int")
	BasicInt8       = BasicLookup("int8")
	BasicInt16      = BasicLookup("int16")
	BasicInt32      = BasicLookup("int32")
	BasicInt64      = BasicLookup("int64")
	BasicUint       = BasicLookup("uint")
	BasicUint8      = BasicLookup("uint8")
	BasicUint16     = BasicLookup("uint16")
	BasicUint32     = BasicLookup("uint32")
	BasicUint64     = BasicLookup("uint64")
	BasicUintptr    = BasicLookup("uintptr")
	BasicFloat32    = BasicLookup("float32")
	BasicFloat64    = BasicLookup("float64")
	BasicComplex64  = BasicLookup("complex64")
	BasicComplex128 = BasicLookup("complex128")
	BasicString     = BasicLookup("string")
	BasicByte       = BasicLookup("byte")
	BasicRune       = BasicLookup("rune")
)

Functions

func BasicLookup

func BasicLookup(name string) types.Type

func FieldTypeName

func FieldTypeName(args []parsing.Argument, index int) string

func ParamName

func ParamName(index int) string

func TitleString

func TitleString(name string) string

func TypeName

func TypeName(t Type) string

Types

type AssignStatement

type AssignStatement struct {
	Left  Expression
	Right Expression
}

func NewAssignStatement

func NewAssignStatement(left, right Expression) AssignStatement

func (AssignStatement) Stmt

func (as AssignStatement) Stmt() ast.Stmt

type BasicType

type BasicType struct {
	Underlying types.Type
}

func (BasicType) Expr

func (bt BasicType) Expr() ast.Expr

type Call

type Call struct {
	X      Expression
	Params []Param
}

func NewCall

func NewCall(expr Expression, params ...Param) Call

func (Call) Expr

func (c Call) Expr() ast.Expr

type CallStatement

type CallStatement struct {
	Call Call
}

func NewCallStatement

func NewCallStatement(call Call) CallStatement

func (CallStatement) Stmt

func (cs CallStatement) Stmt() ast.Stmt

type Chan

type Chan struct {
	Elem Type
	Send bool
	Recv bool
}

func NewChan

func NewChan(elem Type, send, recv bool) Chan

func (Chan) Expr

func (c Chan) Expr() ast.Expr

type Context

type Context struct{}

func NewContext

func NewContext() *Context

func (*Context) Build

func (c *Context) Build(pfake parsing.Fake) File

func (*Context) BuildAssignStatement

func (c *Context) BuildAssignStatement(receiver Receiver, name string, index int, args []parsing.Argument) AssignStatement

func (*Context) BuildBody

func (c *Context) BuildBody(receiver Receiver, signature parsing.Signature) []Statement

func (*Context) BuildCallCount

func (c *Context) BuildCallCount() Field

func (*Context) BuildCallStruct

func (c *Context) BuildCallStruct(signature parsing.Signature) Field

func (*Context) BuildFakeType

func (c *Context) BuildFakeType(iface parsing.Interface) NamedType

func (*Context) BuildFunc

func (c *Context) BuildFunc(fake NamedType, signature parsing.Signature) Func

func (*Context) BuildIncrementStatement

func (c *Context) BuildIncrementStatement(receiver Receiver, name string) IncrementStatement

func (*Context) BuildMutex

func (c *Context) BuildMutex() Field

func (*Context) BuildMutexLockStatement

func (c *Context) BuildMutexLockStatement(receiver Receiver, name string) CallStatement

func (*Context) BuildMutexUnlockStatement

func (c *Context) BuildMutexUnlockStatement(receiver Receiver, name string) DeferStatement

func (*Context) BuildParams

func (c *Context) BuildParams(args []parsing.Argument, named bool) []Param

func (*Context) BuildReceives

func (c *Context) BuildReceives(args []parsing.Argument) Field

func (*Context) BuildResults

func (c *Context) BuildResults(args []parsing.Argument) []Result

func (*Context) BuildReturnStatement

func (c *Context) BuildReturnStatement(receiver Receiver, signature parsing.Signature) ReturnStatement

func (*Context) BuildReturns

func (c *Context) BuildReturns(args []parsing.Argument) Field

func (*Context) BuildStub

func (c *Context) BuildStub(signature parsing.Signature) Field

func (*Context) BuildStubIfStatement

func (c *Context) BuildStubIfStatement(receiver Receiver, signature parsing.Signature) IfStatement

type DeferStatement

type DeferStatement struct {
	Call Call
}

func NewDeferStatement

func NewDeferStatement(call Call) DeferStatement

func (DeferStatement) Stmt

func (ds DeferStatement) Stmt() ast.Stmt

type Equality

type Equality struct {
	Equal bool
	Left  Expression
	Right Expression
}

func NewEquality

func NewEquality(equal bool, left, right Expression) Equality

func (Equality) Expr

func (e Equality) Expr() ast.Expr

type Expression

type Expression interface {
	Expr() ast.Expr
}

type Field

type Field struct {
	Name string
	Type Type
}

func NewField

func NewField(name string, t Type) Field

func (Field) Expr

func (f Field) Expr() ast.Expr

func (Field) Field

func (f Field) Field() *ast.Field

func (Field) Ident

func (f Field) Ident() *ast.Ident

type File

type File struct {
	Package string
	Imports []Import
	Types   []NamedType
	Funcs   []Func
}

func NewFile

func NewFile(pkg string, imports []Import, types []NamedType, funcs []Func) File

func (File) AST

func (f File) AST() *ast.File

type Func

type Func struct {
	Name     string
	Receiver Receiver
	Params   []Param
	Results  []Result
	Body     []Statement
}

func NewFunc

func NewFunc(name string, receiver Receiver, params []Param, results []Result, body []Statement) Func

func (Func) Decl

func (f Func) Decl() ast.Decl

func (Func) Expr

func (f Func) Expr() ast.Expr

func (Func) Ident

func (f Func) Ident() *ast.Ident

type Ident

type Ident struct {
	Name string
}

func NewIdent

func NewIdent(name string) Ident

func (Ident) Expr

func (i Ident) Expr() ast.Expr

func (Ident) Ident

func (i Ident) Ident() *ast.Ident

type Identifiable

type Identifiable interface {
	Ident() *ast.Ident
}

type IfStatement

type IfStatement struct {
	Condition Expression
	Body      []Statement
}

func NewIfStatement

func NewIfStatement(condition Expression, body []Statement) IfStatement

func (IfStatement) Stmt

func (is IfStatement) Stmt() ast.Stmt

type Import

type Import struct {
	Name string
	Path string
}

func NewImport

func NewImport(name, path string) Import

func (Import) Decl

func (i Import) Decl() ast.Decl

type IncrementStatement

type IncrementStatement struct {
	X Expression
}

func NewIncrementStatement

func NewIncrementStatement(expr Expression) IncrementStatement

func (IncrementStatement) Stmt

func (is IncrementStatement) Stmt() ast.Stmt

type Interface

type Interface struct{}

func (Interface) Expr

func (i Interface) Expr() ast.Expr

type Map

type Map struct {
	Key  Type
	Elem Type
}

func NewMap

func NewMap(key, elem Type) Map

func (Map) Expr

func (m Map) Expr() ast.Expr

type NamedType

type NamedType struct {
	Name string
	Type Type
}

func NewDefinedType

func NewDefinedType(name string) NamedType

func NewNamedType

func NewNamedType(name string, t Type) NamedType

func (NamedType) Decl

func (nt NamedType) Decl() ast.Decl

func (NamedType) Expr

func (nt NamedType) Expr() ast.Expr

type Nil

type Nil struct{}

func NewNil

func NewNil() Nil

func (Nil) Expr

func (n Nil) Expr() ast.Expr

type Param

type Param struct {
	Name     string
	Type     Type
	Variadic bool
}

func NewParam

func NewParam(name string, t Type, variadic bool) Param

func (Param) Expr

func (p Param) Expr() ast.Expr

func (Param) Field

func (p Param) Field() *ast.Field

func (Param) Ident

func (p Param) Ident() *ast.Ident

type Pointer

type Pointer struct {
	Elem Type
}

func NewPointer

func NewPointer(elem Type) Pointer

func (Pointer) Expr

func (p Pointer) Expr() ast.Expr

type Receiver

type Receiver struct {
	Name string
	Type Type
}

func NewReceiver

func NewReceiver(name string, t Type) Receiver

func (Receiver) Expr

func (r Receiver) Expr() ast.Expr

func (Receiver) Field

func (r Receiver) Field() *ast.Field

func (Receiver) Ident

func (r Receiver) Ident() *ast.Ident

type Result

type Result struct {
	Type Type
}

func NewResult

func NewResult(t Type) Result

func (Result) Field

func (r Result) Field() *ast.Field

type ReturnStatement

type ReturnStatement struct {
	Results []Expression
}

func NewReturnStatement

func NewReturnStatement(results ...Expression) ReturnStatement

func (ReturnStatement) Stmt

func (rs ReturnStatement) Stmt() ast.Stmt

type Selector

type Selector struct {
	Parts []Identifiable
}

func NewSelector

func NewSelector(parts ...Identifiable) Selector

func (Selector) Expr

func (s Selector) Expr() ast.Expr

type Slice

type Slice struct {
	Elem Type
}

func NewSlice

func NewSlice(elem Type) Slice

func (Slice) Expr

func (s Slice) Expr() ast.Expr

type Statement

type Statement interface {
	Stmt() ast.Stmt
}

type Struct

type Struct struct {
	Fields []Field
}

func NewStruct

func NewStruct(fields []Field) Struct

func (Struct) Expr

func (s Struct) Expr() ast.Expr

func (Struct) FieldWithName

func (s Struct) FieldWithName(name string) Field

type Type

type Type interface {
	Expression
	// contains filtered or unexported methods
}

func NewBasicType

func NewBasicType(t types.Type) Type

func NewType

func NewType(t types.Type) Type

Jump to

Keyboard shortcuts

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