From 4ac4d03f0cac829650f7a297162d070de53c6455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Mon, 28 Feb 2011 10:37:49 -0500 Subject: Update the function declarations with rust abi. A cdecl fn write(int fd, rustrt.vbuf buf, uint count) -> int; compiles to declare i32 @write(i32, i8*, i32) and a rust fn vec_buf[T](vec[T] v, uint offset) -> vbuf; compiles to declare i8* @vec_buf(%task*, %tydesc*, %"vec[]", i32) which I think is the correct declaration for both :-) --- src/comp/middle/trans.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/comp') diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index fb916f00..3564b1b3 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -513,7 +513,18 @@ fn type_of_fn(@crate_ctxt cx, fn type_of_native_fn(@crate_ctxt cx, ast.native_abi abi, vec[ty.arg] inputs, @ty.t output) -> TypeRef { - let vec[TypeRef] atys = type_of_explicit_args(cx, inputs); + let vec[TypeRef] atys = vec(); + if (abi == ast.native_abi_rust) { + atys += T_taskptr(cx.tn); + auto t = ty.ty_native_fn(abi, inputs, output); + auto ty_param_count = ty.count_ty_params(plain_ty(t)); + auto i = 0u; + while (i < ty_param_count) { + atys += T_ptr(T_tydesc(cx.tn)); + i += 1u; + } + } + atys += type_of_explicit_args(cx, inputs); ret T_fn(atys, type_of_inner(cx, output)); } -- cgit v1.2.3