about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRafael Avila de Espindola <espindola@dream.(none)>2011-02-16 15:34:59 -0500
committerRafael Avila de Espindola <espindola@dream.(none)>2011-02-16 15:34:59 -0500
commita63696dfe2bd47d34925a3ad44db9d2ede949e36 (patch)
tree5b7fa9de6a7df5c3fac02ca5301fdcf82ad1a9eb
parent293637139fe55990397849badfb60c96d4211b31 (diff)
downloadrust-a63696dfe2bd47d34925a3ad44db9d2ede949e36.tar.gz
rust-a63696dfe2bd47d34925a3ad44db9d2ede949e36.zip
Add a more specialized decl_native_fn_and_pair. Native functions now have
the right name.
-rw-r--r--src/Makefile1
-rw-r--r--src/comp/middle/trans.rs14
2 files changed, 14 insertions, 1 deletions
diff --git a/src/Makefile b/src/Makefile
index 85867532302..544075faf15 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -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 \
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 282a62d6c84..94fa9f9105e 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -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 */ }