Commit 44a8642a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b54a37a1
...@@ -7,6 +7,6 @@ type Header struct { ...@@ -7,6 +7,6 @@ type Header struct {
} }
type Notify struct { type Notify struct {
// Header Header
Message string Message string
} }
// TODO text what it does (generates code for pkt.go)
// +build ignore
package main package main
import ( import (
...@@ -20,7 +24,9 @@ func main() { ...@@ -20,7 +24,9 @@ func main() {
ncode := 0 ncode := 0
//ast.Print(fset, f) // ast.Print(fset, f)
// return
for _, decl := range f.Decls { for _, decl := range f.Decls {
// we look for types (which can be only under GenDecl) // we look for types (which can be only under GenDecl)
gdecl, ok := decl.(*ast.GenDecl) gdecl, ok := decl.(*ast.GenDecl)
...@@ -57,9 +63,14 @@ func main() { ...@@ -57,9 +63,14 @@ func main() {
panic(fmt.Sprintf("%#v not supported", fieldv.Type)) panic(fmt.Sprintf("%#v not supported", fieldv.Type))
} }
if len(fieldv.Names) != 0 {
for _, field := range fieldv.Names { for _, field := range fieldv.Names {
fmt.Printf("%s(%d).%s\t%s\n", tname, ncode, field.Name, ftype) fmt.Printf("%s(%d).%s\t%s\n", tname, ncode, field.Name, ftype)
} }
} else {
// no names means embedding
fmt.Printf("%s(%d).<%s>\n", tname, ncode, ftype)
}
} }
ncode++ ncode++
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment