Add names from imports to the namespace.

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