예제 #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
}