Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import #190

Merged
1 commit merged into from
Jan 4, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/comp/front/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ tag def {
def_ty_arg(def_id);
def_binding(def_id);
def_use(def_id);
def_import(def_id);
}

type crate = spanned[crate_];
Expand Down Expand Up @@ -213,7 +214,7 @@ type _obj = rec(vec[obj_field] fields,


tag mod_index_entry {
mie_use(uint);
mie_view_item(uint);
mie_item(uint);
mie_tag_variant(uint /* tag item index */, uint /* variant index */);
}
Expand Down
7 changes: 5 additions & 2 deletions src/comp/front/parser.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import std._io;
import std._vec;
import std.option;
import std.option.some;
import std.option.none;
Expand Down Expand Up @@ -1751,10 +1752,12 @@ impure fn parse_view(parser p, ast.mod_index index) -> vec[@ast.view_item] {
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;
Expand Down
4 changes: 2 additions & 2 deletions src/comp/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn lookup_name(&env e, ast.ident 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));
}
}
}
Expand All @@ -82,7 +82,7 @@ fn lookup_name(&env e, ast.ident i) -> 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)) {
Expand Down