Skip to content

Commit e695fbe

Browse files
committed
improved blocking analysis on calls of func literals (mainly used with "defer")
1 parent ddcb2f6 commit e695fbe

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

compiler/analysis/info.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,15 @@ func (c *FuncInfo) Visit(node ast.Node) ast.Visitor {
180180
break
181181
}
182182
callTo(c.p.Uses[f.Sel])
183+
case *ast.FuncLit:
184+
ast.Walk(c, n.Fun)
185+
for _, arg := range n.Args {
186+
ast.Walk(c, arg)
187+
}
188+
if len(c.p.FuncLitInfos[f].Blocking) != 0 {
189+
c.markBlocking(c.analyzeStack)
190+
}
191+
return nil
183192
default:
184193
if !astutil.IsTypeExpr(f, c.p.Info) {
185194
c.markBlocking(c.analyzeStack)

0 commit comments

Comments
 (0)