1
Fork 0

Allow hashmaps to infer their types

This commit is contained in:
Erick Tryzelaar 2012-09-19 09:41:06 -07:00 committed by Graydon Hoare
parent 24153eb30f
commit dd502fc6e4
10 changed files with 23 additions and 23 deletions

View file

@ -73,7 +73,7 @@ fn syntax_expander_table() -> HashMap<~str, syntax_extension> {
fn builtin_item_tt(f: syntax_expander_tt_item_) -> syntax_extension { fn builtin_item_tt(f: syntax_expander_tt_item_) -> syntax_extension {
item_tt({expander: f, span: None}) item_tt({expander: f, span: None})
} }
let syntax_expanders = HashMap::<~str,syntax_extension>(); let syntax_expanders = HashMap();
syntax_expanders.insert(~"macro", syntax_expanders.insert(~"macro",
macro_defining(ext::simplext::add_new_extension)); macro_defining(ext::simplext::add_new_extension));
syntax_expanders.insert(~"macro_rules", syntax_expanders.insert(~"macro_rules",

View file

@ -237,7 +237,7 @@ fn follow_for_trans(cx: ext_ctxt, mmaybe: Option<arb_depth<matchable>>,
/* helper for transcribe_exprs: what vars from `b` occur in `e`? */ /* helper for transcribe_exprs: what vars from `b` occur in `e`? */
fn free_vars(b: bindings, e: @expr, it: fn(ident)) { fn free_vars(b: bindings, e: @expr, it: fn(ident)) {
let idents: HashMap<ident, ()> = HashMap(); let idents = HashMap();
fn mark_ident(&&i: ident, _fld: ast_fold, b: bindings, fn mark_ident(&&i: ident, _fld: ast_fold, b: bindings,
idents: HashMap<ident, ()>) -> ident { idents: HashMap<ident, ()>) -> ident {
if b.contains_key(i) { idents.insert(i, ()); } if b.contains_key(i) { idents.insert(i, ()); }

View file

@ -185,7 +185,7 @@ fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match])
} }
} }
} }
let ret_val = HashMap::<uint,@named_match>(); let ret_val = HashMap();
for ms.each() |m| { n_rec(p_s, *m, res, ret_val) } for ms.each() |m| { n_rec(p_s, *m, res, ret_val) }
return ret_val; return ret_val;
} }

View file

