mirror of
https://github.com/beego/bee.git
synced 2024-11-24 23:30:55 +00:00
fix analisys bug
This commit is contained in:
parent
ff63f454a7
commit
4305da2f3f
43
g_docs.go
43
g_docs.go
@ -156,32 +156,35 @@ func generateDocs(curpath string) {
|
|||||||
switch smtp := l.(type) {
|
switch smtp := l.(type) {
|
||||||
case *ast.AssignStmt:
|
case *ast.AssignStmt:
|
||||||
for _, l := range smtp.Rhs {
|
for _, l := range smtp.Rhs {
|
||||||
f, params := analisysNewNamespace(l.(*ast.CallExpr))
|
if v, ok := l.(*ast.CallExpr); ok {
|
||||||
globalDocsTemplate = strings.Replace(globalDocsTemplate, "{{.version}}", f, -1)
|
f, params := analisysNewNamespace(v)
|
||||||
for _, p := range params {
|
globalDocsTemplate = strings.Replace(globalDocsTemplate, "{{.version}}", f, -1)
|
||||||
switch pp := p.(type) {
|
for _, p := range params {
|
||||||
case *ast.CallExpr:
|
switch pp := p.(type) {
|
||||||
if selname := pp.Fun.(*ast.SelectorExpr).Sel.String(); selname == "NSNamespace" {
|
case *ast.CallExpr:
|
||||||
s, params := analisysNewNamespace(pp)
|
if selname := pp.Fun.(*ast.SelectorExpr).Sel.String(); selname == "NSNamespace" {
|
||||||
subapi := swagger.ApiRef{Path: s}
|
s, params := analisysNewNamespace(pp)
|
||||||
controllerName := ""
|
subapi := swagger.ApiRef{Path: s}
|
||||||
for _, sp := range params {
|
controllerName := ""
|
||||||
switch pp := sp.(type) {
|
for _, sp := range params {
|
||||||
case *ast.CallExpr:
|
switch pp := sp.(type) {
|
||||||
if pp.Fun.(*ast.SelectorExpr).Sel.String() == "NSInclude" {
|
case *ast.CallExpr:
|
||||||
controllerName = analisysNSInclude(s, pp)
|
if pp.Fun.(*ast.SelectorExpr).Sel.String() == "NSInclude" {
|
||||||
|
controllerName = analisysNSInclude(s, pp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if v, ok := controllerComments[controllerName]; ok {
|
||||||
|
subapi.Description = v
|
||||||
|
}
|
||||||
|
rootapi.Apis = append(rootapi.Apis, subapi)
|
||||||
|
} else if selname == "NSInclude" {
|
||||||
|
analisysNSInclude(f, pp)
|
||||||
}
|
}
|
||||||
if v, ok := controllerComments[controllerName]; ok {
|
|
||||||
subapi.Description = v
|
|
||||||
}
|
|
||||||
rootapi.Apis = append(rootapi.Apis, subapi)
|
|
||||||
} else if selname == "NSInclude" {
|
|
||||||
analisysNSInclude(f, pp)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user