compiler: allow to use type conversion in range

This commit is contained in:
Evgenii Stratonikov 2020-09-02 15:35:20 +03:00
parent 3af7ce8c6b
commit 74dda0ac66
2 changed files with 19 additions and 0 deletions

View file

@ -102,6 +102,11 @@ func (c *funcScope) analyzeVoidCalls(node ast.Node) bool {
}
case *ast.BinaryExpr:
return false
case *ast.RangeStmt:
ce, ok := n.X.(*ast.CallExpr)
if ok {
c.voidCalls[ce] = false
}
case *ast.IfStmt:
// we can't just return `false`, because we still need to process body
ce, ok := n.Cond.(*ast.CallExpr)