Documentation ¶
Index ¶
- func ArrayType(p *Builder, typ reflect.Type) *ast.ArrayType
- func BinaryOp(tok token.Token, x, y ast.Expr) *ast.BinaryExpr
- func Comment(text string) *ast.CommentGroup
- func ComplexConst(v complex128) ast.Expr
- func Const(p *Builder, val interface{}) ast.Expr
- func Field(p *Builder, name string, typ reflect.Type, tag string, ellipsis bool) *ast.Field
- func FloatConst(v float64) *ast.BasicLit
- func FuncType(p *Builder, typ reflect.Type) *ast.FuncType
- func Goto(p *Builder, l *Label) *ast.BranchStmt
- func GotoIf(p *Builder, cond ast.Expr, l *Label) *ast.IfStmt
- func Ident(name string) *ast.Ident
- func ImagConst(v float64) *ast.BasicLit
- func Index(p *Builder) *ast.IndexExpr
- func IndexWith(p *Builder, idx int) *ast.IndexExpr
- func IntConst(v int64) *ast.BasicLit
- func InterfaceType(p *Builder, typ reflect.Type) *ast.InterfaceType
- func MapType(p *Builder, typ reflect.Type) *ast.MapType
- func Methods(p *Builder, typ reflect.Type) []*ast.Field
- func PtrType(p *Builder, typElem reflect.Type) ast.Expr
- func SliceIndex(p *Builder, idx int) ast.Expr
- func StringConst(v string) *ast.BasicLit
- func Type(p *Builder, typ reflect.Type) ast.Expr
- func TypeCast(p *Builder, x ast.Expr, from, to reflect.Type) *ast.CallExpr
- func UintConst(v uint64) *ast.BasicLit
- func Zero(p *Builder, typ reflect.Type) ast.Expr
- type Builder
- func (p *Builder) AddrOp(kind exec.Kind, op exec.AddrOperator) *Builder
- func (p *Builder) AddrVar(v exec.Var) *Builder
- func (p *Builder) Append(typ reflect.Type, arity int) *Builder
- func (p *Builder) BinaryOp(tok token.Token) *Builder
- func (p *Builder) BuiltinOp(kind exec.Kind, op exec.Operator) *Builder
- func (p *Builder) Call(narg int, ellipsis bool, args ...ast.Expr) *Builder
- func (p *Builder) CallFunc(fun *FuncInfo, nexpr int) *Builder
- func (p *Builder) CallFuncv(fun *FuncInfo, nexpr, arity int) *Builder
- func (p *Builder) CallGoFunc(fun exec.GoFuncAddr, nexpr int) *Builder
- func (p *Builder) CallGoFuncv(fun exec.GoFuncvAddr, nexpr, arity int) *Builder
- func (p *Builder) CaseNE(l *Label, arity int) *Builder
- func (p *Builder) Closure(fun *FuncInfo) *Builder
- func (p *Builder) Default() *Builder
- func (p *Builder) DefineFunc(fun exec.FuncInfo) *Builder
- func (p *Builder) DefineVar(vars ...exec.Var) *Builder
- func (p *Builder) EndComprehension(c *Comprehension) *Builder
- func (p *Builder) EndForPhrase(f *ForPhrase) *Builder
- func (p *Builder) EndFunc(fun *FuncInfo) *Builder
- func (p *Builder) EndStmt(stmt, start interface{}) *Builder
- func (p *Builder) FilterForPhrase(f *ForPhrase) *Builder
- func (p *Builder) ForPhrase(f *ForPhrase, key, val *Var, hasExecCtx ...bool) *Builder
- func (p *Builder) GoBuiltin(typ reflect.Type, op exec.GoBuiltin) *Builder
- func (p *Builder) GoFuncIdent(pkgPath, name string) ast.Expr
- func (p *Builder) Ident(name string) *Builder
- func (p *Builder) Import(pkgPath string) string
- func (p *Builder) InCurrentCtx(v exec.Var) bool
- func (p *Builder) Index(idx int) *Builder
- func (p *Builder) Interface() exec.Builder
- func (p *Builder) Jmp(l *Label) *Builder
- func (p *Builder) JmpIf(zeroOrOne uint32, l *Label) *Builder
- func (p *Builder) Label(l *Label) *Builder
- func (p *Builder) ListComprehension(c *Comprehension) *Builder
- func (p *Builder) Load(idx int32) *Builder
- func (p *Builder) LoadVar(v exec.Var) *Builder
- func (p *Builder) Make(typ reflect.Type, arity int) *Builder
- func (p *Builder) MakeArray(typ reflect.Type, arity int) *Builder
- func (p *Builder) MakeMap(typ reflect.Type, arity int) *Builder
- func (p *Builder) MapComprehension(c *Comprehension) *Builder
- func (p *Builder) MapIndex() *Builder
- func (p *Builder) Pop(n int) *Builder
- func (p *Builder) Push(val interface{}) *Builder
- func (p *Builder) Reserve() exec.Reserved
- func (p *Builder) ReservedAsPush(r exec.Reserved, v interface{})
- func (p *Builder) Resolve() *Code
- func (p *Builder) Return(n int32) *Builder
- func (p *Builder) SetIndex(idx int) *Builder
- func (p *Builder) SetMapIndex() *Builder
- func (p *Builder) Slice(i, j int) *Builder
- func (p *Builder) Slice3(i, j, k int) *Builder
- func (p *Builder) StartStmt(stmt interface{}) interface{}
- func (p *Builder) Store(idx int32) *Builder
- func (p *Builder) StoreVar(v exec.Var) *Builder
- func (p *Builder) TypeCast(from, to reflect.Type) *Builder
- func (p *Builder) UnaryOp(tok token.Token) *Builder
- func (p *Builder) Zero(typ reflect.Type) *Builder
- type Code
- type Comprehension
- type ForPhrase
- type FuncInfo
- func (p *FuncInfo) Args(in ...reflect.Type) exec.FuncInfo
- func (p *FuncInfo) IsUnnamedOut() bool
- func (p *FuncInfo) IsVariadic() bool
- func (p *FuncInfo) Name() string
- func (p *FuncInfo) NumOut() int
- func (p *FuncInfo) Out(i int) exec.Var
- func (p *FuncInfo) Return(out ...exec.Var) exec.FuncInfo
- func (p *FuncInfo) Type() reflect.Type
- func (p *FuncInfo) Vargs(in ...reflect.Type) exec.FuncInfo
- type Label
- type Var
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InterfaceType ¶
func InterfaceType(p *Builder, typ reflect.Type) *ast.InterfaceType
InterfaceType instr
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is a class that generates go code.
func NewBuilder ¶
NewBuilder creates a new Code Builder instance.
func (*Builder) CallGoFunc ¶
CallGoFunc instr
func (*Builder) CallGoFuncv ¶
CallGoFuncv instr
func (*Builder) DefineFunc ¶
DefineFunc instr
func (*Builder) EndComprehension ¶
func (p *Builder) EndComprehension(c *Comprehension) *Builder
EndComprehension instr
func (*Builder) EndForPhrase ¶
EndForPhrase instr
func (*Builder) FilterForPhrase ¶
FilterForPhrase instr
func (*Builder) GoFuncIdent ¶
GoFuncIdent - ast.Ident or ast.SelectorExpr
func (*Builder) InCurrentCtx ¶
InCurrentCtx returns if a variable is in current context or not.
func (*Builder) Interface ¶
func (p *Builder) Interface() exec.Builder
Interface converts *Builder to exec.Builder interface.
func (*Builder) ListComprehension ¶
func (p *Builder) ListComprehension(c *Comprehension) *Builder
ListComprehension instr
func (*Builder) MapComprehension ¶
func (p *Builder) MapComprehension(c *Comprehension) *Builder
MapComprehension instr
func (*Builder) Reserve ¶
func (p *Builder) Reserve() exec.Reserved
Reserve reserves an instruction.
func (*Builder) ReservedAsPush ¶
func (p *Builder) ReservedAsPush(r exec.Reserved, v interface{})
ReservedAsPush sets Reserved as Push(v)
func (*Builder) StartStmt ¶
func (p *Builder) StartStmt(stmt interface{}) interface{}
StartStmt recieves a `StartStmt` event.
type Code ¶
type Code struct {
// contains filtered or unexported fields
}
A Code represents generated go code.
type Comprehension ¶
Comprehension represents a list/map comprehension.
func NewComprehension ¶
func NewComprehension(out reflect.Type) *Comprehension
NewComprehension creates a new Comprehension instance.
type ForPhrase ¶
type ForPhrase struct {
Key, Value *Var // Key, Value may be nil
X, Cond ast.Expr
TypeIn reflect.Type
// contains filtered or unexported fields
}
ForPhrase represents a for range phrase.
func NewForPhrase ¶
NewForPhrase creates a new ForPhrase instance.
type FuncInfo ¶
type FuncInfo struct {
// contains filtered or unexported fields
}
FuncInfo represents a qlang function information.
func (*FuncInfo) IsUnnamedOut ¶
IsUnnamedOut returns if function results unnamed or not.
func (*FuncInfo) IsVariadic ¶
IsVariadic returns if this function is variadic or not.
func (*FuncInfo) NumOut ¶
NumOut returns a function type's output parameter count. It panics if the type's Kind is not Func.
func (*FuncInfo) Out ¶
Out returns the type of a function type's i'th output parameter. It panics if i is not in the range [0, NumOut()).
type Label ¶
type Label struct {
// contains filtered or unexported fields
}
Label represents a label.
type Var ¶
type Var struct {
// contains filtered or unexported fields
}
Var represents a variable.
func (*Var) IsUnnamedOut ¶
IsUnnamedOut returns if variable unnamed or not.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
go/format
Package format implements standard formatting of Go source.
|
Package format implements standard formatting of Go source. |
go/printer
Package printer implements printing of AST nodes.
|
Package printer implements printing of AST nodes. |