mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: minor cleanup in find_unreachable_statements_after_noreturn_calls() (#13903)
This commit is contained in:
parent
8c55a9ecd3
commit
0497b885dc
@ -158,8 +158,7 @@ pub fn (mut c Checker) return_stmt(mut node ast.Return) {
|
||||
pub fn (mut c Checker) find_unreachable_statements_after_noreturn_calls(stmts []ast.Stmt) {
|
||||
mut prev_stmt_was_noreturn_call := false
|
||||
for stmt in stmts {
|
||||
match stmt {
|
||||
ast.ExprStmt {
|
||||
if stmt is ast.ExprStmt {
|
||||
if stmt.expr is ast.CallExpr {
|
||||
if prev_stmt_was_noreturn_call {
|
||||
c.error('unreachable code after a [noreturn] call', stmt.pos)
|
||||
@ -167,12 +166,10 @@ pub fn (mut c Checker) find_unreachable_statements_after_noreturn_calls(stmts []
|
||||
}
|
||||
prev_stmt_was_noreturn_call = stmt.expr.is_noreturn
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
prev_stmt_was_noreturn_call = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Note: has_top_return/1 should be called on *already checked* stmts,
|
||||
|
Loading…
Reference in New Issue
Block a user