cgen: fix a c2v bug with variadics
parent
5e7cf56755
commit
eaf8b63dd2
|
@ -39,6 +39,7 @@ pub mut:
|
|||
// When table.gostmts > 0, __VTHREADS__ is defined, which can be checked with `$if threads {`
|
||||
}
|
||||
|
||||
/*
|
||||
[unsafe]
|
||||
pub fn (t &Table) free() {
|
||||
unsafe {
|
||||
|
@ -58,6 +59,7 @@ pub fn (t &Table) free() {
|
|||
t.used_vweb_types.free()
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
pub type FnPanicHandler = fn (&Table, string)
|
||||
|
||||
|
|
|
@ -1227,7 +1227,12 @@ fn (mut g Gen) call_args(node ast.CallExpr) {
|
|||
}
|
||||
}
|
||||
elem_type := g.typ(arr_info.elem_type)
|
||||
if args.len > 0 && args[args.len - 1].expr is ast.ArrayDecompose {
|
||||
if g.pref.translated && args.len == 1 {
|
||||
// Handle `foo(c'str')` for `fn foo(args ...&u8)`
|
||||
// TODO handle this in a better place
|
||||
// println(g.table.type_to_str(args[0].typ))
|
||||
g.expr(args[0].expr)
|
||||
} else if args.len > 0 && args[args.len - 1].expr is ast.ArrayDecompose {
|
||||
g.expr(args[args.len - 1].expr)
|
||||
} else {
|
||||
if variadic_count > 0 {
|
||||
|
|
Loading…
Reference in New Issue