From 0397c05f429937e07d4cd39e97e8a9413336cd98 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Fri, 1 Apr 2011 17:04:51 -0700 Subject: [PATCH] Support for passing native types through metadata/creader. --- src/comp/front/creader.rs | 2 ++ src/comp/middle/trans.rs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/comp/front/creader.rs b/src/comp/front/creader.rs index 151411c6bca..0faceb6ecb0 100644 --- a/src/comp/front/creader.rs +++ b/src/comp/front/creader.rs @@ -524,6 +524,7 @@ fn kind_has_type_params(u8 kind_ch) -> bool { else if (kind_ch == ('y' as u8)) { ret true; } else if (kind_ch == ('o' as u8)) { ret true; } else if (kind_ch == ('t' as u8)) { ret true; } + else if (kind_ch == ('T' as u8)) { ret false; } else if (kind_ch == ('m' as u8)) { ret false; } else if (kind_ch == ('n' as u8)) { ret false; } else if (kind_ch == ('v' as u8)) { ret true; } @@ -561,6 +562,7 @@ fn lookup_def(session.session sess, int cnum, vec[ast.ident] path) else if (kind_ch == ('F' as u8)) { def = ast.def_native_fn(did); } else if (kind_ch == ('y' as u8)) { def = ast.def_ty(did); } else if (kind_ch == ('o' as u8)) { def = ast.def_obj(did); } + else if (kind_ch == ('T' as u8)) { def = ast.def_native_ty(did); } else if (kind_ch == ('t' as u8)) { // We treat references to tags as references to types. def = ast.def_ty(did); diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index e9695b3508a..b9ebc167dff 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -6211,7 +6211,9 @@ fn collect_native_item(&@crate_ctxt cx, @ast.native_item i) -> @crate_ctxt { decl_native_fn_and_pair(cx, name, ann, fid); } } - case (_) { /* fall through */ } + case (ast.native_item_ty(_, ?tid)) { + cx.native_items.insert(tid, i); + } } ret cx; }