diff options
| author | Rafael Ávila de Espíndola <[email protected]> | 2011-02-02 10:43:57 -0500 |
|---|---|---|
| committer | Rafael Ávila de Espíndola <[email protected]> | 2011-02-02 10:43:57 -0500 |
| commit | dd3ed6139a6fc6fda15403d0b5679535959945e5 (patch) | |
| tree | f97126df9bb855569e2b40d668d7190c033d8ce2 /src/comp/front/ast.rs | |
| parent | Fix buggy argument assembly for upcall_get_type_desc. Can now complete calls ... (diff) | |
| download | rust-dd3ed6139a6fc6fda15403d0b5679535959945e5.tar.xz rust-dd3ed6139a6fc6fda15403d0b5679535959945e5.zip | |
Add most of the plumbing for native items and add support for parsing native type declarations.
Diffstat (limited to 'src/comp/front/ast.rs')
| -rw-r--r-- | src/comp/front/ast.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index 5f527f2d..7b22e700 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -215,7 +215,6 @@ type obj_field = rec(@ty ty, ident ident, def_id id, ann ann); type _obj = rec(vec[obj_field] fields, vec[@method] methods); - tag mod_index_entry { mie_view_item(@view_item); mie_item(@item); @@ -227,7 +226,10 @@ type _mod = rec(vec[@view_item] view_items, vec[@item] items, mod_index index); -type native_mod = rec(str native_name); +type native_mod = rec(str native_name, + vec[@native_item] items, + native_mod_index index); +type native_mod_index = hashmap[ident,@native_item]; type variant_arg = rec(@ty ty, def_id id); type variant = rec(str name, vec[variant_arg] args, def_id id, ann ann); @@ -249,6 +251,11 @@ tag item_ { item_obj(ident, _obj, vec[ty_param], def_id, ann); } +type native_item = spanned[native_item_]; +tag native_item_ { + native_item_ty(ident, def_id); +} + fn index_view_item(mod_index index, @view_item it) { alt (it.node) { case(ast.view_item_use(?id, _, _)) { @@ -292,6 +299,14 @@ fn index_item(mod_index index, @item it) { } } +fn index_native_item(native_mod_index index, @native_item it) { + alt (it.node) { + case (ast.native_item_ty(?id, _)) { + index.insert(id, it); + } + } +} + // // Local Variables: // mode: rust |