Don't thread the local crate number through the session

It's a constant, anyway.
This commit is contained in:
Marijn Haverbeke 2011-07-05 16:09:32 +02:00
parent 6fd6fdea93
commit 4349eaed84
5 changed files with 7 additions and 13 deletions

View file

@ -4816,7 +4816,7 @@ fn trans_external_path(&@block_ctxt cx, &ast::def_id did,
fn lval_generic_fn(&@block_ctxt cx, &ty::ty_param_count_and_ty tpt,
&ast::def_id fn_id, ast::node_id id) -> lval_result {
auto lv;
if (cx.fcx.lcx.ccx.sess.get_targ_crate_num() == fn_id._0) {
if (fn_id._0 == ast::local_crate) {
// Internal reference.
assert (cx.fcx.lcx.ccx.fn_pairs.contains_key(fn_id._1));
lv = lval_val(cx, cx.fcx.lcx.ccx.fn_pairs.get(fn_id._1));
@ -4851,7 +4851,7 @@ fn lookup_discriminant(&@local_ctxt lcx, &ast::def_id tid, &ast::def_id vid)
case (none) {
// It's an external discriminant that we haven't seen yet.
assert (lcx.ccx.sess.get_targ_crate_num() != vid._0);
assert (vid._0 != ast::local_crate);
auto sym = decoder::get_symbol(lcx.ccx.sess, vid);
auto gvar =
llvm::LLVMAddGlobal(lcx.ccx.llmod, T_int(), str::buf(sym));

View file

@ -2802,7 +2802,7 @@ fn def_has_ty_params(&ast::def def) -> bool {
type variant_info = rec(vec[ty::t] args, ty::t ctor_ty, ast::def_id id);
fn tag_variants(&ctxt cx, &ast::def_id id) -> vec[variant_info] {
if (cx.sess.get_targ_crate_num() != id._0) {
if (ast::local_crate != id._0) {
ret decoder::get_tag_variants(cx, id);
}
auto item = alt (cx.items.find(id._1)) {
@ -2857,7 +2857,7 @@ fn tag_variant_with_id(&ctxt cx, &ast::def_id tag_id, &ast::def_id variant_id)
// If the given item is in an external crate, looks up its type and adds it to
// the type cache. Returns the type parameters and type.
fn lookup_item_type(ctxt cx, ast::def_id did) -> ty_param_count_and_ty {
if (did._0 == cx.sess.get_targ_crate_num()) {
if (did._0 == ast::local_crate) {
// The item is in this crate. The caller should have added it to the
// type cache already; we simply return it.

View file

@ -521,9 +521,8 @@ mod collect {
ret tpt;
}
fn getter(@ctxt cx, &ast::def_id id) -> ty::ty_param_count_and_ty {
if (id._0 != cx.tcx.sess.get_targ_crate_num()) {
if (id._0 != ast::local_crate) {
// This is a type we need to load in from the crate reader.
ret decoder::get_type(cx.tcx, id);
}
auto it = cx.tcx.items.find(id._1);