@@ -1049,12 +1049,16 @@ fn (mut c Checker) check_or_last_stmt(stmt ast.Stmt, ret_type ast.Type, expr_ret
1049
1049
if stmt.typ == ast.void_type {
1050
1050
if stmt.expr is ast.IfExpr {
1051
1051
for branch in stmt.expr.branches {
1052
- c.check_or_last_stmt (branch.stmts.last (), ret_type, expr_return_type)
1052
+ if branch.stmts.len > 0 {
1053
+ c.check_or_last_stmt (branch.stmts.last (), ret_type, expr_return_type)
1054
+ }
1053
1055
}
1054
1056
return
1055
1057
} else if stmt.expr is ast.MatchExpr {
1056
1058
for branch in stmt.expr.branches {
1057
- c.check_or_last_stmt (branch.stmts.last (), ret_type, expr_return_type)
1059
+ if branch.stmts.len > 0 {
1060
+ c.check_or_last_stmt (branch.stmts.last (), ret_type, expr_return_type)
1061
+ }
1058
1062
}
1059
1063
return
1060
1064
}
@@ -1090,12 +1094,16 @@ fn (mut c Checker) check_or_last_stmt(stmt ast.Stmt, ret_type ast.Type, expr_ret
1090
1094
match stmt.expr {
1091
1095
ast.IfExpr {
1092
1096
for branch in stmt.expr.branches {
1093
- c.check_or_last_stmt (branch.stmts.last (), ret_type, expr_return_type)
1097
+ if branch.stmts.len > 0 {
1098
+ c.check_or_last_stmt (branch.stmts.last (), ret_type, expr_return_type)
1099
+ }
1094
1100
}
1095
1101
}
1096
1102
ast.MatchExpr {
1097
1103
for branch in stmt.expr.branches {
1098
- c.check_or_last_stmt (branch.stmts.last (), ret_type, expr_return_type)
1104
+ if branch.stmts.len > 0 {
1105
+ c.check_or_last_stmt (branch.stmts.last (), ret_type, expr_return_type)
1106
+ }
1099
1107
}
1100
1108
}
1101
1109
else {
0 commit comments