diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2011-08-12 07:15:18 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2011-08-16 15:05:56 -0700 |
| commit | e4a0f997fb01b9cbb650532fea1278159faff064 (patch) | |
| tree | 6544a660e7af2a2485a14d200730d38e08ef29e4 /src/comp/metadata | |
| parent | f764f9a8cf52e686ba6e54b594e6bbbdd5bc7b32 (diff) | |
| download | rust-e4a0f997fb01b9cbb650532fea1278159faff064.tar.gz rust-e4a0f997fb01b9cbb650532fea1278159faff064.zip | |
Port the compiler to the typaram foo<T> syntax.
Diffstat (limited to 'src/comp/metadata')
| -rw-r--r-- | src/comp/metadata/creader.rs | 8 | ||||
| -rw-r--r-- | src/comp/metadata/cstore.rs | 6 | ||||
| -rw-r--r-- | src/comp/metadata/decoder.rs | 2 | ||||
| -rw-r--r-- | src/comp/metadata/encoder.rs | 38 | ||||
| -rw-r--r-- | src/comp/metadata/tydecode.rs | 12 | ||||
| -rw-r--r-- | src/comp/metadata/tyencode.rs | 2 |
6 files changed, 34 insertions, 34 deletions
diff --git a/src/comp/metadata/creader.rs b/src/comp/metadata/creader.rs index e00ddb11be6..58e85e90440 100644 --- a/src/comp/metadata/creader.rs +++ b/src/comp/metadata/creader.rs @@ -45,7 +45,7 @@ fn read_crates(sess: session::session, crate: &ast::crate) { type env = @{sess: session::session, - crate_cache: @hashmap[str, int], + crate_cache: @hashmap<str, int>, library_search_paths: [str], mutable next_crate_num: ast::crate_num}; @@ -118,7 +118,7 @@ fn default_native_lib_naming(sess: session::session, static: bool) -> fn find_library_crate(sess: &session::session, ident: &ast::ident, metas: &[@ast::meta_item], library_search_paths: &[str]) -> - option::t[{ident: str, data: @[u8]}] { + option::t<{ident: str, data: @[u8]}> { attr::require_unique_names(sess, metas); @@ -148,7 +148,7 @@ fn find_library_crate(sess: &session::session, ident: &ast::ident, fn find_library_crate_aux(nn: &{prefix: str, suffix: str}, crate_name: str, metas: &[@ast::meta_item], library_search_paths: &[str]) -> - option::t[{ident: str, data: @[u8]}] { + option::t<{ident: str, data: @[u8]}> { let prefix: str = nn.prefix + crate_name; // FIXME: we could probably use a 'glob' function in std::fs but it will // be much easier to write once the unsafe module knows more about FFI @@ -183,7 +183,7 @@ fn find_library_crate_aux(nn: &{prefix: str, suffix: str}, crate_name: str, ret none; } -fn get_metadata_section(filename: str) -> option::t[@[u8]] { +fn get_metadata_section(filename: str) -> option::t<@[u8]> { let b = str::buf(filename); let mb = llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(b); if mb as int == 0 { ret option::none[@[u8]]; } diff --git a/src/comp/metadata/cstore.rs b/src/comp/metadata/cstore.rs index e93b674bc32..70e7ab1169d 100644 --- a/src/comp/metadata/cstore.rs +++ b/src/comp/metadata/cstore.rs @@ -27,7 +27,7 @@ export get_use_stmt_cnum; // local crate numbers (as generated during this session). Each external // crate may refer to types in other external crates, and each has their // own crate numbers. -type cnum_map = map::hashmap[ast::crate_num, ast::crate_num]; +type cnum_map = map::hashmap<ast::crate_num, ast::crate_num>; type crate_metadata = {name: str, data: @[u8], cnum_map: cnum_map}; @@ -39,14 +39,14 @@ type crate_metadata = {name: str, data: @[u8], cnum_map: cnum_map}; tag cstore { private(cstore_private); } type cstore_private = - @{metas: map::hashmap[ast::crate_num, crate_metadata], + @{metas: map::hashmap<ast::crate_num, crate_metadata>, use_crate_map: use_crate_map, mutable used_crate_files: [str], mutable used_libraries: [str], mutable used_link_args: [str]}; // Map from node_id's of local use statements to crate numbers -type use_crate_map = map::hashmap[ast::node_id, ast::crate_num]; +type use_crate_map = map::hashmap<ast::node_id, ast::crate_num>; // Internal method to retrieve the data from the cstore fn p(cstore: &cstore) -> cstore_private { alt cstore { private(p) { p } } } diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs index d365d58fc60..b4203bd08e2 100644 --- a/src/comp/metadata/decoder.rs +++ b/src/comp/metadata/decoder.rs @@ -56,7 +56,7 @@ fn lookup_hash(d: &ebml::doc, eq_fn: fn(&[u8]) -> bool , hash: uint) -> } fn maybe_find_item(item_id: int, items: &ebml::doc) -> - option::t[ebml::doc] { + option::t<ebml::doc> { fn eq_item(bytes: &[u8], item_id: int) -> bool { ret ebml::be_uint_from_bytes(@bytes, 0u, 4u) as int == item_id; } diff --git a/src/comp/metadata/encoder.rs b/src/comp/metadata/encoder.rs index 8cd1380784e..62771235ee8 100644 --- a/src/comp/metadata/encoder.rs +++ b/src/comp/metadata/encoder.rs @@ -19,7 +19,7 @@ import front::attr; export encode_metadata; export encoded_ty; -type abbrev_map = map::hashmap[ty::t, tyencode::ty_abbrev]; +type abbrev_map = map::hashmap<ty::t, tyencode::ty_abbrev>; type encode_ctxt = {ccx: @crate_ctxt, type_abbrevs: abbrev_map}; @@ -39,7 +39,7 @@ fn encode_def_id(ebml_w: &ebml::writer, id: &def_id) { type entry[T] = {val: T, pos: uint}; fn encode_tag_variant_paths(ebml_w: &ebml::writer, variants: &[variant], - path: &[str], index: &mutable [entry[str]]) { + path: &[str], index: &mutable [entry<str>]) { for variant: variant in variants { add_to_index(ebml_w, path, index, variant.node.name); ebml::start_tag(ebml_w, tag_paths_data_item); @@ -50,7 +50,7 @@ fn encode_tag_variant_paths(ebml_w: &ebml::writer, variants: &[variant], } fn add_to_index(ebml_w: &ebml::writer, path: &[str], - index: &mutable [entry[str]], name: &str) { + index: &mutable [entry<str>], name: &str) { let full_path = path + ~[name]; index += ~[{val: str::connect(full_path, "::"), @@ -59,7 +59,7 @@ fn add_to_index(ebml_w: &ebml::writer, path: &[str], fn encode_native_module_item_paths(ebml_w: &ebml::writer, nmod: &native_mod, path: &[str], - index: &mutable [entry[str]]) { + index: &mutable [entry<str>]) { for nitem: @native_item in nmod.items { add_to_index(ebml_w, path, index, nitem.ident); ebml::start_tag(ebml_w, tag_paths_data_item); @@ -70,7 +70,7 @@ fn encode_native_module_item_paths(ebml_w: &ebml::writer, } fn encode_module_item_paths(ebml_w: &ebml::writer, module: &_mod, - path: &[str], index: &mutable [entry[str]]) { + path: &[str], index: &mutable [entry<str>]) { for it: @item in module.items { if !is_exported(it.ident, module) { cont; } alt it.node { @@ -149,8 +149,8 @@ fn encode_module_item_paths(ebml_w: &ebml::writer, module: &_mod, } fn encode_item_paths(ebml_w: &ebml::writer, crate: &@crate) -> - [entry[str]] { - let index: [entry[str]] = ~[]; + [entry<str>] { + let index: [entry<str>] = ~[]; let path: [str] = ~[]; ebml::start_tag(ebml_w, tag_paths); encode_module_item_paths(ebml_w, crate.node.module, path, index); @@ -226,7 +226,7 @@ fn encode_tag_id(ebml_w: &ebml::writer, id: &def_id) { fn encode_tag_variant_info(ecx: &@encode_ctxt, ebml_w: &ebml::writer, id: node_id, variants: &[variant], - index: &mutable [entry[int]], + index: &mutable [entry<int>], ty_params: &[ty_param]) { for variant: variant in variants { index += ~[{val: variant.node.id, pos: ebml_w.writer.tell()}]; @@ -246,7 +246,7 @@ fn encode_tag_variant_info(ecx: &@encode_ctxt, ebml_w: &ebml::writer, } fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: &ebml::writer, - item: @item, index: &mutable [entry[int]]) { + item: @item, index: &mutable [entry<int>]) { alt item.node { item_const(_, _) { ebml::start_tag(ebml_w, tag_items_data_item); @@ -368,8 +368,8 @@ fn encode_info_for_native_item(ecx: &@encode_ctxt, ebml_w: &ebml::writer, } fn encode_info_for_items(ecx: &@encode_ctxt, ebml_w: &ebml::writer) -> - [entry[int]] { - let index: [entry[int]] = ~[]; + [entry<int>] { + let index: [entry<int>] = ~[]; ebml::start_tag(ebml_w, tag_items_data); for each kvp: @{key: node_id, val: middle::ast_map::ast_node} in ecx.ccx.ast_map.items() { @@ -392,32 +392,32 @@ fn encode_info_for_items(ecx: &@encode_ctxt, ebml_w: &ebml::writer) -> // Path and definition ID indexing -fn create_index[T](index: &[entry[T]], hash_fn: fn(&T) -> uint ) -> - [@[entry[T]]] { - let buckets: [@mutable [entry[T]]] = ~[]; +fn create_index[T](index: &[entry<T>], hash_fn: fn(&T) -> uint ) -> + [@[entry<T>]] { + let buckets: [@mutable [entry<T>]] = ~[]; for each i: uint in uint::range(0u, 256u) { buckets += ~[@mutable ~[]]; } - for elt: entry[T] in index { + for elt: entry<T> in index { let h = hash_fn(elt.val); *buckets.(h % 256u) += ~[elt]; } let buckets_frozen = ~[]; - for bucket: @mutable [entry[T]] in buckets { + for bucket: @mutable [entry<T>] in buckets { buckets_frozen += ~[@*bucket]; } ret buckets_frozen; } -fn encode_index[T](ebml_w: &ebml::writer, buckets: &[@[entry[T]]], +fn encode_index[T](ebml_w: &ebml::writer, buckets: &[@[entry<T>]], write_fn: fn(&io::writer, &T) ) { let writer = io::new_writer_(ebml_w.writer); ebml::start_tag(ebml_w, tag_index); let bucket_locs: [uint] = ~[]; ebml::start_tag(ebml_w, tag_index_buckets); - for bucket: @[entry[T]] in buckets { + for bucket: @[entry<T>] in buckets { bucket_locs += ~[ebml_w.writer.tell()]; ebml::start_tag(ebml_w, tag_index_buckets_bucket); - for elt: entry[T] in *bucket { + for elt: entry<T> in *bucket { ebml::start_tag(ebml_w, tag_index_buckets_bucket_elt); writer.write_be_uint(elt.pos, 4u); write_fn(writer, elt.val); diff --git a/src/comp/metadata/tydecode.rs b/src/comp/metadata/tydecode.rs index 95933ffec7f..7c102c2de62 100644 --- a/src/comp/metadata/tydecode.rs +++ b/src/comp/metadata/tydecode.rs @@ -115,7 +115,7 @@ fn parse_path(st: @pstate, sd: str_def) -> ast::path { fail "parse_path: ill-formed path"; } -type arg_parser[T] = fn(@pstate, str_def) -> ast::constr_arg_general_[T] ; +type arg_parser[T] = fn(@pstate, str_def) -> ast::constr_arg_general_<T> ; fn parse_constr_arg(st: @pstate, sd: str_def) -> ast::fn_constr_arg { alt peek(st) as char { @@ -143,22 +143,22 @@ fn parse_constr_arg(st: @pstate, sd: str_def) -> ast::fn_constr_arg { } fn parse_ty_constr_arg(st: @pstate, sd: str_def) -> - ast::constr_arg_general_[path] { + ast::constr_arg_general_<path> { alt peek(st) as char { '*' { st.pos += 1u; ret ast::carg_base; } c { ret ast::carg_ident(parse_path(st, sd)); } } } -fn parse_constr[@T](st: @pstate, sd: str_def, pser: arg_parser[T]) -> - @ty::constr_general[T] { +fn parse_constr[@T](st: @pstate, sd: str_def, pser: arg_parser<T>) -> + @ty::constr_general<T> { let sp = ast::dummy_sp(); // FIXME: use a real span - let args: [@sp_constr_arg[T]] = ~[]; + let args: [@sp_constr_arg<T>] = ~[]; let pth: path = parse_path(st, sd); let ignore: char = next(st) as char; assert (ignore as char == '('); let def = parse_def(st, sd); - let an_arg: constr_arg_general_[T]; + let an_arg: constr_arg_general_<T>; do { an_arg = pser(st, sd); // FIXME use a real span diff --git a/src/comp/metadata/tyencode.rs b/src/comp/metadata/tyencode.rs index 2b5345a1e72..23af6721887 100644 --- a/src/comp/metadata/tyencode.rs +++ b/src/comp/metadata/tyencode.rs @@ -26,7 +26,7 @@ type ctxt = // Def -> str Callback: // Whatever format you choose should not contain pipe characters. type ty_abbrev = {pos: uint, len: uint, s: str}; -tag abbrev_ctxt { ac_no_abbrevs; ac_use_abbrevs(hashmap[ty::t, ty_abbrev]); } +tag abbrev_ctxt { ac_no_abbrevs; ac_use_abbrevs(hashmap<ty::t, ty_abbrev>); } fn cx_uses_abbrevs(cx: &@ctxt) -> bool { alt cx.abbrevs { |
