compiler: fix a bug with type conversion in switch

It was incorrectly parsed as void call.
This commit is contained in:
Evgenii Stratonikov 2020-09-02 14:48:17 +03:00
parent 7560aa345a
commit 7d61a567d5
2 changed files with 20 additions and 0 deletions

View file

@ -108,6 +108,11 @@ func (c *funcScope) analyzeVoidCalls(node ast.Node) bool {
if ok {
c.voidCalls[ce] = false
}
case *ast.SwitchStmt:
ce, ok := n.Tag.(*ast.CallExpr)
if ok {
c.voidCalls[ce] = false
}
case *ast.CaseClause:
for _, e := range n.List {
ce, ok := e.(*ast.CallExpr)