mirror of
https://github.com/vlang/v.git
synced 2025-09-16 16:02:29 +03:00
parser: add error when trying to assign from a function that does not return a value
This commit is contained in:
parent
b4e8989bd1
commit
5d16f30a3d
4 changed files with 24 additions and 12 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue