mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: add error when trying to assign from a function that does not return a value
This commit is contained in:
committed by
Alexander Medvednikov
parent
b4e8989bd1
commit
5d16f30a3d
@@ -39,7 +39,7 @@ fn (p mut Parser) gen_blank_identifier_assign() {
|
||||
p.check_name()
|
||||
p.check_space(.assign)
|
||||
is_indexer := p.peek() == .lsbr
|
||||
is_fn_call, next_expr := p.is_next_expr_fn_call()
|
||||
is_fn_call, next_expr := p.is_expr_fn_call(p.token_idx)
|
||||
p.bool_expression()
|
||||
if !is_indexer && !is_fn_call {
|
||||
p.error_with_token_index('assigning `$next_expr` to `_` is redundant', assign_error_tok_idx)
|
||||
|
||||
Reference in New Issue
Block a user