1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: fix _ check

This commit is contained in:
Alexander Medvednikov 2020-05-01 12:22:39 +02:00
parent fb1c60c53d
commit 0b8a0d1640
2 changed files with 6 additions and 6 deletions

View File

@ -1725,13 +1725,13 @@ pub fn (mut c Checker) ident(ident mut ast.Ident) table.Type {
if ident.is_c {
return table.int_type
}
if ident.name != '_' {
c.error('undefined: `$ident.name`', ident.pos)
}
if c.table.known_type(ident.name) {
// e.g. `User` in `json.decode(User, '...')`
return table.void_type
}
if ident.name != '_' {
c.error('undefined: `$ident.name`', ident.pos)
}
return table.void_type
}

View File

@ -2501,7 +2501,7 @@ fn (mut g Gen) gen_map(node ast.CallExpr) {
g.out.go_back(s.len)
// println('filter s="$s"')
ret_typ := g.typ(node.return_type)
//inp_typ := g.typ(node.receiver_type)
// inp_typ := g.typ(node.receiver_type)
ret_sym := g.table.get_type_symbol(node.return_type)
inp_sym := g.table.get_type_symbol(node.receiver_type)
ret_info := ret_sym.info as table.Array
@ -2951,13 +2951,13 @@ fn (mut g Gen) go_stmt(node ast.GoStmt) {
// x := node.call_expr as ast.CallEpxr // TODO
match node.call_expr {
ast.CallExpr {
mut name := it.name.replace('.', '__')
mut name := it.name // .replace('.', '__')
if it.is_method {
receiver_sym := g.table.get_type_symbol(it.receiver_type)
name = receiver_sym.name + '_' + name
}
g.writeln('// go')
wrapper_struct_name := 'thread_arg_' + name
wrapper_struct_name := 'thread_arg_' + name.replace('.', '__')
wrapper_fn_name := name + '_thread_wrapper'
arg_tmp_var := 'arg_' + tmp
g.writeln('$wrapper_struct_name *$arg_tmp_var = malloc(sizeof(thread_arg_$name));')