示例#1
0
文件: main.go 项目: serussell/kgc
func NewMethod(src string) *FuncDecl {
	fs := token.NewFileSet()
	if d, ok := parser.ParseDeclList(fs, "temp.go", src); ok == nil {
		return d[0].(*FuncDecl)
	}
	return nil
}
示例#2
0
文件: main.go 项目: serussell/kgc
func NewStruct0(src string) *GenDecl {
	fs := token.NewFileSet()
	if d, ok := parser.ParseDeclList(fs, "temp.go", src); ok == nil {
		return d[0].(*GenDecl)
	}
	return nil
}
示例#3
0
文件: main.go 项目: serussell/kgc
func NewStruct(structName string) *GenDecl {
	src := fmt.Sprintf("type %s struct{}", structName)
	fs := token.NewFileSet()
	if d, ok := parser.ParseDeclList(fs, "temp.go", src); ok == nil {
		return d[0].(*GenDecl)
	}
	return nil
}