about summary refs log tree commit diff
path: root/src/rustc/metadata
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2012-03-21 15:42:20 +0100
committerMarijn Haverbeke <marijnh@gmail.com>2012-03-23 10:49:47 +0100
commitea2e379e4f0e53e5c7434ab7581989b101907ac5 (patch)
tree918c6a3b1776d4a3de73f16d7340a3d9008481a7 /src/rustc/metadata
parent73a0c17d77afecbf6d10b4c91531759e280e169f (diff)
downloadrust-ea2e379e4f0e53e5c7434ab7581989b101907ac5.tar.gz
rust-ea2e379e4f0e53e5c7434ab7581989b101907ac5.zip
Implement built-in native modules as an alternative to intrinsics
Issue #1981
Diffstat (limited to 'src/rustc/metadata')
-rw-r--r--src/rustc/metadata/astencode.rs6
-rw-r--r--src/rustc/metadata/encoder.rs7
2 files changed, 12 insertions, 1 deletions
diff --git a/src/rustc/metadata/astencode.rs b/src/rustc/metadata/astencode.rs
index 92ad024619e..9f9b0c986f8 100644
--- a/src/rustc/metadata/astencode.rs
+++ b/src/rustc/metadata/astencode.rs
@@ -374,6 +374,9 @@ fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item {
       ast::ii_method(d, m) {
         ast::ii_method(d, fld.fold_method(m))
       }
+      ast::ii_native(i) {
+        ast::ii_native(fld.fold_native_item(i))
+      }
     }
 }
 
@@ -398,6 +401,9 @@ fn renumber_ast(xcx: extended_decode_ctxt, ii: ast::inlined_item)
       ast::ii_method(d, m) {
         ast::ii_method(xcx.tr_def_id(d), fld.fold_method(m))
       }
+      ast::ii_native(i) {
+        ast::ii_native(fld.fold_native_item(i))
+      }
     }
 }
 
diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs
index a5c2ef30f7f..69086d4698b 100644
--- a/src/rustc/metadata/encoder.rs
+++ b/src/rustc/metadata/encoder.rs
@@ -681,7 +681,12 @@ fn encode_info_for_native_item(ecx: @encode_ctxt, ebml_w: ebml::writer,
             ebml_w.end_tag();
         }
         encode_type(ecx, ebml_w, node_id_to_type(ecx.ccx.tcx, nitem.id));
-        encode_symbol(ecx, ebml_w, nitem.id);
+        if abi == native_abi_rust_builtin {
+            astencode::encode_inlined_item(ecx, ebml_w, path,
+                                           ii_native(nitem));
+        } else {
+            encode_symbol(ecx, ebml_w, nitem.id);
+        }
         encode_path(ebml_w, path, ast_map::path_name(nitem.ident));
       }
     }