rustc: Move new_def_hash to ast_util

This commit is contained in:
Brian Anderson 2012-05-23 00:38:39 -07:00
parent 8ec467d521
commit 4756556748
11 changed files with 35 additions and 35 deletions

View file

@ -137,7 +137,7 @@ import middle::ty;
import syntax::{ast, visit};
import syntax::codemap::span;
import syntax::print::pprust;
import util::common::new_def_hash;
import syntax::ast_util::new_def_hash;
import std::list;
import std::list::list;

View file

@ -1,7 +1,7 @@
import syntax::{ast, ast_util, codemap, ast_map};
import syntax::ast::*;
import ast::{ident, fn_ident, def, def_id, node_id};
import syntax::ast_util::{local_def, def_id_of_def,
import syntax::ast_util::{local_def, def_id_of_def, new_def_hash,
class_item_ident, path_to_ident};
import pat_util::*;
@ -73,10 +73,10 @@ type ext_hash = hashmap<{did: def_id, ident: str, ns: namespace}, def>;
fn new_ext_hash() -> ext_hash {
type key = {did: def_id, ident: str, ns: namespace};
fn hash(v: key) -> uint {
str::hash(v.ident) + util::common::hash_def(v.did) + v.ns as uint
str::hash(v.ident) + ast_util::hash_def(v.did) + v.ns as uint
}
fn eq(v1: key, v2: key) -> bool {
ret util::common::def_eq(v1.did, v2.did) &&
ret ast_util::def_eq(v1.did, v2.did) &&
str::eq(v1.ident, v2.ident) && v1.ns == v2.ns;
}
std::map::hashmap(hash, {|a, b| a == b})

View file

@ -5492,10 +5492,10 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
discrims: ast_util::new_def_id_hash::<ValueRef>(),
discrim_symbols: int_hash::<str>(),
tydescs: ty::new_ty_hash(),
external: util::common::new_def_hash(),
external: ast_util::new_def_hash(),
monomorphized: map::hashmap(hash_mono_id, {|a, b| a == b}),
monomorphizing: ast_util::new_def_id_hash(),
type_use_cache: util::common::new_def_hash(),
type_use_cache: ast_util::new_def_hash(),
vtables: map::hashmap(hash_mono_id, {|a, b| a == b}),
const_cstr_cache: map::str_hash(),
module_data: str_hash::<ValueRef>(),

View file

@ -11,7 +11,7 @@ import back::abi;
import middle::ty;
import middle::ty::field;
import syntax::ast;
import syntax::ast_util::dummy_sp;
import syntax::ast_util::{dummy_sp, new_def_hash};
import syntax::util::interner;
import util::common;
import syntax::codemap::span;
@ -273,7 +273,7 @@ fn mk_ctxt(llmod: ModuleRef) -> ctxt {
ret {mut next_tag_id: 0u16,
pad: 0u16,
tag_id_to_index: common::new_def_hash(),
tag_id_to_index: new_def_hash(),
tag_order: dvec(),
resources: interner::mk(hash_res_info, {|a, b| a == b}),
llshapetablesty: llshapetablesty,

View file

@ -3,7 +3,6 @@ import pat_util::*;
import syntax::ast::*;
import syntax::ast_util::*;
import syntax::visit;
import util::common::new_def_hash;
import syntax::codemap::span;
import syntax::ast_util::respan;
import driver::session::session;

View file

@ -9,7 +9,7 @@ import pat_util::*;
import syntax::ast::*;
import syntax::ast_util::*;
import syntax::visit;
import util::common::{new_def_hash, log_expr, field_exprs,
import util::common::{log_expr, field_exprs,
has_nonlocal_exits, log_stmt};
import syntax::codemap::span;
import driver::session::session;

View file

@ -6,7 +6,8 @@ import session::session;
import syntax::{ast, ast_map};
import syntax::ast::*;
import syntax::ast_util;
import syntax::ast_util::{is_local, local_def, split_class_items};
import syntax::ast_util::{is_local, local_def, split_class_items,
new_def_hash};
import syntax::codemap::span;
import metadata::csearch;
import util::common::*;
@ -478,7 +479,7 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map,
items: amap,
intrinsic_ifaces: map::str_hash(),
freevars: freevars,
tcache: new_def_hash(),
tcache: ast_util::new_def_hash(),
rcache: mk_rcache(),
short_names_cache: new_ty_hash(),
needs_drop_cache: new_ty_hash(),
@ -2524,7 +2525,7 @@ fn enum_variant_with_id(cx: ctxt, enum_id: ast::def_id,
let mut i = 0u;
while i < vec::len::<variant_info>(*variants) {
let variant = variants[i];
if def_eq(variant.id, variant_id) { ret variant; }
if ast_util::def_eq(variant.id, variant_id) { ret variant; }
i += 1u;
}
cx.sess.bug("enum_variant_with_id(): no variant exists with that ID");