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[<P0:2>]", i32)

which I think is the correct declaration for both :-)
This commit is contained in:
Rafael Ávila de Espíndola 2011-02-28 10:37:49 -05:00
parent 0120571e90
commit 4ac4d03f0c

View file

@ -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));
}