cgen: fix _ = ...

pull/4289/head^2
Alexander Medvednikov 2020-04-08 00:46:16 +02:00
parent 7406abe3b6
commit 2fbed2f880
3 changed files with 20 additions and 25 deletions

View File

@ -22,7 +22,6 @@ fn cerror(e string){
eprintln('\nerror: $e')
}
[inline]
fn vmod_content(name, desc string) string {
return [
'#V Project#\n',
@ -34,7 +33,6 @@ fn vmod_content(name, desc string) string {
].join('\n')
}
[inline]
fn main_content() string {
return [
'module main\n',
@ -44,7 +42,6 @@ fn main_content() string {
].join('\n')
}
[inline]
fn gen_gitignore(name string) string {
return [
'main',

View File

@ -14,7 +14,6 @@ const (
'vlib/cli/flag_test.v',
'vlib/clipboard/clipboard_test.v', // Linux only
'vlib/crypto/aes/aes_test.v',
'vlib/crypto/md5/md5_test.v',
'vlib/crypto/rand/rand_test.v',
'vlib/crypto/rc4/rc4_test.v',
'vlib/crypto/sha1/sha1_test.v',
@ -54,7 +53,6 @@ const (
'vlib/v/tests/fn_variadic_test.v',
'vlib/v/tests/live_test.v', // Linux only
'vlib/v/tests/match_test.v',
'vlib/v/tests/module_test.v',
'vlib/v/tests/msvc_test.v',
'vlib/v/tests/mut_test.v',
'vlib/v/tests/num_lit_call_method_test.v',
@ -67,7 +65,6 @@ const (
'vlib/v/tests/string_interpolation_array_of_structs_test.v',
'vlib/v/tests/string_interpolation_struct_test.v',
'vlib/v/tests/string_interpolation_variadic_test.v',
'vlib/v/tests/struct_test.v',
'vlib/v/tests/type_test.v',
'vlib/v/tests/typeof_test.v',
'vlib/v/tests/valgrind/valgrind_test.v', // ubuntu-musl only

View File

@ -1236,7 +1236,8 @@ fn (g mut Gen) assign_expr(node ast.AssignExpr) {
if is_call {
g.expr(node.val)
} else {
g.write('{${g.typ(node.left_type)} _ = ')
// g.write('{${g.typ(node.left_type)} _ = ')
g.write('{')
g.expr(node.val)
g.writeln(';}')
}
@ -2966,7 +2967,7 @@ fn (g mut Gen) gen_str_for_type(sym table.TypeSymbol, styp string) {
fn type_to_fmt(typ table.Type) string {
n := int(typ)
if n == table.string_type {
return '\'%.*s\''
return "\'%.*s\'"
} else if n == table.bool_type {
return '%.*s'
}