diff options
| author | Marijn Haverbeke <[email protected]> | 2011-05-09 12:40:09 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <[email protected]> | 2011-05-11 12:32:37 +0200 |
| commit | e9c12ab1d019b42e5427e31bfa49f1f799e84165 (patch) | |
| tree | 7f7ce69c7619060559d2da99fb78fa49c4467aa6 /src/comp/front | |
| parent | Reuse a single work buffer every time the SHA1 message block is processed. (diff) | |
| download | rust-e9c12ab1d019b42e5427e31bfa49f1f799e84165.tar.xz rust-e9c12ab1d019b42e5427e31bfa49f1f799e84165.zip | |
Rewrite comp/middle/resolve.rs
* Cleans up the algorithm
* Move first pass to walk (second still folds)
* Support part of a type/value namespace split
(crate metadata and module indices still need to be taught about this)
* Remove a few blatant inefficiencies (import tables being recreated for
every lookup, most importantly)
Diffstat (limited to 'src/comp/front')
| -rw-r--r-- | src/comp/front/ast.rs | 6 | ||||
| -rw-r--r-- | src/comp/front/creader.rs | 10 | ||||
| -rw-r--r-- | src/comp/front/parser.rs | 3 |
3 files changed, 6 insertions, 13 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index fc2c04f4..71d187ff 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -403,7 +403,7 @@ type variant = spanned[variant_]; type view_item = spanned[view_item_]; tag view_item_ { view_item_use(ident, vec[@meta_item], def_id, Option.t[int]); - view_item_import(ident, vec[ident], def_id, Option.t[def]); + view_item_import(ident, vec[ident], def_id); view_item_export(ident); } @@ -432,7 +432,7 @@ fn index_view_item(mod_index index, @view_item it) { case(ast.view_item_use(?id, _, _, _)) { index.insert(id, ast.mie_view_item(it)); } - case(ast.view_item_import(?def_ident,_,_,_)) { + case(ast.view_item_import(?def_ident,_,_)) { index.insert(def_ident, ast.mie_view_item(it)); } case(ast.view_item_export(_)) { @@ -488,7 +488,7 @@ fn index_native_item(native_mod_index index, @native_item it) { fn index_native_view_item(native_mod_index index, @view_item it) { alt (it.node) { - case(ast.view_item_import(?def_ident,_,_,_)) { + case(ast.view_item_import(?def_ident,_,_)) { index.insert(def_ident, ast.nmie_view_item(it)); } case(ast.view_item_export(_)) { diff --git a/src/comp/front/creader.rs b/src/comp/front/creader.rs index 832ef131..dd913b53 100644 --- a/src/comp/front/creader.rs +++ b/src/comp/front/creader.rs @@ -635,14 +635,8 @@ fn list_crate_metadata(vec[u8] bytes, IO.writer out) { fn describe_def(&EBML.doc items, ast.def_id id) -> str { if (id._0 != 0) {ret "external";} - alt (maybe_find_item(id._1 as int, items)) { - case (Option.some[EBML.doc](?item)) { - ret item_kind_to_str(item_kind(item)); - } - case (Option.none[EBML.doc]) { - ret "??"; // Native modules don't seem to get item entries. - } - } + auto item = find_item(id._1, items); + ret item_kind_to_str(item_kind(item)); } fn item_kind_to_str(u8 kind) -> str { diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 733d5050..46cad2fd 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -2309,8 +2309,7 @@ fn parse_rest_import_name(parser p, ast.ident first, } } auto import_decl = ast.view_item_import(defined_id, identifiers, - p.next_def_id(), - none[ast.def]); + p.next_def_id()); ret @spanned(lo, hi, import_decl); } |