diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2011-07-13 15:44:09 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2011-07-13 15:44:09 -0700 |
| commit | 39151f2ad8d18554af1d6787bae0b02345e1d90b (patch) | |
| tree | c10c032214af521351cd46d6ee23a5007927bc48 /src/comp/syntax | |
| parent | 04b239f3cb9d4b62488dc2d219e9bd9a242bdf8f (diff) | |
| download | rust-39151f2ad8d18554af1d6787bae0b02345e1d90b.tar.gz rust-39151f2ad8d18554af1d6787bae0b02345e1d90b.zip | |
Prohibit trailing whitespace under 'tidy' script. Clean up all caught cases.
Diffstat (limited to 'src/comp/syntax')
| -rw-r--r-- | src/comp/syntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ext/base.rs | 6 | ||||
| -rw-r--r-- | src/comp/syntax/ext/expand.rs | 12 | ||||
| -rw-r--r-- | src/comp/syntax/ext/simplext.rs | 36 | ||||
| -rw-r--r-- | src/comp/syntax/fold.rs | 98 | ||||
| -rw-r--r-- | src/comp/syntax/parse/lexer.rs | 8 | ||||
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 14 | ||||
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 8 | ||||
| -rw-r--r-- | src/comp/syntax/walk.rs | 2 |
9 files changed, 93 insertions, 93 deletions
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index 3280c50e3da..fd5a308cbb8 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -620,7 +620,7 @@ fn is_exported(ident i, _mod m) -> bool { case (_) {/* fall through */ } } } - // If there are no declared exports then + // If there are no declared exports then // everything not imported is exported ret count == 0u && !nonlocal; diff --git a/src/comp/syntax/ext/base.rs b/src/comp/syntax/ext/base.rs index 1ba90017bd8..25a4110bd7d 100644 --- a/src/comp/syntax/ext/base.rs +++ b/src/comp/syntax/ext/base.rs @@ -6,7 +6,7 @@ import codemap::span; import std::map::new_str_hash; import codemap; -type syntax_expander = +type syntax_expander = fn(&ext_ctxt, span, &(@ast::expr)[], option::t[str]) -> @ast::expr; type macro_definer = fn(&ext_ctxt, span, &(@ast::expr)[], option::t[str]) -> tup(str, syntax_extension); @@ -22,7 +22,7 @@ fn syntax_expander_table() -> hashmap[str, syntax_extension] { auto syntax_expanders = new_str_hash[syntax_extension](); syntax_expanders.insert("fmt", normal(ext::fmt::expand_syntax_ext)); syntax_expanders.insert("env", normal(ext::env::expand_syntax_ext)); - syntax_expanders.insert("macro", + syntax_expanders.insert("macro", macro_defining(ext::simplext::add_new_extension)); ret syntax_expanders; } @@ -85,7 +85,7 @@ fn expr_to_str(&ext_ctxt cx, @ast::expr expr, str error) -> str { fn expr_to_ident(&ext_ctxt cx, @ast::expr expr, str error) -> ast::ident { alt(expr.node) { case (ast::expr_path(?p)) { - if (ivec::len(p.node.types) > 0u + if (ivec::len(p.node.types) > 0u || ivec::len(p.node.idents) != 1u) { cx.span_fatal(expr.span, error); } else { diff --git a/src/comp/syntax/ext/expand.rs b/src/comp/syntax/ext/expand.rs index 0ffb4891f2e..cb93a4bf45c 100644 --- a/src/comp/syntax/ext/expand.rs +++ b/src/comp/syntax/ext/expand.rs @@ -13,8 +13,8 @@ import std::option::some; import std::map::hashmap; import std::ivec; -fn expand_expr(&hashmap[str, base::syntax_extension] exts, - &session::session sess, &expr_ e, ast_fold fld, +fn expand_expr(&hashmap[str, base::syntax_extension] exts, + &session::session sess, &expr_ e, ast_fold fld, &fn(&ast::expr_, ast_fold) -> expr_ orig) -> expr_ { ret alt(e) { case (expr_mac(?mac)) { @@ -25,18 +25,18 @@ fn expand_expr(&hashmap[str, base::syntax_extension] exts, auto ext_cx = base::mk_ctxt(sess); alt (exts.find(extname)) { case (none) { - emit_error(some(pth.span), + emit_error(some(pth.span), "unknown syntax expander: '" + extname + "'", sess.get_codemap()); fail } case (some(base::normal(?ext))) { //keep going, outside-in - fld.fold_expr(ext(ext_cx, pth.span, + fld.fold_expr(ext(ext_cx, pth.span, args, body)).node } case (some(base::macro_defining(?ext))) { - auto named_extension + auto named_extension = ext(ext_cx, pth.span, args, body); exts.insert(named_extension._0, named_extension._1); @@ -65,7 +65,7 @@ fn expand_crate(&session::session sess, &@crate c) -> @crate { auto res = @f.fold_crate(*c); dummy_out(f); //temporary: kill circular reference ret res; - + } // Local Variables: diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs index 747d634e60d..09c2ebc508b 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -61,8 +61,8 @@ fn subst_path(&ext_ctxt cx, &(invk_binding)[] ibs, &path_ p, ast_fold fld) // Don't substitute into qualified names. if (ivec::len(p.types) > 0u || ivec::len(p.idents) != 1u) { ret p; } ret alt (lookup(ibs, p.idents.(0))) { - case (some(ident_binding(_, ?id))) { - rec(global=false, idents=~[id.node], types=~[]) + case (some(ident_binding(_, ?id))) { + rec(global=false, idents=~[id.node], types=~[]) } case (some(path_binding(_, ?a_pth))) { a_pth.node } case (some(expr_binding(_, ?expr))) { @@ -74,18 +74,18 @@ fn subst_path(&ext_ctxt cx, &(invk_binding)[] ibs, &path_ p, ast_fold fld) } -fn subst_expr(&ext_ctxt cx, &(invk_binding)[] ibs, &ast::expr_ e, - ast_fold fld, fn(&ast::expr_, ast_fold) -> ast::expr_ orig) +fn subst_expr(&ext_ctxt cx, &(invk_binding)[] ibs, &ast::expr_ e, + ast_fold fld, fn(&ast::expr_, ast_fold) -> ast::expr_ orig) -> ast::expr_ { ret alt(e) { case (expr_path(?p)){ // Don't substitute into qualified names. - if (ivec::len(p.node.types) > 0u || + if (ivec::len(p.node.types) > 0u || ivec::len(p.node.idents) != 1u) { e } alt (lookup(ibs, p.node.idents.(0))) { - case (some(ident_binding(_, ?id))) { - expr_path(respan(id.span, - rec(global=false, + case (some(ident_binding(_, ?id))) { + expr_path(respan(id.span, + rec(global=false, idents=~[id.node],types=~[]))) } case (some(path_binding(_, ?a_pth))) { expr_path(*a_pth) } @@ -107,7 +107,7 @@ tag invk_binding { } fn path_to_ident(&path pth) -> option::t[ident] { - if (ivec::len(pth.node.idents) == 1u + if (ivec::len(pth.node.idents) == 1u && ivec::len(pth.node.types) == 0u) { ret some(pth.node.idents.(0u)); } @@ -115,7 +115,7 @@ fn path_to_ident(&path pth) -> option::t[ident] { } fn process_clause(&ext_ctxt cx, &mutable vec[pat_ext] pes, - &mutable option::t[str] macro_name, &path pth, + &mutable option::t[str] macro_name, &path pth, &(@ast::expr)[] invoc_args, @ast::expr body) { let str clause_name = alt(path_to_ident(pth)) { case (some(?id)) { id } @@ -139,10 +139,10 @@ fn add_new_extension(&ext_ctxt cx, span sp, &(@ast::expr)[] args, for (@ast::expr arg in args) { alt(arg.node) { case(expr_vec(?elts, ?mut, ?seq_kind)) { - + if (ivec::len(elts) != 2u) { - cx.span_fatal((*arg).span, - "extension clause must consist of [" + + cx.span_fatal((*arg).span, + "extension clause must consist of [" + "macro invocation, expansion body]"); } alt(elts.(0u).node) { @@ -168,10 +168,10 @@ fn add_new_extension(&ext_ctxt cx, span sp, &(@ast::expr)[] args, } auto ext = bind generic_extension(_,_,_,_,@pat_exts); - + ret tup(alt (macro_name) { case (some(?id)) { id } - case (none) { + case (none) { cx.span_fatal(sp, "macro definition must have " + "at least one clause") } @@ -192,7 +192,7 @@ fn add_new_extension(&ext_ctxt cx, span sp, &(@ast::expr)[] args, case (expr_vec(?p_elts, _, _)) { alt (arg) { case (expr_vec(?a_elts, _, _)) { - if (ivec::len(p_elts) != ivec::len(a_elts)) { + if (ivec::len(p_elts) != ivec::len(a_elts)) { none[vec[invk_binding]] } let uint i = 0u; @@ -218,12 +218,12 @@ fn add_new_extension(&ext_ctxt cx, span sp, &(@ast::expr)[] args, alt (path_to_ident(a_pth)) { case (some(?a_id)) { some(~[ident_binding - (p_id, + (p_id, respan(argument.span, a_id))]) } case (none) { - some(~[path_binding(p_id, + some(~[path_binding(p_id, @a_pth)]) } } diff --git a/src/comp/syntax/fold.rs b/src/comp/syntax/fold.rs index ca2688d33e9..a4921b46bca 100644 --- a/src/comp/syntax/fold.rs +++ b/src/comp/syntax/fold.rs @@ -18,9 +18,9 @@ type ast_fold = @mutable a_f; // We may eventually want to be able to fold over type parameters, too -type ast_fold_precursor = +type ast_fold_precursor = rec(fn (&crate_ c, ast_fold) -> crate_ fold_crate, - fn (&crate_directive_ cd, ast_fold) -> crate_directive_ + fn (&crate_directive_ cd, ast_fold) -> crate_directive_ fold_crate_directive, fn (&view_item_ i, ast_fold) -> view_item_ fold_view_item, fn (&@native_item i, ast_fold) -> @native_item fold_native_item, @@ -72,27 +72,27 @@ type a_f = //fn nf_dummy[T](&T node) -> T { fail; } fn nf_crate_dummy(&crate c) -> crate { fail; } -fn nf_crate_directive_dummy(&@crate_directive c) +fn nf_crate_directive_dummy(&@crate_directive c) -> @crate_directive { fail; } -fn nf_view_item_dummy(&@view_item v) -> @view_item { fail; } -fn nf_native_item_dummy(&@native_item n) -> @native_item { fail; } -fn nf_item_dummy(&@item i) -> @item { fail; } -fn nf_item_underscore_dummy(&item_ i) -> item_ { fail; } -fn nf_method_dummy(&@method m) -> @method { fail; } -fn nf_block_dummy(&block b) -> block { fail; } -fn nf_stmt_dummy(&@stmt s) -> @stmt { fail; } -fn nf_arm_dummy(&arm a) -> arm { fail; } -fn nf_pat_dummy(&@pat p) -> @pat { fail; } -fn nf_decl_dummy(&@decl d) -> @decl { fail; } -fn nf_expr_dummy(&@expr e) -> @expr { fail; } -fn nf_ty_dummy(&@ty t) -> @ty { fail; } -fn nf_constr_dummy(&@constr c) -> @constr { fail; } -fn nf_fn_dummy(&_fn f) -> _fn { fail; } -fn nf_mod_dummy(&_mod m) -> _mod { fail; } -fn nf_native_mod_dummy(&native_mod n) -> native_mod { fail; } -fn nf_variant_dummy(&variant v) -> variant { fail; } -fn nf_ident_dummy(&ident i) -> ident { fail; } -fn nf_path_dummy(&path p) -> path { fail; } +fn nf_view_item_dummy(&@view_item v) -> @view_item { fail; } +fn nf_native_item_dummy(&@native_item n) -> @native_item { fail; } +fn nf_item_dummy(&@item i) -> @item { fail; } +fn nf_item_underscore_dummy(&item_ i) -> item_ { fail; } +fn nf_method_dummy(&@method m) -> @method { fail; } +fn nf_block_dummy(&block b) -> block { fail; } +fn nf_stmt_dummy(&@stmt s) -> @stmt { fail; } +fn nf_arm_dummy(&arm a) -> arm { fail; } +fn nf_pat_dummy(&@pat p) -> @pat { fail; } +fn nf_decl_dummy(&@decl d) -> @decl { fail; } +fn nf_expr_dummy(&@expr e) -> @expr { fail; } +fn nf_ty_dummy(&@ty t) -> @ty { fail; } +fn nf_constr_dummy(&@constr c) -> @constr { fail; } +fn nf_fn_dummy(&_fn f) -> _fn { fail; } +fn nf_mod_dummy(&_mod m) -> _mod { fail; } +fn nf_native_mod_dummy(&native_mod n) -> native_mod { fail; } +fn nf_variant_dummy(&variant v) -> variant { fail; } +fn nf_ident_dummy(&ident i) -> ident { fail; } +fn nf_path_dummy(&path p) -> path { fail; } fn nf_obj_field_dummy(&obj_field o) -> obj_field { fail; } fn nf_local_dummy(&@local o) -> @local { fail; } @@ -114,7 +114,7 @@ fn fold_meta_item_(&@meta_item mi, ast_fold fld) -> @meta_item { span=mi.span); } //used in noop_fold_item and noop_fold_crate -fn fold_attribute_(&attribute at, fn(&@meta_item) -> @meta_item fmi) +fn fold_attribute_(&attribute at, fn(&@meta_item) -> @meta_item fmi) -> attribute { ret rec(node=rec(style=at.node.style, value=*fmi(@at.node.value)), @@ -122,7 +122,7 @@ fn fold_attribute_(&attribute at, fn(&@meta_item) -> @meta_item fmi) } //used in noop_fold_native_item and noop_fold_fn fn fold_arg_(&arg a, ast_fold fld) -> arg { - ret rec(mode=a.mode, ty=fld.fold_ty(a.ty), + ret rec(mode=a.mode, ty=fld.fold_ty(a.ty), ident=fld.fold_ident(a.ident), id=a.id); } //used in noop_fold_expr, and possibly elsewhere in the future @@ -130,10 +130,10 @@ fn fold_mac_(&mac m, ast_fold fld) -> mac { ret rec(node= alt(m.node) { case (mac_invoc(?pth,?args,?body)) { - mac_invoc(fld.fold_path(pth), + mac_invoc(fld.fold_path(pth), ivec::map(fld.fold_expr, args), body) } - case (mac_embed_type(?ty)) { + case (mac_embed_type(?ty)) { mac_embed_type(fld.fold_ty(ty)) } case (mac_embed_block(?block)) { @@ -158,17 +158,17 @@ fn noop_fold_crate(&crate_ c, ast_fold fld) -> crate_ { config=ivec::map(fold_meta_item, c.config)); } -fn noop_fold_crate_directive(&crate_directive_ cd, ast_fold fld) +fn noop_fold_crate_directive(&crate_directive_ cd, ast_fold fld) -> crate_directive_ { ret alt(cd) { - case(cdir_src_mod(?id,?fname,?attrs)) { + case(cdir_src_mod(?id,?fname,?attrs)) { cdir_src_mod(fld.fold_ident(id), fname, attrs) } case(cdir_dir_mod(?id,?fname,?cds,?attrs)) { cdir_dir_mod(fld.fold_ident(id),fname, ivec::map(fld.fold_crate_directive, cds), attrs) } - case(cdir_view_item(?vi)) { + case(cdir_view_item(?vi)) { cdir_view_item(fld.fold_view_item(vi)) } case(cdir_syntax(_)) { cd } @@ -191,7 +191,7 @@ fn noop_fold_native_item(&@native_item ni, ast_fold fld) -> @native_item { node=alt (ni.node) { case (native_item_ty) { native_item_ty } case (native_item_fn(?st, ?fdec, ?typms)) { - native_item_fn(st, + native_item_fn(st, rec(inputs=ivec::map(fold_arg, fdec.inputs), output=fld.fold_ty(fdec.output), @@ -217,7 +217,7 @@ fn noop_fold_item(&@item i, ast_fold fld) -> @item { fn noop_fold_item_underscore(&item_ i, ast_fold fld) -> item_ { fn fold_obj_field_(&obj_field of, ast_fold fld) -> obj_field { - ret rec(mut=of.mut, ty=fld.fold_ty(of.ty), + ret rec(mut=of.mut, ty=fld.fold_ty(of.ty), ident=fld.fold_ident(of.ident), id=of.id); } auto fold_obj_field = bind fold_obj_field_(_,fld); @@ -253,7 +253,7 @@ fn noop_fold_item_underscore(&item_ i, ast_fold fld) -> item_ { fn noop_fold_method(&method_ m, ast_fold fld) -> method_ { ret rec(ident=fld.fold_ident(m.ident), - meth=fld.fold_fn(m.meth), id=m.id); + meth=fld.fold_fn(m.meth), id=m.id); } @@ -319,9 +319,9 @@ fn noop_fold_expr(&expr_ e, ast_fold fld) -> expr_ { } auto fold_field = bind fold_field_(_,fld); fn fold_anon_obj_(&anon_obj ao, ast_fold fld) -> anon_obj { - fn fold_anon_obj_field_(&anon_obj_field aof, ast_fold fld) + fn fold_anon_obj_field_(&anon_obj_field aof, ast_fold fld) -> anon_obj_field { - ret rec(mut=aof.mut, ty=fld.fold_ty(aof.ty), + ret rec(mut=aof.mut, ty=fld.fold_ty(aof.ty), expr=fld.fold_expr(aof.expr), ident=fld.fold_ident(aof.ident), id=aof.id); } @@ -337,7 +337,7 @@ fn noop_fold_expr(&expr_ e, ast_fold fld) -> expr_ { with_obj=option::map(fld.fold_expr, ao.with_obj)) } auto fold_anon_obj = bind fold_anon_obj_(_,fld); - + auto fold_mac = bind fold_mac_(_,fld); ret alt (e) { @@ -362,7 +362,7 @@ fn noop_fold_expr(&expr_ e, ast_fold fld) -> expr_ { expr_bind(fld.fold_expr(f), ivec::map(opt_map_se, args)) } case (expr_spawn(?spawn_dom, ?name, ?f, ?args)) { - expr_spawn(spawn_dom, name, fld.fold_expr(f), + expr_spawn(spawn_dom, name, fld.fold_expr(f), ivec::map(fld.fold_expr, args)) } case (expr_binary(?binop, ?lhs, ?rhs)) { @@ -376,7 +376,7 @@ fn noop_fold_expr(&expr_ e, ast_fold fld) -> expr_ { expr_cast(fld.fold_expr(expr), ty) } case (expr_if(?cond, ?tr, ?fl)) { - expr_if(fld.fold_expr(cond), fld.fold_block(tr), + expr_if(fld.fold_expr(cond), fld.fold_block(tr), option::map(fld.fold_expr, fl)) } case (expr_ternary(?cond, ?tr, ?fl)) { @@ -388,11 +388,11 @@ fn noop_fold_expr(&expr_ e, ast_fold fld) -> expr_ { expr_while(fld.fold_expr(cond), fld.fold_block(body)) } case (expr_for(?decl, ?expr, ?block)) { - expr_for(fld.fold_local(decl), fld.fold_expr(expr), + expr_for(fld.fold_local(decl), fld.fold_expr(expr), fld.fold_block(block)) } case (expr_for_each(?decl, ?expr, ?block)) { - expr_for_each(fld.fold_local(decl), fld.fold_expr(expr), + expr_for_each(fld.fold_local(decl), fld.fold_expr(expr), fld.fold_block(block)) } case (expr_do_while(?block, ?expr)) { @@ -437,10 +437,10 @@ fn noop_fold_expr(&expr_ e, ast_fold fld) -> expr_ { case (expr_fail(?e)) { expr_fail(option::map(fld.fold_expr, e)) } case (expr_break()) { e } case (expr_cont()) { e } - case (expr_ret(?e)) { + case (expr_ret(?e)) { expr_ret(option::map(fld.fold_expr, e)) } - case (expr_put(?e)) { + case (expr_put(?e)) { expr_put(option::map(fld.fold_expr, e)) } case (expr_be(?e)) { expr_be(fld.fold_expr(e)) } @@ -448,10 +448,10 @@ fn noop_fold_expr(&expr_ e, ast_fold fld) -> expr_ { case (expr_assert(?e)) { expr_assert(fld.fold_expr(e)) } case (expr_check(?m, ?e)) { expr_check(m, fld.fold_expr(e)) } case (expr_if_check(?cond, ?tr, ?fl)) { - expr_if_check(fld.fold_expr(cond), fld.fold_block(tr), + expr_if_check(fld.fold_expr(cond), fld.fold_block(tr), option::map(fld.fold_expr, fl)) } - case (expr_port(?ot)) { + case (expr_port(?ot)) { expr_port(alt(ot) { case (option::some(?t)) { option::some(fld.fold_ty(t)) } case (option::none) { option::none } @@ -531,7 +531,7 @@ fn noop_fold_local(&local_ l, ast_fold fld) -> local_ { case (option::none[initializer]) { l.init } case (option::some[initializer](?init)) { option::some[initializer] - (rec(op=init.op, + (rec(op=init.op, expr=fld.fold_expr(init.expr))) } }, @@ -591,7 +591,7 @@ fn dummy_out(ast_fold a) { fn make_fold(&ast_fold_precursor afp) -> ast_fold { - let ast_fold result = + let ast_fold result = @mutable rec(fold_crate = nf_crate_dummy, fold_crate_directive = nf_crate_directive_dummy, fold_view_item = nf_view_item_dummy, @@ -620,7 +620,7 @@ fn make_fold(&ast_fold_precursor afp) -> ast_fold { ret rec(node=afp.fold_crate(c.node, f), span=c.span); } - fn f_crate_directive(&ast_fold_precursor afp, ast_fold f, + fn f_crate_directive(&ast_fold_precursor afp, ast_fold f, &@crate_directive c) -> @crate_directive { ret @rec(node=afp.fold_crate_directive(c.node, f), span=c.span); @@ -669,14 +669,14 @@ fn make_fold(&ast_fold_precursor afp) -> ast_fold { } fn f_fn(&ast_fold_precursor afp, ast_fold f, &_fn x) -> _fn { ret afp.fold_fn(x, f); - } + } fn f_mod(&ast_fold_precursor afp, ast_fold f, &_mod x) -> _mod { ret afp.fold_mod(x, f); } - fn f_native_mod(&ast_fold_precursor afp, ast_fold f, &native_mod x) -> + fn f_native_mod(&ast_fold_precursor afp, ast_fold f, &native_mod x) -> native_mod { ret afp.fold_native_mod(x, f); - } + } fn f_variant(&ast_fold_precursor afp, ast_fold f, &variant x) -> variant { ret rec(node=afp.fold_variant(x.node, f), span=x.span); diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs index a3fd6670db3..29670d21e86 100644 --- a/src/comp/syntax/parse/lexer.rs +++ b/src/comp/syntax/parse/lexer.rs @@ -370,8 +370,8 @@ fn next_token(&reader rdr) -> token::token { case ('?') { rdr.bump(); ret token::QUES; } case (';') { rdr.bump(); ret token::SEMI; } case (',') { rdr.bump(); ret token::COMMA; } - case ('.') { - rdr.bump(); + case ('.') { + rdr.bump(); if (rdr.curr() == '.' && rdr.next() == '.') { rdr.bump(); rdr.bump(); @@ -386,8 +386,8 @@ fn next_token(&reader rdr) -> token::token { case ('[') { rdr.bump(); ret token::LBRACKET; } case (']') { rdr.bump(); ret token::RBRACKET; } case ('@') { rdr.bump(); ret token::AT; } - case ('#') { - rdr.bump(); + case ('#') { + rdr.bump(); if (rdr.curr() == '<') { rdr.bump(); ret token::POUND_LT; diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index b2aa0e7b4dc..a8fd51993b1 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -361,7 +361,7 @@ fn parse_ty_constr(&ast::arg[] fn_args, &parser p) -> @ast::constr { } -// Use the args list to translate each bound variable +// Use the args list to translate each bound variable // mentioned in a constraint to an arg index. // Seems weird to do this in the parser, but I'm not sure how else to. fn parse_constrs(&ast::arg[] args, &parser p) @@ -932,7 +932,7 @@ fn parse_bottom_expr(&parser p) -> @ast::expr { ex = ast::expr_assert(e); hi = e.span.hi; } else if (eat_word(p, "check")) { - /* Should be a predicate (pure boolean function) applied to + /* Should be a predicate (pure boolean function) applied to arguments that are all either slot variables or literals. but the typechecker enforces that. */ @@ -943,7 +943,7 @@ fn parse_bottom_expr(&parser p) -> @ast::expr { /* Same rules as check, except that if check-claims is enabled (a command-line flag), then the parser turns claims into check */ - + auto e = parse_expr(p); hi = e.span.hi; ex = ast::expr_check(ast::unchecked, e); @@ -1310,7 +1310,7 @@ fn parse_else_expr(&parser p) -> @ast::expr { fn parse_head_local(&parser p) -> @ast::local { if (is_word(p, "auto")) { ret parse_auto_local(p); - } else { + } else { ret parse_typed_local(p); } } @@ -1709,7 +1709,7 @@ fn parse_block(&parser p) -> ast::block { be parse_block_tail(p); } -// some blocks start with "#{"... +// some blocks start with "#{"... fn parse_block_tail(&parser p) -> ast::block { auto lo = p.get_lo_pos(); let (@ast::stmt)[] stmts = ~[]; @@ -1865,7 +1865,7 @@ fn parse_dtor(&parser p) -> @ast::method { purity=ast::impure_fn, cf=ast::return, - // I guess dtors can't have constraints? + // I guess dtors can't have constraints? constraints=~[]); let ast::_fn f = rec(decl=d, proto=ast::proto_fn, body=b); let ast::method_ m = @@ -2432,7 +2432,7 @@ fn parse_crate_from_source_str(&str name, &str source, &ast::crate_cfg cfg, } // Parses a source module as a crate -fn parse_crate_mod(&parser p, &ast::crate_cfg cfg, parse_sess sess) +fn parse_crate_mod(&parser p, &ast::crate_cfg cfg, parse_sess sess) -> @ast::crate { auto lo = p.get_lo_pos(); auto crate_attrs = parse_inner_attrs_and_next(p); diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index df573020618..41ba5715d3b 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -574,7 +574,7 @@ fn print_stmt(&ps s, &ast::stmt st) { fn print_block(&ps s, &ast::block blk) { print_possibly_embedded_block(s, blk, false); -} +} fn print_possibly_embedded_block(&ps s, &ast::block blk, bool embedded) { maybe_print_comment(s, blk.span.lo); @@ -1003,13 +1003,13 @@ fn print_expr(&ps s, &@ast::expr expr) { print_expr(s, field.expr); end(s); } - fn get_span(&ast::anon_obj_field f) -> codemap::span { - ret f.ty.span; + fn get_span(&ast::anon_obj_field f) -> codemap::span { + ret f.ty.span; } alt (anon_obj.fields) { case (none) { } case (some(?fields)) { - commasep_cmnt(s, consistent, fields, print_field, + commasep_cmnt(s, consistent, fields, print_field, get_span); } } diff --git a/src/comp/syntax/walk.rs b/src/comp/syntax/walk.rs index ad2edb980b1..a99d980ce9e 100644 --- a/src/comp/syntax/walk.rs +++ b/src/comp/syntax/walk.rs @@ -394,7 +394,7 @@ fn walk_expr(&ast_visitor v, @ast::expr e) { alt (anon_obj.fields) { case (none) { } case (some(?fields)) { - for (ast::anon_obj_field f in fields) { + for (ast::anon_obj_field f in fields) { walk_ty(v, f.ty); walk_expr(v, f.expr); } |
