Add names from imports to the namespace.

上级 e0fe271d
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
def_ty_arg(def_id); def_ty_arg(def_id);
def_binding(def_id); def_binding(def_id);
def_use(def_id); def_use(def_id);
def_import(def_id);
} }
type crate = spanned[crate_]; type crate = spanned[crate_];
...@@ -213,7 +214,7 @@ ...@@ -213,7 +214,7 @@
tag mod_index_entry { tag mod_index_entry {
mie_use(uint); mie_view_item(uint);
mie_item(uint); mie_item(uint);
mie_tag_variant(uint /* tag item index */, uint /* variant index */); mie_tag_variant(uint /* tag item index */, uint /* variant index */);
} }
......
import std._io; import std._io;
import std._vec;
import std.option; import std.option;
import std.option.some; import std.option.some;
import std.option.none; import std.option.none;
...@@ -1751,10 +1752,12 @@ fn is_use_or_import(token.token t) -> bool { ...@@ -1751,10 +1752,12 @@ fn is_use_or_import(token.token t) -> bool {
items += vec(item); items += vec(item);
alt (item.node) { alt (item.node) {
case(ast.view_item_use(?id, _, _)) { case(ast.view_item_use(?id, _, _)) {
index.insert(id, ast.mie_use(u)); index.insert(id, ast.mie_view_item(u));
} }
case(ast.view_item_import(?ids,_)) { case(ast.view_item_import(?ids,_)) {
// FIXME auto len = _vec.len[ast.ident](ids);
auto last_id = ids.(len - 1u);
index.insert(last_id, ast.mie_view_item(u));
} }
} }
u = u + 1u; u = u + 1u;
......
...@@ -73,7 +73,7 @@ fn found_def_view(@ast.view_item i) -> option.t[def] { ...@@ -73,7 +73,7 @@ fn found_def_view(@ast.view_item i) -> option.t[def] {
ret some[def](ast.def_use(id)); ret some[def](ast.def_use(id));
} }
case (ast.view_item_import(_,?id)) { case (ast.view_item_import(_,?id)) {
fail; ret some[def](ast.def_import(id));
} }
} }
} }
...@@ -82,7 +82,7 @@ fn check_mod(ast.ident i, ast._mod m) -> option.t[def] { ...@@ -82,7 +82,7 @@ fn check_mod(ast.ident i, ast._mod m) -> option.t[def] {
alt (m.index.find(i)) { alt (m.index.find(i)) {
case (some[ast.mod_index_entry](?ent)) { case (some[ast.mod_index_entry](?ent)) {
alt (ent) { alt (ent) {
case (ast.mie_use(?ix)) { case (ast.mie_view_item(?ix)) {
ret found_def_view(m.view_items.(ix)); ret found_def_view(m.view_items.(ix));
} }
case (ast.mie_item(?ix)) { case (ast.mie_item(?ix)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册