about summary refs log tree commit diff
path: root/src/comp/syntax
diff options
context:
space:
mode:
authorHaitao Li <lihaitao@gmail.com>2011-11-14 21:06:39 +0800
committerHaitao Li <lihaitao@gmail.com>2011-11-16 23:45:07 +0800
commit3b683f52052b0cbf514c89a4da08df2b8e017fd4 (patch)
tree4c3452ea78ec5e4003743d87d8d2eb6835fd976e /src/comp/syntax
parent73cd032df5d41a48ecae080950f4b3c10ef432f9 (diff)
downloadrust-3b683f52052b0cbf514c89a4da08df2b8e017fd4.tar.gz
rust-3b683f52052b0cbf514c89a4da08df2b8e017fd4.zip
rustc: Use link_name attribute for native function
Fixes issue #906
Diffstat (limited to 'src/comp/syntax')
-rw-r--r--src/comp/syntax/ast.rs2
-rw-r--r--src/comp/syntax/fold.rs5
-rw-r--r--src/comp/syntax/parse/parser.rs4
-rw-r--r--src/comp/syntax/print/pprust.rs6
-rw-r--r--src/comp/syntax/visit.rs2
5 files changed, 6 insertions, 13 deletions
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs
index ebac944d64a..16d0d0d53c8 100644
--- a/src/comp/syntax/ast.rs
+++ b/src/comp/syntax/ast.rs
@@ -501,7 +501,7 @@ type native_item =
 
 tag native_item_ {
     native_item_ty;
-    native_item_fn(option::t<str>, fn_decl, [ty_param]);
+    native_item_fn(fn_decl, [ty_param]);
 }
 
 //
diff --git a/src/comp/syntax/fold.rs b/src/comp/syntax/fold.rs
index 126487aed98..56e6aecbab1 100644
--- a/src/comp/syntax/fold.rs
+++ b/src/comp/syntax/fold.rs
@@ -187,9 +187,8 @@ fn noop_fold_native_item(&&ni: @native_item, fld: ast_fold) -> @native_item {
           node:
               alt ni.node {
                 native_item_ty. { native_item_ty }
-                native_item_fn(st, fdec, typms) {
-                  native_item_fn(st,
-                                 {inputs: vec::map(fold_arg, fdec.inputs),
+                native_item_fn(fdec, typms) {
+                  native_item_fn({inputs: vec::map(fold_arg, fdec.inputs),
                                   output: fld.fold_ty(fdec.output),
                                   purity: fdec.purity,
                                   il: fdec.il,
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 4fa5baa7af4..bb5bf4f7faa 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -1956,13 +1956,11 @@ fn parse_item_native_fn(p: parser, attrs: [ast::attribute],
     let lo = p.get_last_lo_pos();
     let t = parse_fn_header(p);
     let decl = parse_fn_decl(p, purity, ast::il_normal);
-    let link_name = none;
-    if p.peek() == token::EQ { p.bump(); link_name = some(parse_str(p)); }
     let hi = p.get_hi_pos();
     expect(p, token::SEMI);
     ret @{ident: t.ident,
           attrs: attrs,
-          node: ast::native_item_fn(link_name, decl, t.tps),
+          node: ast::native_item_fn(decl, t.tps),
           id: p.get_id(),
           span: ast_util::mk_sp(lo, hi)};
 }
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index d45c8a8a43a..21cfaa9e072 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -350,13 +350,9 @@ fn print_native_item(s: ps, item: @ast::native_item) {
 
 
 
-      ast::native_item_fn(lname, decl, typarams) {
+      ast::native_item_fn(decl, typarams) {
         print_fn(s, decl, ast::proto_bare, item.ident, typarams,
                  decl.constraints);
-        alt lname {
-          none. { }
-          some(ss) { space(s.s); word_space(s, "="); print_string(s, ss); }
-        }
         end(s); // end head-ibox
         word(s.s, ";");
         end(s); // end the outer fn box
diff --git a/src/comp/syntax/visit.rs b/src/comp/syntax/visit.rs
index 0725611eb04..0ad6ea2fca2 100644
--- a/src/comp/syntax/visit.rs
+++ b/src/comp/syntax/visit.rs
@@ -179,7 +179,7 @@ fn visit_pat<E>(p: @pat, e: E, v: vt<E>) {
 
 fn visit_native_item<E>(ni: @native_item, e: E, v: vt<E>) {
     alt ni.node {
-      native_item_fn(_, fd, _) { visit_fn_decl(fd, e, v); }
+      native_item_fn(fd, _) { visit_fn_decl(fd, e, v); }
       native_item_ty. { }
     }
 }