Reformat for new mode syntax, step 1
Long lines were fixed in a very crude way, as I'll be following up with another reformat in a bit.
This commit is contained in:
parent
64a6376da5
commit
fc6b7c8b38
209 changed files with 3358 additions and 3353 deletions
|
@ -3,7 +3,7 @@ import std::option;
|
|||
import codemap::span;
|
||||
import ast::*;
|
||||
|
||||
fn respan<@T>(sp: &span, t: &T) -> spanned<T> { ret {node: t, span: sp}; }
|
||||
fn respan<@T>(sp: span, t: T) -> spanned<T> { ret {node: t, span: sp}; }
|
||||
|
||||
/* assuming that we're not in macro expansion */
|
||||
fn mk_sp(lo: uint, hi: uint) -> span {
|
||||
|
@ -13,13 +13,13 @@ fn mk_sp(lo: uint, hi: uint) -> span {
|
|||
// make this a const, once the compiler supports it
|
||||
fn dummy_sp() -> span { ret mk_sp(0u, 0u); }
|
||||
|
||||
fn path_name(p: &path) -> str { path_name_i(p.node.idents) }
|
||||
fn path_name(p: path) -> str { path_name_i(p.node.idents) }
|
||||
|
||||
fn path_name_i(idents: &[ident]) -> str { str::connect(idents, "::") }
|
||||
fn path_name_i(idents: [ident]) -> str { str::connect(idents, "::") }
|
||||
|
||||
fn local_def(id: node_id) -> def_id { ret {crate: local_crate, node: id}; }
|
||||
|
||||
fn variant_def_ids(d: &def) -> {tg: def_id, var: def_id} {
|
||||
fn variant_def_ids(d: def) -> {tg: def_id, var: def_id} {
|
||||
alt d { def_variant(tag_id, var_id) { ret {tg: tag_id, var: var_id}; } }
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ type pat_id_map = std::map::hashmap<str, node_id>;
|
|||
|
||||
// This is used because same-named variables in alternative patterns need to
|
||||
// use the node_id of their namesake in the first pattern.
|
||||
fn pat_id_map(pat: &@pat) -> pat_id_map {
|
||||
fn pat_id_map(pat: @pat) -> pat_id_map {
|
||||
let map = std::map::new_str_hash::<node_id>();
|
||||
for each bound in pat_bindings(pat) {
|
||||
let name = alt bound.node { pat_bind(n) { n } };
|
||||
|
@ -57,7 +57,7 @@ fn pat_id_map(pat: &@pat) -> pat_id_map {
|
|||
}
|
||||
|
||||
// FIXME: could return a constrained type
|
||||
iter pat_bindings(pat: &@pat) -> @pat {
|
||||
iter pat_bindings(pat: @pat) -> @pat {
|
||||
alt pat.node {
|
||||
pat_bind(_) { put pat; }
|
||||
pat_tag(_, sub) {
|
||||
|
@ -74,7 +74,7 @@ iter pat_bindings(pat: &@pat) -> @pat {
|
|||
}
|
||||
}
|
||||
|
||||
fn pat_binding_ids(pat: &@pat) -> [node_id] {
|
||||
fn pat_binding_ids(pat: @pat) -> [node_id] {
|
||||
let found = [];
|
||||
for each b in pat_bindings(pat) { found += [b.id]; }
|
||||
ret found;
|
||||
|
@ -117,7 +117,7 @@ fn unop_to_str(op: unop) -> str {
|
|||
}
|
||||
}
|
||||
|
||||
fn is_path(e: &@expr) -> bool {
|
||||
fn is_path(e: @expr) -> bool {
|
||||
ret alt e.node { expr_path(_) { true } _ { false } };
|
||||
}
|
||||
|
||||
|
@ -179,9 +179,9 @@ fn is_constraint_arg(e: @expr) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
fn eq_ty(a: &@ty, b: &@ty) -> bool { ret std::box::ptr_eq(a, b); }
|
||||
fn eq_ty(a: @ty, b: @ty) -> bool { ret std::box::ptr_eq(a, b); }
|
||||
|
||||
fn hash_ty(t: &@ty) -> uint { ret t.span.lo << 16u + t.span.hi; }
|
||||
fn hash_ty(t: @ty) -> uint { ret t.span.lo << 16u + t.span.hi; }
|
||||
|
||||
fn block_from_expr(e: @expr) -> blk {
|
||||
let blk_ = checked_blk([], option::some::<@expr>(e), e.id);
|
||||
|
@ -193,13 +193,13 @@ fn checked_blk(stmts1: [@stmt], expr1: option::t<@expr>, id1: node_id) ->
|
|||
ret {stmts: stmts1, expr: expr1, id: id1, rules: checked};
|
||||
}
|
||||
|
||||
fn obj_field_from_anon_obj_field(f: &anon_obj_field) -> obj_field {
|
||||
fn obj_field_from_anon_obj_field(f: anon_obj_field) -> obj_field {
|
||||
ret {mut: f.mut, ty: f.ty, ident: f.ident, id: f.id};
|
||||
}
|
||||
|
||||
// This is a convenience function to transfor ternary expressions to if
|
||||
// expressions so that they can be treated the same
|
||||
fn ternary_to_if(e: &@expr) -> @expr {
|
||||
fn ternary_to_if(e: @expr) -> @expr {
|
||||
alt e.node {
|
||||
expr_ternary(cond, then, els) {
|
||||
let then_blk = block_from_expr(then);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue