1
Fork 0

librustc: De-record the type context. rs=derecordification

This commit is contained in:
Patrick Walton 2013-01-30 13:14:58 -08:00
parent 684aa2b7fd
commit cc9999c609

View file

@ -233,72 +233,74 @@ pub struct InstantiatedTraitRef {
tpt: ty_param_substs_and_ty tpt: ty_param_substs_and_ty
} }
pub type ctxt = pub type ctxt = @ctxt_;
@{diag: syntax::diagnostic::span_handler,
interner: HashMap<intern_key, t_box>,
mut next_id: uint,
vecs_implicitly_copyable: bool,
legacy_modes: bool,
legacy_records: bool,
cstore: metadata::cstore::CStore,
sess: session::Session,
def_map: resolve::DefMap,
region_map: middle::region::region_map, struct ctxt_ {
region_paramd_items: middle::region::region_paramd_items, diag: syntax::diagnostic::span_handler,
interner: HashMap<intern_key, t_box>,
mut next_id: uint,
vecs_implicitly_copyable: bool,
legacy_modes: bool,
legacy_records: bool,
cstore: metadata::cstore::CStore,
sess: session::Session,
def_map: resolve::DefMap,
// Stores the types for various nodes in the AST. Note that this table region_map: middle::region::region_map,
// is not guaranteed to be populated until after typeck. See region_paramd_items: middle::region::region_paramd_items,
// typeck::check::fn_ctxt for details.
node_types: node_type_table,
// Stores the type parameters which were substituted to obtain the type // Stores the types for various nodes in the AST. Note that this table
// of this node. This only applies to nodes that refer to entities // is not guaranteed to be populated until after typeck. See
// parameterized by type parameters, such as generic fns, types, or // typeck::check::fn_ctxt for details.
// other items. node_types: node_type_table,
node_type_substs: HashMap<node_id, ~[t]>,
items: ast_map::map, // Stores the type parameters which were substituted to obtain the type
intrinsic_defs: HashMap<ast::ident, (ast::def_id, t)>, // of this node. This only applies to nodes that refer to entities
freevars: freevars::freevar_map, // parameterized by type parameters, such as generic fns, types, or
tcache: type_cache, // other items.
rcache: creader_cache, node_type_substs: HashMap<node_id, ~[t]>,
ccache: constness_cache,
short_names_cache: HashMap<t, @~str>,
needs_drop_cache: HashMap<t, bool>,
needs_unwind_cleanup_cache: HashMap<t, bool>,
kind_cache: HashMap<t, Kind>,
ast_ty_to_ty_cache: HashMap<@ast::Ty, ast_ty_to_ty_cache_entry>,
enum_var_cache: HashMap<def_id, @~[VariantInfo]>,
trait_method_cache: HashMap<def_id, @~[method]>,
ty_param_bounds: HashMap<ast::node_id, param_bounds>,
inferred_modes: HashMap<ast::node_id, ast::mode>,
adjustments: HashMap<ast::node_id, @AutoAdjustment>,
normalized_cache: HashMap<t, t>,
lang_items: middle::lang_items::LanguageItems,
legacy_boxed_traits: HashMap<node_id, ()>,
// A mapping from an implementation ID to the method info and trait
// method ID of the provided (a.k.a. default) methods in the traits that
// that implementation implements.
provided_methods: ProvidedMethodsMap,
provided_method_sources: HashMap<ast::def_id, ProvidedMethodSource>,
supertraits: HashMap<ast::def_id, @~[InstantiatedTraitRef]>,
// A mapping from the def ID of an enum or struct type to the def ID items: ast_map::map,
// of the method that implements its destructor. If the type is not intrinsic_defs: HashMap<ast::ident, (ast::def_id, t)>,
// present in this map, it does not have a destructor. This map is freevars: freevars::freevar_map,
// populated during the coherence phase of typechecking. tcache: type_cache,
destructor_for_type: HashMap<ast::def_id, ast::def_id>, rcache: creader_cache,
ccache: constness_cache,
short_names_cache: HashMap<t, @~str>,
needs_drop_cache: HashMap<t, bool>,
needs_unwind_cleanup_cache: HashMap<t, bool>,
kind_cache: HashMap<t, Kind>,
ast_ty_to_ty_cache: HashMap<@ast::Ty, ast_ty_to_ty_cache_entry>,
enum_var_cache: HashMap<def_id, @~[VariantInfo]>,
trait_method_cache: HashMap<def_id, @~[method]>,
ty_param_bounds: HashMap<ast::node_id, param_bounds>,
inferred_modes: HashMap<ast::node_id, ast::mode>,
adjustments: HashMap<ast::node_id, @AutoAdjustment>,
normalized_cache: HashMap<t, t>,
lang_items: middle::lang_items::LanguageItems,
legacy_boxed_traits: HashMap<node_id, ()>,
// A mapping from an implementation ID to the method info and trait
// method ID of the provided (a.k.a. default) methods in the traits that
// that implementation implements.
provided_methods: ProvidedMethodsMap,
provided_method_sources: HashMap<ast::def_id, ProvidedMethodSource>,
supertraits: HashMap<ast::def_id, @~[InstantiatedTraitRef]>,
// A method will be in this list if and only if it is a destructor. // A mapping from the def ID of an enum or struct type to the def ID
destructors: HashMap<ast::def_id, ()>, // of the method that implements its destructor. If the type is not
// present in this map, it does not have a destructor. This map is
// populated during the coherence phase of typechecking.
destructor_for_type: HashMap<ast::def_id, ast::def_id>,
// Records the value mode (read, copy, or move) for every value. // A method will be in this list if and only if it is a destructor.
value_modes: HashMap<ast::node_id, ValueMode>, destructors: HashMap<ast::def_id, ()>,
// Maps a trait onto a mapping from self-ty to impl // Records the value mode (read, copy, or move) for every value.
trait_impls: HashMap<ast::def_id, HashMap<t, @Impl>> value_modes: HashMap<ast::node_id, ValueMode>,
};
// Maps a trait onto a mapping from self-ty to impl
trait_impls: HashMap<ast::def_id, HashMap<t, @Impl>>
}
enum tbox_flag { enum tbox_flag {
has_params = 1, has_params = 1,
@ -833,45 +835,46 @@ pub fn mk_ctxt(s: session::Session,
let vecs_implicitly_copyable = let vecs_implicitly_copyable =
get_lint_level(s.lint_settings.default_settings, get_lint_level(s.lint_settings.default_settings,
lint::vecs_implicitly_copyable) == allow; lint::vecs_implicitly_copyable) == allow;
@{diag: s.diagnostic(), @ctxt_ {
interner: interner, diag: s.diagnostic(),
mut next_id: 0u, interner: interner,
vecs_implicitly_copyable: vecs_implicitly_copyable, mut next_id: 0u,
legacy_modes: legacy_modes, vecs_implicitly_copyable: vecs_implicitly_copyable,
legacy_records: legacy_records, legacy_modes: legacy_modes,
cstore: s.cstore, legacy_records: legacy_records,
sess: s, cstore: s.cstore,
def_map: dm, sess: s,
region_map: region_map, def_map: dm,
region_paramd_items: region_paramd_items, region_map: region_map,
node_types: @smallintmap::mk(), region_paramd_items: region_paramd_items,
node_type_substs: map::HashMap(), node_types: @smallintmap::mk(),
items: amap, node_type_substs: map::HashMap(),
intrinsic_defs: map::HashMap(), items: amap,
freevars: freevars, intrinsic_defs: map::HashMap(),
tcache: HashMap(), freevars: freevars,
rcache: mk_rcache(), tcache: HashMap(),
ccache: HashMap(), rcache: mk_rcache(),
short_names_cache: new_ty_hash(), ccache: HashMap(),
needs_drop_cache: new_ty_hash(), short_names_cache: new_ty_hash(),
needs_unwind_cleanup_cache: new_ty_hash(), needs_drop_cache: new_ty_hash(),
kind_cache: new_ty_hash(), needs_unwind_cleanup_cache: new_ty_hash(),
ast_ty_to_ty_cache: HashMap(), kind_cache: new_ty_hash(),
enum_var_cache: HashMap(), ast_ty_to_ty_cache: HashMap(),
trait_method_cache: HashMap(), enum_var_cache: HashMap(),
ty_param_bounds: HashMap(), trait_method_cache: HashMap(),
inferred_modes: HashMap(), ty_param_bounds: HashMap(),
adjustments: HashMap(), inferred_modes: HashMap(),
normalized_cache: new_ty_hash(), adjustments: HashMap(),
lang_items: move lang_items, normalized_cache: new_ty_hash(),
legacy_boxed_traits: HashMap(), lang_items: move lang_items,
provided_methods: HashMap(), legacy_boxed_traits: HashMap(),
provided_method_sources: HashMap(), provided_methods: HashMap(),
supertraits: HashMap(), provided_method_sources: HashMap(),
destructor_for_type: HashMap(), supertraits: HashMap(),
destructors: HashMap(), destructor_for_type: HashMap(),
value_modes: HashMap(), destructors: HashMap(),
trait_impls: HashMap() value_modes: HashMap(),
trait_impls: HashMap()
} }
} }