diff options
| author | Rafael Ávila de Espíndola <[email protected]> | 2011-02-28 10:37:49 -0500 |
|---|---|---|
| committer | Rafael Ávila de Espíndola <[email protected]> | 2011-02-28 10:37:49 -0500 |
| commit | 4ac4d03f0cac829650f7a297162d070de53c6455 (patch) | |
| tree | d52a1e7aab87fcc466fa29ad2d28d0b57332dfd8 /src | |
| parent | rustc: Make the tag info table keyed by both tag ID and type parameter. Also ... (diff) | |
| download | rust-4ac4d03f0cac829650f7a297162d070de53c6455.tar.xz rust-4ac4d03f0cac829650f7a297162d070de53c6455.zip | |
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 :-)
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp/middle/trans.rs | 13 |
1 files changed, 12 insertions, 1 deletions
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)); } |