gen: fix function with multiple blank params (#8475)
parent
f992099726
commit
2945040a67
|
@ -239,7 +239,7 @@ fn (mut g Gen) fn_args(args []table.Param, is_variadic bool) ([]string, []string
|
|||
mut fargs := []string{}
|
||||
mut fargtypes := []string{}
|
||||
for i, arg in args {
|
||||
caname := c_name(arg.name)
|
||||
caname := if arg.name == '_' { g.new_tmp_var() } else { c_name(arg.name) }
|
||||
typ := g.unwrap_generic(arg.typ)
|
||||
arg_type_sym := g.table.get_type_symbol(typ)
|
||||
mut arg_type_name := g.typ(typ) // util.no_dots(arg_type_sym.name)
|
||||
|
|
|
@ -10,6 +10,20 @@ fn test_fn_with_blank_param() {
|
|||
fn_with_blank_param(321)
|
||||
}
|
||||
|
||||
fn fn_with_multiple_blank_param(_ int, _ f32) {
|
||||
_ = 'not an int nor a float'
|
||||
}
|
||||
|
||||
struct Abc {}
|
||||
|
||||
fn (_ Abc) fn_with_multiple_blank_param(_ int, _ f32) {}
|
||||
|
||||
fn test_fn_with_multiple_blank_param() {
|
||||
fn_with_multiple_blank_param(1, 1.1)
|
||||
a := Abc{}
|
||||
a.fn_with_multiple_blank_param(1, 1.1)
|
||||
}
|
||||
|
||||
fn test_for_in_range() {
|
||||
for _ in 1 .. 10 {
|
||||
assert true
|
||||
|
|
Loading…
Reference in New Issue