mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix use blank ident as value
This commit is contained in:
parent
9726e18c0a
commit
4e69c40e12
@ -167,6 +167,10 @@ fn (p mut Parser) name_expr() string {
|
||||
return temp_type
|
||||
}
|
||||
mut name := p.lit
|
||||
// blank identifier (not var)
|
||||
if name == '_' {
|
||||
p.error('cannot use `_` as value')
|
||||
}
|
||||
// generic type check
|
||||
if name in p.cur_fn.dispatch_of.inst.keys() {
|
||||
name = p.cur_fn.dispatch_of.inst[name]
|
||||
|
@ -1619,9 +1619,6 @@ fn (p mut Parser) get_struct_type(name_ string, is_c bool, is_ptr bool) string {
|
||||
|
||||
fn (p mut Parser) get_var_type(name string, is_ptr bool, deref_nr int) string {
|
||||
v := p.find_var_check_new_var(name) or { return "" }
|
||||
if name == '_' {
|
||||
p.error('cannot use `_` as value')
|
||||
}
|
||||
if is_ptr {
|
||||
p.gen('&')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user