Skip to content

Commit 94f6cdd

Browse files
committed
---
yaml --- r: 1702 b: refs/heads/master c: ebee493 h: refs/heads/master v: v3
1 parent d73271c commit 94f6cdd

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: a9ba76d52a50006763b8286168378a486a0b147d
2+
refs/heads/master: ebee49314b8a642b82e8d6d76b2398cab21bb97e

trunk/src/comp/middle/trans.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -565,12 +565,12 @@ fn type_of_fn(@crate_ctxt cx,
565565

566566
fn type_of_native_fn(@crate_ctxt cx, ast.native_abi abi,
567567
vec[ty.arg] inputs,
568-
@ty.t output) -> TypeRef {
568+
@ty.t output,
569+
uint ty_param_count) -> TypeRef {
569570
let vec[TypeRef] atys = vec();
570571
if (abi == ast.native_abi_rust) {
571572
atys += vec(T_taskptr(cx.tn));
572573
auto t = ty.ty_native_fn(abi, inputs, output);
573-
auto ty_param_count = ty.count_ty_params(plain_ty(t));
574574
auto i = 0u;
575575
while (i < ty_param_count) {
576576
atys += vec(T_ptr(T_tydesc(cx.tn)));
@@ -638,7 +638,8 @@ fn type_of_inner(@crate_ctxt cx, @ty.t t, bool boxed) -> TypeRef {
638638
llty = T_fn_pair(cx.tn, type_of_fn(cx, proto, args, out, 0u));
639639
}
640640
case (ty.ty_native_fn(?abi, ?args, ?out)) {
641-
llty = T_fn_pair(cx.tn, type_of_native_fn(cx, abi, args, out));
641+
auto nft = type_of_native_fn(cx, abi, args, out, 0u);
642+
llty = T_fn_pair(cx.tn, nft);
642643
}
643644
case (ty.ty_obj(?meths)) {
644645
auto th = mk_type_handle();
@@ -5417,17 +5418,20 @@ fn decl_native_fn_and_pair(@crate_ctxt cx,
54175418

54185419
register_fn_pair(cx, ps, wrapper_pair_type, wrapper_fn, id);
54195420

5420-
// Declare the function itself.
5421-
auto llfty = get_pair_fn_ty(node_type(cx, ann));
5422-
auto function = decl_cdecl_fn(cx.llmod, name, llfty);
5423-
54245421
// Build the wrapper.
54255422
auto fcx = new_fn_ctxt(cx, wrapper_fn);
54265423
auto bcx = new_top_block_ctxt(fcx);
5427-
auto fn_type = node_ann_type(cx, ann);
54285424

5429-
let vec[ValueRef] call_args = vec();
5425+
// Declare the function itself.
5426+
auto item = cx.native_items.get(id);
5427+
auto fn_type = node_ann_type(cx, ann); // NB: has no type params
5428+
54305429
auto abi = ty.ty_fn_abi(fn_type);
5430+
auto llfnty = type_of_native_fn(cx, abi, ty.ty_fn_args(fn_type),
5431+
ty.ty_fn_ret(fn_type), num_ty_param);
5432+
auto function = decl_cdecl_fn(cx.llmod, name, llfnty);
5433+
5434+
let vec[ValueRef] call_args = vec();
54315435
auto arg_n = 3u;
54325436
alt (abi) {
54335437
case (ast.native_abi_rust) {

0 commit comments

Comments
 (0)