diff options
| author | Patrick Walton <[email protected]> | 2011-03-31 18:45:24 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-03-31 18:45:24 -0700 |
| commit | 1eeedbd00865fbc8c2650b8e2feba0b6e7f290dc (patch) | |
| tree | e48d4bf8258c1c27d406031157529013aad37f18 /src/comp/middle/trans.rs | |
| parent | rustc: Use the path index. Speeds up compilation a lot. (diff) | |
| download | rust-1eeedbd00865fbc8c2650b8e2feba0b6e7f290dc.tar.xz rust-1eeedbd00865fbc8c2650b8e2feba0b6e7f290dc.zip | |
rustc: Make tag_ty_params() and substitute_ty_params() take def ids instead of ty_params, and to check in external crates
Diffstat (limited to 'src/comp/middle/trans.rs')
| -rw-r--r-- | src/comp/middle/trans.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 38aff67b..3c0df9bd 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -1103,7 +1103,7 @@ fn static_size_of_tag(@crate_ctxt cx, @ty.t t) -> uint { } // Pull the type parameters out of the corresponding tag item. - let vec[ast.ty_param] ty_params = tag_ty_params(cx, tid); + let vec[ast.def_id] ty_params = tag_ty_params(cx, tid); // Compute max(variant sizes). auto max_size = 0u; @@ -1905,12 +1905,8 @@ fn variant_types(@crate_ctxt cx, &ast.variant v) -> vec[@ty.t] { } // Returns the type parameters of a tag. -fn tag_ty_params(@crate_ctxt cx, ast.def_id id) -> vec[ast.ty_param] { - check (cx.items.contains_key(id)); - alt (cx.items.get(id).node) { - case (ast.item_tag(_, _, ?tps, _)) { ret tps; } - } - fail; // not reached +fn tag_ty_params(@crate_ctxt cx, ast.def_id id) -> vec[ast.def_id] { + ret ty.lookup_generic_item_type(cx.sess, cx.type_cache, id)._0; } // Returns the variants in a tag. |