Command gencodec generates marshaling methods for Go struct types.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gencodec/vendor/github.com/garslo/gogen/function_call.go

37 lines
631 B

package gogen
import "go/ast"
type CallFunction struct {
Func Expression
Params []Expression
}
func (me CallFunction) Statement() ast.Stmt {
return &ast.ExprStmt{
X: me.Expression(),
}
}
func (me CallFunction) Expression() ast.Expr {
params := make([]ast.Expr, len(me.Params))
for i, param := range me.Params {
params[i] = param.Expression()
}
return &ast.CallExpr{
Fun: me.Func.Expression(),
Args: params,
}
}
// TODO: Bad name, change it
type Functor struct {
Func Expression
}
func (me Functor) Call(params ...Expression) CallFunction {
return CallFunction{
Func: me.Func,
Params: params,
}
}