Add a more specialized decl_native_fn_and_pair. Native functions now have

the right name.
This commit is contained in:
Rafael Avila de Espindola 2011-02-16 15:34:59 -05:00
parent 293637139f
commit a63696dfe2
2 changed files with 14 additions and 1 deletions

View File

@ -507,6 +507,7 @@ TEST_XFAILS_RUSTC := $(filter-out \
linear-for-loop.rs \
multiline-comment.rs \
mutual-recursion-group.rs \
native2.rs \
obj-drop.rs \
obj-recursion.rs \
obj-with-vec.rs \

View File

@ -4062,12 +4062,24 @@ fn decl_fn_and_pair(@crate_ctxt cx,
cx.fn_pairs.insert(id, gvar);
}
fn decl_native_fn_and_pair(@crate_ctxt cx,
str name,
&ast.ann ann,
ast.def_id id) {
auto llpairty = node_type(cx, ann);
auto llfty = get_pair_fn_ty(llpairty);
let ValueRef llfn = decl_fastcall_fn(cx.llmod, name, llfty);
cx.item_ids.insert(id, llfn);
}
fn collect_native_item(&@crate_ctxt cx, @ast.native_item i) -> @crate_ctxt {
alt (i.node) {
case (ast.native_item_fn(?name, _, _, ?fid, ?ann)) {
cx.native_items.insert(fid, i);
if (! cx.obj_methods.contains_key(fid)) {
decl_fn_and_pair(cx, "fn", name, ann, fid);
decl_native_fn_and_pair(cx, name, ann, fid);
}
}
case (_) { /* fall through */ }