about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/driver/session.rs3
-rw-r--r--src/comp/front/parser.rs2
-rw-r--r--src/comp/metadata/creader.rs10
3 files changed, 6 insertions, 9 deletions
diff --git a/src/comp/driver/session.rs b/src/comp/driver/session.rs
index 30a14f45bd7..da710fd3389 100644
--- a/src/comp/driver/session.rs
+++ b/src/comp/driver/session.rs
@@ -125,6 +125,9 @@ obj session(ast::crate_num cnum,
     }
     fn has_external_crate(int num) -> bool { ret crates.contains_key(num); }
     fn add_used_library(&str lib) {
+        if (lib == "") {
+            ret;
+        }
         // A program has a small number of libraries, so a vector is probably
         // a good data structure in here.
         for (str l in used_libraries) {
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index d153f0273f8..90f8fedb6dc 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -1920,7 +1920,7 @@ fn parse_item_native_mod(&parser p, vec[ast::attribute] attrs) -> @ast::item {
         expect(p, token::EQ);
         native_name = parse_str(p);
     } else {
-        native_name = "";
+        native_name = id;
     }
     expect(p, token::LBRACE);
     auto m = parse_native_mod_items(p, native_name, abi);
diff --git a/src/comp/metadata/creader.rs b/src/comp/metadata/creader.rs
index 9772e7eb817..14118da3c5c 100644
--- a/src/comp/metadata/creader.rs
+++ b/src/comp/metadata/creader.rs
@@ -203,18 +203,12 @@ fn visit_view_item(env e, &@ast::view_item i) {
 fn visit_item(env e, &@ast::item i) {
     alt (i.node) {
         case (ast::item_native_mod(?m)) {
-            auto name;
-            if (m.native_name == "" ) {
-                name = i.ident;
-            } else {
-                name = m.native_name;
-            }
             alt (m.abi) {
                 case (ast::native_abi_rust) {
-                    e.sess.add_used_library(name);
+                    e.sess.add_used_library(m.native_name);
                 }
                 case (ast::native_abi_cdecl) {
-                    e.sess.add_used_library(name);
+                    e.sess.add_used_library(m.native_name);
                 }
                 case (ast::native_abi_llvm) {
                 }