18 строки
296 Б
Go
18 строки
296 Б
Go
package service
|
|
|
|
import (
|
|
"go/ast"
|
|
)
|
|
|
|
func handleDecl(id int, decl ast.Decl, dst chan<- string, done chan<- bool) {
|
|
code := ""
|
|
switch d := decl.(type) {
|
|
case *ast.FuncDecl:
|
|
code += handleFuncDecl(d)
|
|
case *ast.GenDecl:
|
|
code += handleGenDecl(d)
|
|
}
|
|
dst <- code
|
|
close(dst)
|
|
done <- true
|
|
}
|