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:
parent
fb1c60c53d
commit
0b8a0d1640
|
@ -1725,13 +1725,13 @@ pub fn (mut c Checker) ident(ident mut ast.Ident) table.Type {
|
||||||
if ident.is_c {
|
if ident.is_c {
|
||||||
return table.int_type
|
return table.int_type
|
||||||
}
|
}
|
||||||
|
if ident.name != '_' {
|
||||||
|
c.error('undefined: `$ident.name`', ident.pos)
|
||||||
|
}
|
||||||
if c.table.known_type(ident.name) {
|
if c.table.known_type(ident.name) {
|
||||||
// e.g. `User` in `json.decode(User, '...')`
|
// e.g. `User` in `json.decode(User, '...')`
|
||||||
return table.void_type
|
return table.void_type
|
||||||
}
|
}
|
||||||
if ident.name != '_' {
|
|
||||||
c.error('undefined: `$ident.name`', ident.pos)
|
|
||||||
}
|
|
||||||
return table.void_type
|
return table.void_type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2951,13 +2951,13 @@ fn (mut g Gen) go_stmt(node ast.GoStmt) {
|
||||||
// x := node.call_expr as ast.CallEpxr // TODO
|
// x := node.call_expr as ast.CallEpxr // TODO
|
||||||
match node.call_expr {
|
match node.call_expr {
|
||||||
ast.CallExpr {
|
ast.CallExpr {
|
||||||
mut name := it.name.replace('.', '__')
|
mut name := it.name // .replace('.', '__')
|
||||||
if it.is_method {
|
if it.is_method {
|
||||||
receiver_sym := g.table.get_type_symbol(it.receiver_type)
|
receiver_sym := g.table.get_type_symbol(it.receiver_type)
|
||||||
name = receiver_sym.name + '_' + name
|
name = receiver_sym.name + '_' + name
|
||||||
}
|
}
|
||||||
g.writeln('// go')
|
g.writeln('// go')
|
||||||
wrapper_struct_name := 'thread_arg_' + name
|
wrapper_struct_name := 'thread_arg_' + name.replace('.', '__')
|
||||||
wrapper_fn_name := name + '_thread_wrapper'
|
wrapper_fn_name := name + '_thread_wrapper'
|
||||||
arg_tmp_var := 'arg_' + tmp
|
arg_tmp_var := 'arg_' + tmp
|
||||||
g.writeln('$wrapper_struct_name *$arg_tmp_var = malloc(sizeof(thread_arg_$name));')
|
g.writeln('$wrapper_struct_name *$arg_tmp_var = malloc(sizeof(thread_arg_$name));')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user