Skip to content

Commit b4fd026

Browse files
committed
---
yaml --- r: 1191 b: refs/heads/master c: 7c8f99f h: refs/heads/master i: 1189: 8962581 1187: 126abfc 1183: c7a02b8 v: v3
1 parent 8065fe9 commit b4fd026

File tree

5 files changed

+10
-44
lines changed

5 files changed

+10
-44
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 29fb238a39e94b3fad05cc1ab0a015930ce784e5
2+
refs/heads/master: 7c8f99fdc1be0ed80095af160fffae2995cda83f

trunk/src/comp/front/ast.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ tag def {
3636
def_ty_arg(def_id);
3737
def_binding(def_id);
3838
def_use(def_id);
39+
def_import(def_id);
3940
}
4041

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

214215

215216
tag mod_index_entry {
216-
mie_use(uint);
217+
mie_view_item(uint);
217218
mie_item(uint);
218219
mie_tag_variant(uint /* tag item index */, uint /* variant index */);
219220
}

trunk/src/comp/front/parser.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import std._io;
2+
import std._vec;
23
import std.option;
34
import std.option.some;
45
import std.option.none;
@@ -1751,10 +1752,12 @@ impure fn parse_view(parser p, ast.mod_index index) -> vec[@ast.view_item] {
17511752
items += vec(item);
17521753
alt (item.node) {
17531754
case(ast.view_item_use(?id, _, _)) {
1754-
index.insert(id, ast.mie_use(u));
1755+
index.insert(id, ast.mie_view_item(u));
17551756
}
17561757
case(ast.view_item_import(?ids,_)) {
1757-
// FIXME
1758+
auto len = _vec.len[ast.ident](ids);
1759+
auto last_id = ids.(len - 1u);
1760+
index.insert(last_id, ast.mie_view_item(u));
17581761
}
17591762
}
17601763
u = u + 1u;

trunk/src/comp/middle/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn lookup_name(&env e, ast.ident i) -> option.t[def] {
7373
ret some[def](ast.def_use(id));
7474
}
7575
case (ast.view_item_import(_,?id)) {
76-
fail;
76+
ret some[def](ast.def_import(id));
7777
}
7878
}
7979
}
@@ -82,7 +82,7 @@ fn lookup_name(&env e, ast.ident i) -> option.t[def] {
8282
alt (m.index.find(i)) {
8383
case (some[ast.mod_index_entry](?ent)) {
8484
alt (ent) {
85-
case (ast.mie_use(?ix)) {
85+
case (ast.mie_view_item(?ix)) {
8686
ret found_def_view(m.view_items.(ix));
8787
}
8888
case (ast.mie_item(?ix)) {

trunk/src/comp/middle/ty.rs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -543,44 +543,6 @@ fn is_fn_ty(@t fty) -> bool {
543543

544544
// Type accessors for AST nodes
545545

546-
// Given an item, returns the associated type as well as a list of the IDs of
547-
// its type parameters.
548-
fn item_ty(@ast.item it) -> tup(vec[ast.def_id], @t) {
549-
let vec[ast.ty_param] ty_params;
550-
auto result_ty;
551-
alt (it.node) {
552-
case (ast.item_const(_, _, _, _, ?ann)) {
553-
ty_params = vec();
554-
result_ty = ann_to_type(ann);
555-
}
556-
case (ast.item_fn(_, _, ?tps, _, ?ann)) {
557-
ty_params = tps;
558-
result_ty = ann_to_type(ann);
559-
}
560-
case (ast.item_mod(_, _, _)) {
561-
fail; // modules are typeless
562-
}
563-
case (ast.item_ty(_, _, ?tps, _, ?ann)) {
564-
ty_params = tps;
565-
result_ty = ann_to_type(ann);
566-
}
567-
case (ast.item_tag(_, _, ?tps, ?did)) {
568-
ty_params = tps;
569-
result_ty = plain_ty(ty_tag(did));
570-
}
571-
case (ast.item_obj(_, _, ?tps, _, ?ann)) {
572-
ty_params = tps;
573-
result_ty = ann_to_type(ann);
574-
}
575-
}
576-
577-
let vec[ast.def_id] ty_param_ids = vec();
578-
for (ast.ty_param tp in ty_params) {
579-
ty_param_ids += vec(tp.id);
580-
}
581-
ret tup(ty_param_ids, result_ty);
582-
}
583-
584546
fn stmt_ty(@ast.stmt s) -> @t {
585547
alt (s.node) {
586548
case (ast.stmt_expr(?e)) {

0 commit comments

Comments
 (0)