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/if.go

29 lines
456 B

package gogen
import "go/ast"
type If struct {
Init Statement
Condition Expression
Body []Statement
}
func (me If) Statement() ast.Stmt {
var (
init ast.Stmt
)
if me.Init != nil {
init = me.Init.Statement()
}
body := make([]ast.Stmt, len(me.Body))
for j, stmt := range me.Body {
body[j] = stmt.Statement()
}
return &ast.IfStmt{
Init: init,
Cond: me.Condition.Expression(),
Body: &ast.BlockStmt{
List: body,
},
}
}