Skip to content

Commit

Permalink
The wonky for...in... whitespace was bothering me. Sorry!
Browse files Browse the repository at this point in the history
  • Loading branch information
lkuper committed Aug 16, 2011
1 parent cb239cc commit f91351a
Show file tree
Hide file tree
Showing 102 changed files with 565 additions and 565 deletions.
6 changes: 3 additions & 3 deletions src/comp/back/link.rs
Expand Up @@ -296,7 +296,7 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &str,
let cmh_items: [@ast::meta_item] = ~[]; let cmh_items: [@ast::meta_item] = ~[];
let linkage_metas = attr::find_linkage_metas(c.node.attrs); let linkage_metas = attr::find_linkage_metas(c.node.attrs);
attr::require_unique_names(sess, linkage_metas); attr::require_unique_names(sess, linkage_metas);
for meta: @ast::meta_item in linkage_metas { for meta: @ast::meta_item in linkage_metas {
if attr::get_meta_item_name(meta) == "name" { if attr::get_meta_item_name(meta) == "name" {
alt attr::get_meta_item_value_str(meta) { alt attr::get_meta_item_value_str(meta) {
some(v) { name = some(v); } some(v) { name = some(v); }
Expand Down Expand Up @@ -326,7 +326,7 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &str,
let cmh_items = attr::sort_meta_items(metas.cmh_items); let cmh_items = attr::sort_meta_items(metas.cmh_items);


sha.reset(); sha.reset();
for m_: @ast::meta_item in cmh_items { for m_: @ast::meta_item in cmh_items {
let m = m_; let m = m_;
alt m.node { alt m.node {
ast::meta_name_value(key, value) { ast::meta_name_value(key, value) {
Expand Down Expand Up @@ -429,7 +429,7 @@ fn mangle(ss: &[str]) -> str {


let n = "_ZN"; // Begin name-sequence. let n = "_ZN"; // Begin name-sequence.


for s: str in ss { n += #fmt("%u%s", str::byte_len(s), s); } for s: str in ss { n += #fmt("%u%s", str::byte_len(s), s); }
n += "E"; // End name-sequence. n += "E"; // End name-sequence.


ret n; ret n;
Expand Down
2 changes: 1 addition & 1 deletion src/comp/back/upcall.rs
Expand Up @@ -68,7 +68,7 @@ fn declare_upcalls(tn: type_names, tydesc_type: TypeRef,
fn decl(tn: type_names, llmod: ModuleRef, name: str, tys: [TypeRef], fn decl(tn: type_names, llmod: ModuleRef, name: str, tys: [TypeRef],
rv: TypeRef) -> ValueRef { rv: TypeRef) -> ValueRef {
let arg_tys: [TypeRef] = ~[]; let arg_tys: [TypeRef] = ~[];
for t: TypeRef in tys { arg_tys += ~[t]; } for t: TypeRef in tys { arg_tys += ~[t]; }
let fn_ty = T_fn(arg_tys, rv); let fn_ty = T_fn(arg_tys, rv);
ret trans::decl_cdecl_fn(llmod, "upcall_" + name, fn_ty); ret trans::decl_cdecl_fn(llmod, "upcall_" + name, fn_ty);
} }
Expand Down
10 changes: 5 additions & 5 deletions src/comp/driver/rustc.rs
Expand Up @@ -82,7 +82,7 @@ fn parse_cfgspecs(cfgspecs: &[str]) -> ast::crate_cfg {
// FIXME: It would be nice to use the parser to parse all varieties of // FIXME: It would be nice to use the parser to parse all varieties of
// meta_item here. At the moment we just support the meta_word variant. // meta_item here. At the moment we just support the meta_word variant.
let words = ~[]; let words = ~[];
for s: str in cfgspecs { words += ~[attr::mk_word_item(s)]; } for s: str in cfgspecs { words += ~[attr::mk_word_item(s)]; }
ret words; ret words;
} }


Expand Down Expand Up @@ -334,7 +334,7 @@ fn build_session_options(binary: str, match: getopts::match, binary_dir: str)


let library_search_paths = ~[binary_dir + "/lib"]; let library_search_paths = ~[binary_dir + "/lib"];
let lsp_vec = getopts::opt_strs(match, "L"); let lsp_vec = getopts::opt_strs(match, "L");
for lsp: str in lsp_vec { library_search_paths += ~[lsp]; } for lsp: str in lsp_vec { library_search_paths += ~[lsp]; }


let parse_only = opt_present(match, "parse-only"); let parse_only = opt_present(match, "parse-only");
let no_trans = opt_present(match, "no-trans"); let no_trans = opt_present(match, "no-trans");
Expand Down Expand Up @@ -591,7 +591,7 @@ fn main(args: vec[str]) {
} }


let cstore = sess.get_cstore(); let cstore = sess.get_cstore();
for cratepath: str in cstore::get_used_crate_files(cstore) { for cratepath: str in cstore::get_used_crate_files(cstore) {
if str::ends_with(cratepath, ".rlib") { if str::ends_with(cratepath, ".rlib") {
gcc_args += ~[cratepath]; gcc_args += ~[cratepath];
cont; cont;
Expand All @@ -603,10 +603,10 @@ fn main(args: vec[str]) {
} }


let ula = cstore::get_used_link_args(cstore); let ula = cstore::get_used_link_args(cstore);
for arg: str in ula { gcc_args += ~[arg]; } for arg: str in ula { gcc_args += ~[arg]; }


let used_libs = cstore::get_used_libraries(cstore); let used_libs = cstore::get_used_libraries(cstore);
for l: str in used_libs { gcc_args += ~["-l" + l]; } for l: str in used_libs { gcc_args += ~["-l" + l]; }


if sopts.library { if sopts.library {
gcc_args += ~[lib_cmd]; gcc_args += ~[lib_cmd];
Expand Down
12 changes: 6 additions & 6 deletions src/comp/front/attr.rs
Expand Up @@ -31,7 +31,7 @@ export mk_attr;
// linkage // linkage
fn find_linkage_metas(attrs: &[ast::attribute]) -> [@ast::meta_item] { fn find_linkage_metas(attrs: &[ast::attribute]) -> [@ast::meta_item] {
let metas: [@ast::meta_item] = ~[]; let metas: [@ast::meta_item] = ~[];
for attr: ast::attribute in find_attrs_by_name(attrs, "link") { for attr: ast::attribute in find_attrs_by_name(attrs, "link") {
alt attr.node.value.node { alt attr.node.value.node {
ast::meta_list(_, items) { metas += items; } ast::meta_list(_, items) { metas += items; }
_ { log "ignoring link attribute that has incorrect type"; } _ { log "ignoring link attribute that has incorrect type"; }
Expand Down Expand Up @@ -96,7 +96,7 @@ fn attr_meta(attr: &ast::attribute) -> @ast::meta_item { @attr.node.value }
// Get the meta_items from inside a vector of attributes // Get the meta_items from inside a vector of attributes
fn attr_metas(attrs: &[ast::attribute]) -> [@ast::meta_item] { fn attr_metas(attrs: &[ast::attribute]) -> [@ast::meta_item] {
let mitems = ~[]; let mitems = ~[];
for a: ast::attribute in attrs { mitems += ~[attr_meta(a)]; } for a: ast::attribute in attrs { mitems += ~[attr_meta(a)]; }
ret mitems; ret mitems;
} }


Expand Down Expand Up @@ -124,7 +124,7 @@ fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool {
fn contains(haystack: &[@ast::meta_item], needle: @ast::meta_item) -> bool { fn contains(haystack: &[@ast::meta_item], needle: @ast::meta_item) -> bool {
log #fmt("looking for %s", log #fmt("looking for %s",
syntax::print::pprust::meta_item_to_str(*needle)); syntax::print::pprust::meta_item_to_str(*needle));
for item: @ast::meta_item in haystack { for item: @ast::meta_item in haystack {
log #fmt("looking in %s", log #fmt("looking in %s",
syntax::print::pprust::meta_item_to_str(*item)); syntax::print::pprust::meta_item_to_str(*item));
if eq(item, needle) { log "found it!"; ret true; } if eq(item, needle) { log "found it!"; ret true; }
Expand Down Expand Up @@ -153,12 +153,12 @@ fn sort_meta_items(items: &[@ast::meta_item]) -> [@ast::meta_item] {


// This is sort of stupid here, converting to a vec of mutables and back // This is sort of stupid here, converting to a vec of mutables and back
let v: [mutable @ast::meta_item] = ~[mutable]; let v: [mutable @ast::meta_item] = ~[mutable];
for mi: @ast::meta_item in items { v += ~[mutable mi]; } for mi: @ast::meta_item in items { v += ~[mutable mi]; }


std::sort::quick_sort(lteq, v); std::sort::quick_sort(lteq, v);


let v2: [@ast::meta_item] = ~[]; let v2: [@ast::meta_item] = ~[];
for mi: @ast::meta_item in v { v2 += ~[mi]; } for mi: @ast::meta_item in v { v2 += ~[mi]; }
ret v2; ret v2;
} }


Expand All @@ -179,7 +179,7 @@ fn remove_meta_items_by_name(items: &[@ast::meta_item], name: str) ->
fn require_unique_names(sess: &session::session, fn require_unique_names(sess: &session::session,
metas: &[@ast::meta_item]) { metas: &[@ast::meta_item]) {
let map = map::mk_hashmap[str, ()](str::hash, str::eq); let map = map::mk_hashmap[str, ()](str::hash, str::eq);
for meta: @ast::meta_item in metas { for meta: @ast::meta_item in metas {
let name = get_meta_item_name(meta); let name = get_meta_item_name(meta);
if map.contains_key(name) { if map.contains_key(name) {
sess.span_fatal(meta.span, sess.span_fatal(meta.span,
Expand Down
2 changes: 1 addition & 1 deletion src/comp/front/config.rs
Expand Up @@ -118,7 +118,7 @@ fn in_cfg(cfg: &ast::crate_cfg, attrs: &[ast::attribute]) -> bool {
ivec::foldl(extract_metas, ~[], cfg_metas) ivec::foldl(extract_metas, ~[], cfg_metas)
}; };


for cfg_mi: @ast::meta_item in item_cfg_metas { for cfg_mi: @ast::meta_item in item_cfg_metas {
if attr::contains(cfg, cfg_mi) { ret true; } if attr::contains(cfg, cfg_mi) { ret true; }
} }


Expand Down
2 changes: 1 addition & 1 deletion src/comp/front/test.rs
Expand Up @@ -229,7 +229,7 @@ fn mk_test_desc_ivec_ty(cx: &test_ctxt) -> @ast::ty {
fn mk_test_desc_vec(cx: &test_ctxt) -> @ast::expr { fn mk_test_desc_vec(cx: &test_ctxt) -> @ast::expr {
log #fmt("building test vector from %u tests", ivec::len(cx.testfns)); log #fmt("building test vector from %u tests", ivec::len(cx.testfns));
let descs = ~[]; let descs = ~[];
for test: test in cx.testfns { for test: test in cx.testfns {
let test_ = test; // Satisfy alias analysis let test_ = test; // Satisfy alias analysis
descs += ~[mk_test_desc_rec(cx, test_)]; descs += ~[mk_test_desc_rec(cx, test_)];
} }
Expand Down
4 changes: 2 additions & 2 deletions src/comp/lib/llvm.rs
Expand Up @@ -1469,7 +1469,7 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) ->
fn tys_str(names: type_names, outer: &[TypeRef], tys: &[TypeRef]) -> str { fn tys_str(names: type_names, outer: &[TypeRef], tys: &[TypeRef]) -> str {
let s: str = ""; let s: str = "";
let first: bool = true; let first: bool = true;
for t: TypeRef in tys { for t: TypeRef in tys {
if first { first = false; } else { s += ", "; } if first { first = false; } else { s += ", "; }
s += type_to_str_inner(names, outer, t); s += type_to_str_inner(names, outer, t);
} }
Expand Down Expand Up @@ -1531,7 +1531,7 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) ->


11 { 11 {
let i: uint = 0u; let i: uint = 0u;
for tout: TypeRef in outer0 { for tout: TypeRef in outer0 {
i += 1u; i += 1u;
if tout as int == ty as int { if tout as int == ty as int {
let n: uint = ivec::len[TypeRef](outer0) - i; let n: uint = ivec::len[TypeRef](outer0) - i;
Expand Down
2 changes: 1 addition & 1 deletion src/comp/metadata/common.rs
Expand Up @@ -69,7 +69,7 @@ fn hash_node_id(node_id: &int) -> uint { ret 177573u ^ (node_id as uint); }


fn hash_path(s: &str) -> uint { fn hash_path(s: &str) -> uint {
let h = 5381u; let h = 5381u;
for ch: u8 in str::bytes(s) { h = (h << 5u) + h ^ (ch as uint); } for ch: u8 in str::bytes(s) { h = (h << 5u) + h ^ (ch as uint); }
ret h; ret h;
} }


8 changes: 4 additions & 4 deletions src/comp/metadata/creader.rs
Expand Up @@ -96,7 +96,7 @@ fn metadata_matches(crate_data: &@[u8], metas: &[@ast::meta_item]) -> bool {
log #fmt("matching %u metadata requirements against %u items", log #fmt("matching %u metadata requirements against %u items",
ivec::len(metas), ivec::len(linkage_metas)); ivec::len(metas), ivec::len(linkage_metas));


for needed: @ast::meta_item in metas { for needed: @ast::meta_item in metas {
if !attr::contains(linkage_metas, needed) { if !attr::contains(linkage_metas, needed) {
log #fmt("missing %s", pprust::meta_item_to_str(*needed)); log #fmt("missing %s", pprust::meta_item_to_str(*needed));
ret false; ret false;
Expand Down Expand Up @@ -156,9 +156,9 @@ fn find_library_crate_aux(nn: &{prefix: str, suffix: str}, crate_name: str,
// stomach from here, and writing a C++ wrapper is more work than just // stomach from here, and writing a C++ wrapper is more work than just
// manually filtering fs::list_dir here. // manually filtering fs::list_dir here.


for library_search_path: str in library_search_paths { for library_search_path: str in library_search_paths {
log #fmt("searching %s", library_search_path); log #fmt("searching %s", library_search_path);
for path: str in fs::list_dir(library_search_path) { for path: str in fs::list_dir(library_search_path) {
log #fmt("searching %s", path); log #fmt("searching %s", path);
let f: str = fs::basename(path); let f: str = fs::basename(path);
if !(str::starts_with(f, prefix) && str::ends_with(f, nn.suffix)) if !(str::starts_with(f, prefix) && str::ends_with(f, nn.suffix))
Expand Down Expand Up @@ -250,7 +250,7 @@ fn resolve_crate_deps(e: env, cdata: &@[u8]) -> cstore::cnum_map {
// 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 = new_int_hash[ast::crate_num](); let cnum_map = new_int_hash[ast::crate_num]();
for dep: decoder::crate_dep in decoder::get_crate_deps(cdata) { for dep: decoder::crate_dep in decoder::get_crate_deps(cdata) {
let extrn_cnum = dep.cnum; let extrn_cnum = dep.cnum;
let cname = dep.ident; let cname = dep.ident;
log #fmt("resolving dep %s", cname); log #fmt("resolving dep %s", cname);
Expand Down
18 changes: 9 additions & 9 deletions src/comp/metadata/decoder.rs
Expand Up @@ -46,7 +46,7 @@ fn lookup_hash(d: &ebml::doc, eq_fn: fn(&[u8]) -> bool , hash: uint) ->


let result: [ebml::doc] = ~[]; let result: [ebml::doc] = ~[];
let belt = tag_index_buckets_bucket_elt; let belt = tag_index_buckets_bucket_elt;
for each elt: ebml::doc in ebml::tagged_docs(bucket, belt) { for each elt: ebml::doc in ebml::tagged_docs(bucket, belt) {
let pos = ebml::be_uint_from_bytes(elt.data, elt.start, 4u); let pos = ebml::be_uint_from_bytes(elt.data, elt.start, 4u);
if eq_fn(ivec::slice[u8](*elt.data, elt.start + 4u, elt.end)) { if eq_fn(ivec::slice[u8](*elt.data, elt.start + 4u, elt.end)) {
result += ~[ebml::doc_at(d.data, pos)]; result += ~[ebml::doc_at(d.data, pos)];
Expand Down Expand Up @@ -138,7 +138,7 @@ fn tag_variant_ids(item: &ebml::doc, this_cnum: ast::crate_num) ->
[ast::def_id] { [ast::def_id] {
let ids: [ast::def_id] = ~[]; let ids: [ast::def_id] = ~[];
let v = tag_items_data_item_variant; let v = tag_items_data_item_variant;
for each p: ebml::doc in ebml::tagged_docs(item, v) { for each p: ebml::doc in ebml::tagged_docs(item, v) {
let ext = parse_def_id(ebml::doc_data(p)); let ext = parse_def_id(ebml::doc_data(p));
ids += ~[{crate: this_cnum, node: ext.node}]; ids += ~[{crate: this_cnum, node: ext.node}];
} }
Expand All @@ -156,7 +156,7 @@ fn resolve_path(path: &[ast::ident], data: @[u8]) -> [ast::def_id] {
let paths = ebml::get_doc(md, tag_paths); let paths = ebml::get_doc(md, tag_paths);
let eqer = bind eq_item(_, s); let eqer = bind eq_item(_, s);
let result: [ast::def_id] = ~[]; let result: [ast::def_id] = ~[];
for doc: ebml::doc in lookup_hash(paths, eqer, hash_path(s)) { for doc: ebml::doc in lookup_hash(paths, eqer, hash_path(s)) {
let did_doc = ebml::get_doc(doc, tag_def_id); let did_doc = ebml::get_doc(doc, tag_def_id);
result += ~[parse_def_id(ebml::doc_data(did_doc))]; result += ~[parse_def_id(ebml::doc_data(did_doc))];
} }
Expand Down Expand Up @@ -233,13 +233,13 @@ fn get_tag_variants(data: &@[u8], def: ast::def_id, tcx: &ty::ctxt,
let item = find_item(def.node, items); let item = find_item(def.node, items);
let infos: [ty::variant_info] = ~[]; let infos: [ty::variant_info] = ~[];
let variant_ids = tag_variant_ids(item, external_crate_id); let variant_ids = tag_variant_ids(item, external_crate_id);
for did: ast::def_id in variant_ids { for did: ast::def_id in variant_ids {
let item = find_item(did.node, items); let item = find_item(did.node, items);
let ctor_ty = item_type(item, external_crate_id, tcx, extres); let ctor_ty = item_type(item, external_crate_id, tcx, extres);
let arg_tys: [ty::t] = ~[]; let arg_tys: [ty::t] = ~[];
alt ty::struct(tcx, ctor_ty) { alt ty::struct(tcx, ctor_ty) {
ty::ty_fn(_, args, _, _, _) { ty::ty_fn(_, args, _, _, _) {
for a: ty::arg in args { arg_tys += ~[a.ty]; } for a: ty::arg in args { arg_tys += ~[a.ty]; }
} }
_ { _ {
// Nullary tag variant. // Nullary tag variant.
Expand Down Expand Up @@ -344,15 +344,15 @@ fn get_attributes(md: &ebml::doc) -> [ast::attribute] {
} }


fn list_meta_items(meta_items: &ebml::doc, out: io::writer) { fn list_meta_items(meta_items: &ebml::doc, out: io::writer) {
for mi: @ast::meta_item in get_meta_items(meta_items) { for mi: @ast::meta_item in get_meta_items(meta_items) {
out.write_str(#fmt("%s\n", pprust::meta_item_to_str(*mi))); out.write_str(#fmt("%s\n", pprust::meta_item_to_str(*mi)));
} }
} }


fn list_crate_attributes(md: &ebml::doc, out: io::writer) { fn list_crate_attributes(md: &ebml::doc, out: io::writer) {
out.write_str("=Crate Attributes=\n"); out.write_str("=Crate Attributes=\n");


for attr: ast::attribute in get_attributes(md) { for attr: ast::attribute in get_attributes(md) {
out.write_str(#fmt("%s\n", pprust::attribute_to_str(attr))); out.write_str(#fmt("%s\n", pprust::attribute_to_str(attr)));
} }


Expand Down Expand Up @@ -382,7 +382,7 @@ fn get_crate_deps(data: @[u8]) -> [crate_dep] {
fn list_crate_deps(data: @[u8], out: io::writer) { fn list_crate_deps(data: @[u8], out: io::writer) {
out.write_str("=External Dependencies=\n"); out.write_str("=External Dependencies=\n");


for dep: crate_dep in get_crate_deps(data) { for dep: crate_dep in get_crate_deps(data) {
out.write_str(#fmt("%d %s\n", dep.cnum, dep.ident)); out.write_str(#fmt("%d %s\n", dep.cnum, dep.ident));
} }


Expand All @@ -398,7 +398,7 @@ fn list_crate_items(bytes: &@[u8], md: &ebml::doc, out: io::writer) {
for each bucket: ebml::doc in for each bucket: ebml::doc in
ebml::tagged_docs(bs, tag_index_buckets_bucket) { ebml::tagged_docs(bs, tag_index_buckets_bucket) {
let et = tag_index_buckets_bucket_elt; let et = tag_index_buckets_bucket_elt;
for each elt: ebml::doc in ebml::tagged_docs(bucket, et) { for each elt: ebml::doc in ebml::tagged_docs(bucket, et) {
let data = read_path(elt); let data = read_path(elt);
let def = ebml::doc_at(bytes, data.pos); let def = ebml::doc_at(bytes, data.pos);
let did_doc = ebml::get_doc(def, tag_def_id); let did_doc = ebml::get_doc(def, tag_def_id);
Expand Down

0 comments on commit f91351a

Please sign in to comment.