1
0
mirror of https://github.com/beego/bee.git synced 2024-11-22 05:00:54 +00:00

v.Fun can't always be converted to *ast.SelectorExpr. Added a check to confirm that the object is correct.

This commit is contained in:
Louise van der Lith 2018-01-09 10:49:57 +02:00
parent e90da8f77b
commit 4f53288e6a

View File

@ -261,8 +261,9 @@ func GenerateDocs(curpath string) {
case *ast.AssignStmt: case *ast.AssignStmt:
for _, l := range stmt.Rhs { for _, l := range stmt.Rhs {
if v, ok := l.(*ast.CallExpr); ok { if v, ok := l.(*ast.CallExpr); ok {
// Analyse NewNamespace, it will return version and the subfunction // Analyze NewNamespace, it will return version and the subfunction
if selName := v.Fun.(*ast.SelectorExpr).Sel.String(); selName != "NewNamespace" { selExpr, selOK := v.Fun.(*ast.SelectorExpr)
if !selOK || selExpr.Sel.Name != "NewNamespace" {
continue continue
} }
version, params := analyseNewNamespace(v) version, params := analyseNewNamespace(v)