Resolve type paths.

This commit is contained in:
Rafael Ávila de Espíndola 2011-01-27 16:39:31 -05:00
parent 21208f2343
commit c170e7edfd
2 changed files with 4 additions and 20 deletions

View file

@ -486,25 +486,10 @@ fn fold_view_item_import(&env e, &span sp,
}
fn fold_ty_path(&env e, &span sp, ast.path p, &option.t[def] d) -> @ast.ty {
auto index = new_def_hash[def_wrap]();
auto d = find_final_def(e, index, sp, p.node.idents, none[ast.def_id]);
let uint len = _vec.len[ast.ident](p.node.idents);
check (len != 0u);
if (len > 1u) {
e.sess.unimpl("resolving path ty with >1 component");
}
auto d_ = lookup_name(e, p.node.idents.(0));
alt (d_) {
case (some[def](?d)) {
// log "resolved name " + p.node.idents.(0);
}
case (none[def]) {
e.sess.span_err(sp, "unresolved name: " + p.node.idents.(0));
}
}
ret @fold.respan[ast.ty_](sp, ast.ty_path(p, d_));
ret @fold.respan[ast.ty_](sp, ast.ty_path(p, some(unwrap_def(d))));
}
fn update_env_for_crate(&env e, @ast.crate c) -> env {

View file

@ -1,11 +1,10 @@
import m1.foo;
mod m1 {
tag foo {
foo1;
foo2;
}
}
fn bar(foo x) {
fn bar(m1.foo x) {
alt(x) {
case (m1.foo1) {
}