diff options
| author | Patrick Walton <[email protected]> | 2011-05-13 12:12:54 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-05-13 12:12:54 -0700 |
| commit | be9aa1cc5ecb59c62a80db9e5be355deac90d08e (patch) | |
| tree | 7716fda501a2f4055dbe349bf0fbd9ec682f88cf /src/comp | |
| parent | rustc: Remove a minor rustboot workaround in typeck::resolve_local_types_in_b... (diff) | |
| download | rust-be9aa1cc5ecb59c62a80db9e5be355deac90d08e.tar.xz rust-be9aa1cc5ecb59c62a80db9e5be355deac90d08e.zip | |
rustc: Fix the type of node_types; stub the write_type function
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/ty.rs | 3 | ||||
| -rw-r--r-- | src/comp/middle/typeck.rs | 20 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index ccbbeed0..388eed21 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -162,7 +162,8 @@ const uint idx_first_others = 20u; type type_store = rec(mutable vec[raw_t] others, hashmap[raw_t,uint] other_structural); -type node_type_table = vec[ty::ty_param_count_and_ty]; +type ty_param_substs_opt_and_ty = tup(option::t[vec[ty::t]], ty::t); +type node_type_table = vec[mutable option::t[ty::ty_param_substs_opt_and_ty]]; fn mk_type_store() -> @type_store { let vec[raw_t] others = vec(); diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 0e943445..263e94a2 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -27,6 +27,7 @@ import middle::ty::pat_ty; import middle::ty::path_to_str; import middle::ty::struct; import middle::ty::triv_ann; +import middle::ty::ty_param_substs_opt_and_ty; import middle::ty::ty_to_str; import middle::ty::type_is_integral; import middle::ty::type_is_scalar; @@ -177,8 +178,6 @@ fn ty_param_count_and_ty_for_def(&@fn_ctxt fcx, &ast::span sp, &ast::def defn) } } -type ty_param_substs_opt_and_ty = tup(option::t[vec[ty::t]], ty::t); - // Instantiates the given path, which must refer to an item with the given // number of type parameters and type. fn instantiate_path(&@fn_ctxt fcx, &ast::path pth, &ty_param_count_and_ty tpt, @@ -372,6 +371,15 @@ fn ast_ty_to_ty_crate(@crate_ctxt ccx, &@ast::ty ast_ty) -> ty::t { ret ast_ty_to_ty(ccx.tcx, f, ast_ty); } +// Writes a type parameter count and type pair into the node type table. +fn write_type(&@crate_ctxt cx, uint node_id, + &ty_param_substs_opt_and_ty tpot) { + _vec::grow_set[option::t[ty::ty_param_substs_opt_and_ty]](cx.node_types, + 0u, + none[ty_param_substs_opt_and_ty], + some[ty_param_substs_opt_and_ty](tpot)); +} + // Item collection - a pair of bootstrap passes: // @@ -813,9 +821,9 @@ mod Collect { ty_params); auto typ = e.cx.type_cache.get(id)._1; auto item = ast::item_tag(i, variants_t, ty_params, id, - ast::ann_type(ast::ann_tag(a), typ, - none[vec[ty::t]], - none[@ts_ann])); + ast::ann_type(ast::ann_tag(a), typ, + none[vec[ty::t]], + none[@ts_ann])); ret @fold::respan[ast::item_](sp, item); } @@ -3025,7 +3033,7 @@ fn check_crate(&ty::ctxt tcx, &@ast::crate crate) -> typecheck_result { map::mk_hashmap[unify_cache_entry,ty::Unify::result](hasher, eqer); auto fpt = mk_fn_purity_table(crate); // use a variation on Collect - let node_type_table node_types = vec(); + let node_type_table node_types = vec(mutable); auto ccx = @rec(sess=sess, type_cache=result._1, |