@ -47,7 +47,7 @@ fn new_tt_reader(sp_diag: span_handler, itr: ident_interner,
mut cur: @{readme: src, mut idx: 0u, dotdotdoted: false, mut cur: @{readme: src, mut idx: 0u, dotdotdoted: false,
sep: None, up: tt_frame_up(option::None)}, sep: None, up: tt_frame_up(option::None)},
interpolations: match interp { /* just a convienience */ interpolations: match interp { /* just a convienience */
None => std::map::HashMap::<uint,@named_match>(), None => std::map::HashMap(),
Some(x) => x Some(x) => x
}, },
mut repeat_idx: ~[], mut repeat_idx: ~[],

View file

@ -248,7 +248,7 @@ fn resolve_crate_deps(e: env, cdata: @~[u8]) -> cstore::cnum_map {
debug!("resolving deps of external crate"); debug!("resolving deps of external crate");
// The map from crate numbers in the crate we're resolving to local crate // The map from crate numbers in the crate we're resolving to local crate
// numbers // numbers
let cnum_map = HashMap::<int,ast::crate_num>(); let cnum_map = HashMap();
for decoder::get_crate_deps(e.intr, cdata).each |dep| { for decoder::get_crate_deps(e.intr, cdata).each |dep| {
let extrn_cnum = dep.cnum; let extrn_cnum = dep.cnum;
let cname = dep.name; let cname = dep.name;

View file

@ -69,8 +69,8 @@ pure fn p(cstore: cstore) -> cstore_private {
} }
fn mk_cstore(intr: ident_interner) -> cstore { fn mk_cstore(intr: ident_interner) -> cstore {
let meta_cache = map::HashMap::<int,crate_metadata>(); let meta_cache = map::HashMap();
let crate_map = map::HashMap::<int,ast::crate_num>(); let crate_map = map::HashMap();
let mod_path_map = HashMap(); let mod_path_map = HashMap();
return private(@{metas: meta_cache, return private(@{metas: meta_cache,
use_crate_map: crate_map, use_crate_map: crate_map,

View file

@ -967,7 +967,7 @@ fn get_crate_module_paths(intr: ident_interner, cdata: cmd)
// find all module (path, def_ids), which are not // find all module (path, def_ids), which are not
// fowarded path due to renamed import or reexport // fowarded path due to renamed import or reexport
let mut res = ~[]; let mut res = ~[];
let mods = map::HashMap::<~str,bool>(); let mods = map::HashMap();
do iter_crate_items(intr, cdata) |path, did| { do iter_crate_items(intr, cdata) |path, did| {
let m = mod_of_path(path); let m = mod_of_path(path);
if str::is_not_empty(m) { if str::is_not_empty(m) {

View file

@ -314,7 +314,7 @@ fn Atom(n: uint) -> Atom {
/// Creates a hash table of atoms. /// Creates a hash table of atoms.
fn atom_hashmap<V:Copy>() -> HashMap<Atom,V> { fn atom_hashmap<V:Copy>() -> HashMap<Atom,V> {
HashMap::<Atom,V>() HashMap()
} }
/// One local scope. /// One local scope.

View file

@ -1406,9 +1406,9 @@ fn new_fn_ctxt_w_id(ccx: @crate_ctxt, path: path,
mut llself: None, mut llself: None,
mut personality: None, mut personality: None,
mut loop_ret: None, mut loop_ret: None,
llargs: HashMap::<int,local_val>(), llargs: HashMap(),
lllocals: HashMap::<int,local_val>(), lllocals: HashMap(),
llupvars: HashMap::<int,ValueRef>(), llupvars: HashMap(),
id: id, id: id,
param_substs: param_substs, param_substs: param_substs,
span: sp, span: sp,
@ -2315,7 +2315,7 @@ fn declare_intrinsics(llmod: ModuleRef) -> HashMap<~str, ValueRef> {
let frameaddress = decl_cdecl_fn(llmod, ~"llvm.frameaddress", let frameaddress = decl_cdecl_fn(llmod, ~"llvm.frameaddress",
T_fn(T_frameaddress_args, T_fn(T_frameaddress_args,
T_ptr(T_i8()))); T_ptr(T_i8())));
let intrinsics = HashMap::<~str,ValueRef>(); let intrinsics = HashMap();
intrinsics.insert(~"llvm.gcroot", gcroot); intrinsics.insert(~"llvm.gcroot", gcroot);
intrinsics.insert(~"llvm.gcread", gcread); intrinsics.insert(~"llvm.gcread", gcread);
intrinsics.insert(~"llvm.memmove.p0i8.p0i8.i32", memmove32); intrinsics.insert(~"llvm.memmove.p0i8.p0i8.i32", memmove32);
@ -2627,17 +2627,17 @@ fn trans_crate(sess: session::session,
llmod: llmod, llmod: llmod,
td: td, td: td,
tn: tn, tn: tn,
externs: HashMap::<~str,ValueRef>(), externs: HashMap(),
intrinsics: intrinsics, intrinsics: intrinsics,
item_vals: HashMap::<int,ValueRef>(), item_vals: HashMap(),
exp_map2: emap2, exp_map2: emap2,
reachable: reachable, reachable: reachable,
item_symbols: HashMap::<int,~str>(), item_symbols: HashMap(),
mut main_fn: None::<ValueRef>, mut main_fn: None::<ValueRef>,
link_meta: link_meta, link_meta: link_meta,
enum_sizes: ty::new_ty_hash(), enum_sizes: ty::new_ty_hash(),
discrims: HashMap(), discrims: HashMap(),
discrim_symbols: HashMap::<int,~str>(), discrim_symbols: HashMap(),
tydescs: ty::new_ty_hash(), tydescs: ty::new_ty_hash(),
mut finished_tydescs: false, mut finished_tydescs: false,
external: HashMap(), external: HashMap(),
@ -2646,15 +2646,15 @@ fn trans_crate(sess: session::session,
type_use_cache: HashMap(), type_use_cache: HashMap(),
vtables: map::HashMap(), vtables: map::HashMap(),
const_cstr_cache: HashMap(), const_cstr_cache: HashMap(),
const_globals: HashMap::<int,ValueRef>(), const_globals: HashMap(),
module_data: HashMap::<~str,ValueRef>(), module_data: HashMap(),
lltypes: ty::new_ty_hash(), lltypes: ty::new_ty_hash(),
names: new_namegen(sess.parse_sess.interner), names: new_namegen(sess.parse_sess.interner),
next_addrspace: new_addrspace_gen(), next_addrspace: new_addrspace_gen(),
symbol_hasher: symbol_hasher, symbol_hasher: symbol_hasher,
type_hashcodes: ty::new_ty_hash(), type_hashcodes: ty::new_ty_hash(),
type_short_names: ty::new_ty_hash(), type_short_names: ty::new_ty_hash(),
all_llvm_symbols: HashMap::<~str,()>(), all_llvm_symbols: HashMap(),
tcx: tcx, tcx: tcx,
maps: maps, maps: maps,
stats: stats:
@ -2672,7 +2672,7 @@ fn trans_crate(sess: session::session,
upcalls: upcalls:
upcall::declare_upcalls(targ_cfg, tn, tydesc_type, upcall::declare_upcalls(targ_cfg, tn, tydesc_type,
llmod), llmod),
rtcalls: HashMap::<~str,ast::def_id>(), rtcalls: HashMap(),
tydesc_type: tydesc_type, tydesc_type: tydesc_type,
int_type: int_type, int_type: int_type,
float_type: float_type, float_type: float_type,
@ -2683,7 +2683,7 @@ fn trans_crate(sess: session::session,
crate_map: crate_map, crate_map: crate_map,
mut uses_gc: false, mut uses_gc: false,
dbg_cx: dbg_cx, dbg_cx: dbg_cx,
class_ctors: HashMap::<int,ast::def_id>(), class_ctors: HashMap(),
mut do_not_commit_warning_issued: false}; mut do_not_commit_warning_issued: false};