diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-06-19 19:34:01 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-06-20 17:27:28 -0700 |
| commit | 4dcf84e4f4a9a54254fd426609ad9f1ccffae3b9 (patch) | |
| tree | 487ddbc8454889971d4487744d8143410be097f1 /src/libsyntax | |
| parent | bcd3942f41252b989029683c33e61b3c92bf92ac (diff) | |
| download | rust-4dcf84e4f4a9a54254fd426609ad9f1ccffae3b9.tar.gz rust-4dcf84e4f4a9a54254fd426609ad9f1ccffae3b9.zip | |
Remove bind. Issue #2189
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/ext/auto_serialize.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/fmt.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/qquote.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/simplext.rs | 50 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 32 | ||||
| -rw-r--r-- | src/libsyntax/parse.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 27 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 24 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 81 |
12 files changed, 111 insertions, 140 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index a356e716a9a..98cf35efdc8 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -300,7 +300,6 @@ enum expr_ { expr_rec([field], option<@expr>), expr_call(@expr, [@expr], bool), // True iff last argument is a block expr_tup([@expr]), - expr_bind(@expr, [option<@expr>]), expr_binary(binop, @expr, @expr), expr_unary(unop, @expr), expr_lit(@lit), diff --git a/src/libsyntax/ext/auto_serialize.rs b/src/libsyntax/ext/auto_serialize.rs index 888ff7d4ef2..75a88fb221b 100644 --- a/src/libsyntax/ext/auto_serialize.rs +++ b/src/libsyntax/ext/auto_serialize.rs @@ -267,7 +267,7 @@ impl helpers for ext_ctxt { } let fld = fold::make_fold(@{ - new_span: repl_sp(_, ast_util::dummy_sp(), span) + new_span: {|a|repl_sp(a, ast_util::dummy_sp(), span)} with *fold::default_ast_fold() }); @@ -757,8 +757,8 @@ fn ty_fns(cx: ext_ctxt, name: ast::ident, ty: @ast::ty, tps: [ast::ty_param]) let span = ty.span; [ - mk_ser_fn(cx, span, name, tps, ser_ty(_, _, ty, _, _)), - mk_deser_fn(cx, span, name, tps, deser_ty(_, _, ty, _)) + mk_ser_fn(cx, span, name, tps, {|a,b,c,d|ser_ty(a, b, ty, c, d)}), + mk_deser_fn(cx, span, name, tps, {|a,b,c|deser_ty(a, b, ty, c)}) ] } @@ -860,8 +860,8 @@ fn enum_fns(cx: ext_ctxt, e_name: ast::ident, e_span: span, -> [@ast::item] { [ mk_ser_fn(cx, e_span, e_name, tps, - ser_enum(_, _, e_name, e_span, variants, _, _)), + {|a,b,c,d|ser_enum(a, b, e_name, e_span, variants, c, d)}), mk_deser_fn(cx, e_span, e_name, tps, - deser_enum(_, _, e_name, e_span, variants, _)) + {|a,b,c|deser_enum(a, b, e_name, e_span, variants, c)}) ] } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 1704e3afc54..ba44404fe24 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -130,10 +130,10 @@ fn expand_crate(parse_sess: parse::parse_sess, let afp = default_ast_fold(); let cx: ext_ctxt = mk_ctxt(parse_sess, cfg); let f_pre = - @{fold_expr: bind expand_expr(exts, cx, _, _, _, afp.fold_expr), - fold_mod: bind expand_mod_items(exts, cx, _, _, afp.fold_mod), - fold_item: bind expand_item(cx, _, _, afp.fold_item), - new_span: bind new_span(cx, _) + @{fold_expr: {|a,b,c|expand_expr(exts, cx, a, b, c, afp.fold_expr)}, + fold_mod: {|a,b|expand_mod_items(exts, cx, a, b, afp.fold_mod)}, + fold_item: {|a,b|expand_item(cx, a, b, afp.fold_item)}, + new_span: {|a|new_span(cx, a)} with *afp}; let f = make_fold(f_pre); let cm = parse_expr_from_source_str("<core-macros>", diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index 4725f5a1977..5ea8b677675 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -23,7 +23,9 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: span, arg: ast::mac_arg, fn parse_fmt_err_(cx: ext_ctxt, sp: span, msg: str) -> ! { cx.span_fatal(sp, msg); } - let parse_fmt_err = bind parse_fmt_err_(cx, fmtspan, _); + let parse_fmt_err = fn@(s: str) -> ! { + parse_fmt_err_(cx, fmtspan, s) + }; let pieces = parse_fmt_string(fmt, parse_fmt_err); ret pieces_to_expr(cx, sp, pieces, args); } diff --git a/src/libsyntax/ext/qquote.rs b/src/libsyntax/ext/qquote.rs index 316ac7603fb..9830c379ef6 100644 --- a/src/libsyntax/ext/qquote.rs +++ b/src/libsyntax/ext/qquote.rs @@ -274,10 +274,10 @@ fn replace<T>(node: T, repls: [fragment], ff: fn (ast_fold, T) -> T) -> T { let aft = default_ast_fold(); - let f_pre = @{fold_expr: bind replace_expr(repls, _, _, _, - aft.fold_expr), - fold_ty: bind replace_ty(repls, _, _, _, - aft.fold_ty) + let f_pre = @{fold_expr: {|a,b,c|replace_expr(repls, a, b, c, + aft.fold_expr)}, + fold_ty: {|a,b,c|replace_ty(repls, a, b, c, + aft.fold_ty)} with *aft}; ret ff(make_fold(f_pre), node); } diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs index e6b1c84965e..bf3014d1621 100644 --- a/src/libsyntax/ext/simplext.rs +++ b/src/libsyntax/ext/simplext.rs @@ -113,7 +113,7 @@ fn a_d_map(ad: arb_depth<matchable>, f: selector) -> match_result { alt ad { leaf(x) { ret f(x); } seq(ads, span) { - alt option_flatten_map(bind a_d_map(_, f), *ads) { + alt option_flatten_map({|x| a_d_map(x, f)}, *ads) { none { ret none; } some(ts) { ret some(seq(@ts, span)); } } @@ -128,7 +128,7 @@ fn compose_sels(s1: selector, s2: selector) -> selector { some(matches) { a_d_map(matches, s2) } } } - ret bind scomp(s1, s2, _); + ret {|x|scomp(s1, s2, x)}; } @@ -190,16 +190,22 @@ fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr { } let afp = default_ast_fold(); let f_pre = - @{fold_ident: bind transcribe_ident(cx, b, idx_path, _, _), - fold_path: bind transcribe_path(cx, b, idx_path, _, _), - fold_expr: - bind transcribe_expr(cx, b, idx_path, _, _, _, afp.fold_expr), - fold_ty: bind transcribe_type(cx, b, idx_path, - _, _, _, afp.fold_ty), - fold_block: - bind transcribe_block(cx, b, idx_path, _, _, _, afp.fold_block), - map_exprs: bind transcribe_exprs(cx, b, idx_path, _, _), - new_id: bind new_id(_, cx) + @{fold_ident: {|x,y|transcribe_ident(cx, b, idx_path, x, y)}, + fold_path: {|x,y|transcribe_path(cx, b, idx_path, x, y)}, + fold_expr: {|x,y,z| + transcribe_expr(cx, b, idx_path, x, y, z, afp.fold_expr) + }, + fold_ty: {|x,y,z| + transcribe_type(cx, b, idx_path, + x, y, z, afp.fold_ty) + }, + fold_block: {|x,y,z| + transcribe_block(cx, b, idx_path, x, y, z, afp.fold_block) + }, + map_exprs: {|x,y| + transcribe_exprs(cx, b, idx_path, x, y) + }, + new_id: {|x|new_id(x, cx)} with *afp}; let f = make_fold(f_pre); let result = f.fold_expr(body); @@ -249,7 +255,7 @@ fn free_vars(b: bindings, e: @expr, it: fn(ident)) { // using fold is a hack: we want visit, but it doesn't hit idents ) : // solve this with macros let f_pre = - @{fold_ident: bind mark_ident(_, _, b, idents) + @{fold_ident: {|x,y|mark_ident(x, y, b, idents)} with *default_ast_fold()}; let f = make_fold(f_pre); f.fold_expr(e); // ignore result @@ -475,7 +481,7 @@ fn p_t_s_rec(cx: ext_ctxt, m: matchable, s: selector, b: binders) { _ { cx.bug("broken traversal in p_t_s_r") } } } - b.literal_ast_matchers.push(bind select(cx, _, e)); + b.literal_ast_matchers.push({|x|select(cx, x, e)}); } } } @@ -517,7 +523,7 @@ fn p_t_s_r_path(cx: ext_ctxt, p: @path, s: selector, b: binders) { if b.real_binders.contains_key(p_id) { cx.span_fatal(p.span, "duplicate binding identifier"); } - b.real_binders.insert(p_id, compose_sels(s, bind select(cx, _))); + b.real_binders.insert(p_id, compose_sels(s, {|x|select(cx, x)})); } none { } } @@ -562,7 +568,7 @@ fn p_t_s_r_mac(cx: ext_ctxt, mac: ast::mac, s: selector, b: binders) { _ { none } } } - let final_step = bind select_pt_1(cx, _, select_pt_2); + let final_step = {|x|select_pt_1(cx, x, select_pt_2)}; b.real_binders.insert(id, compose_sels(s, final_step)); } none { no_des(cx, pth.span, "under `#<>`"); } @@ -582,7 +588,7 @@ fn p_t_s_r_mac(cx: ext_ctxt, mac: ast::mac, s: selector, b: binders) { _ { none } } } - let final_step = bind select_pt_1(cx, _, select_pt_2); + let final_step = {|x|select_pt_1(cx, x, select_pt_2)}; b.real_binders.insert(id, compose_sels(s, final_step)); } none { no_des(cx, blk.span, "under `#{}`"); } @@ -619,7 +625,7 @@ fn p_t_s_r_ellipses(cx: ext_ctxt, repeat_me: @expr, offset: uint, s: selector, } } p_t_s_rec(cx, match_expr(repeat_me), - compose_sels(s, bind select(cx, repeat_me, offset, _)), b); + compose_sels(s, {|x|select(cx, repeat_me, offset, x)}), b); } @@ -643,7 +649,7 @@ fn p_t_s_r_length(cx: ext_ctxt, len: uint, at_least: bool, s: selector, } } b.literal_ast_matchers.push( - compose_sels(s, bind len_select(cx, _, at_least, len))); + compose_sels(s, {|x|len_select(cx, x, at_least, len)})); } fn p_t_s_r_actual_vector(cx: ext_ctxt, elts: [@expr], _repeat_after: bool, @@ -664,7 +670,7 @@ fn p_t_s_r_actual_vector(cx: ext_ctxt, elts: [@expr], _repeat_after: bool, } } p_t_s_rec(cx, match_expr(elts[idx]), - compose_sels(s, bind select(cx, _, idx)), b); + compose_sels(s, {|x, copy idx|select(cx, x, idx)}), b); idx += 1u; } } @@ -739,7 +745,9 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg, } } - let ext = bind generic_extension(_, _, _, _, clauses); + let ext = {|a,b,c,d, move clauses| + generic_extension(a,b,c,d,clauses) + }; ret {ident: alt macro_name { diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 7ddbfb52e94..0589e48489c 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -87,7 +87,7 @@ fn fold_meta_item_(&&mi: @meta_item, fld: ast_fold) -> @meta_item { alt mi.node { meta_word(id) { meta_word(fld.fold_ident(id)) } meta_list(id, mis) { - let fold_meta_item = bind fold_meta_item_(_, fld); + let fold_meta_item = {|x|fold_meta_item_(x, fld)}; meta_list(/* FIXME: bad */ copy id, vec::map(mis, fold_meta_item)) } @@ -130,7 +130,7 @@ fn fold_mac_(m: mac, fld: ast_fold) -> mac { } fn fold_fn_decl(decl: ast::fn_decl, fld: ast_fold) -> ast::fn_decl { - ret {inputs: vec::map(decl.inputs, bind fold_arg_(_, fld)), + ret {inputs: vec::map(decl.inputs, {|x| fold_arg_(x, fld)}), output: fld.fold_ty(decl.output), purity: decl.purity, cf: decl.cf, @@ -147,16 +147,16 @@ fn fold_ty_param_bound(tpb: ty_param_bound, fld: ast_fold) -> ty_param_bound { fn fold_ty_param(tp: ty_param, fld: ast_fold) -> ty_param { {ident: /* FIXME: bad */ copy tp.ident, id: fld.new_id(tp.id), - bounds: @vec::map(*tp.bounds, fold_ty_param_bound(_, fld))} + bounds: @vec::map(*tp.bounds, {|x|fold_ty_param_bound(x, fld)})} } fn fold_ty_params(tps: [ty_param], fld: ast_fold) -> [ty_param] { - vec::map(tps, fold_ty_param(_, fld)) + vec::map(tps, {|x|fold_ty_param(x, fld)}) } fn noop_fold_crate(c: crate_, fld: ast_fold) -> crate_ { - let fold_meta_item = bind fold_meta_item_(_, fld); - let fold_attribute = bind fold_attribute_(_, fld); + let fold_meta_item = {|x|fold_meta_item_(x, fld)}; + let fold_attribute = {|x|fold_attribute_(x, fld)}; ret {directives: vec::map(c.directives, fld.fold_crate_directive), module: fld.fold_mod(c.module), @@ -186,8 +186,8 @@ fn noop_fold_view_item(vi: view_item_, _fld: ast_fold) -> view_item_ { fn noop_fold_native_item(&&ni: @native_item, fld: ast_fold) -> @native_item { - let fold_arg = bind fold_arg_(_, fld); - let fold_attribute = bind fold_attribute_(_, fld); + let fold_arg = {|x|fold_arg_(x, fld)}; + let fold_attribute = {|x|fold_attribute_(x, fld)}; ret @{ident: fld.fold_ident(ni.ident), attrs: vec::map(ni.attrs, fold_attribute), @@ -209,7 +209,7 @@ fn noop_fold_native_item(&&ni: @native_item, fld: ast_fold) -> @native_item { } fn noop_fold_item(&&i: @item, fld: ast_fold) -> @item { - let fold_attribute = bind fold_attribute_(_, fld); + let fold_attribute = {|x|fold_attribute_(x, fld)}; ret @{ident: fld.fold_ident(i.ident), attrs: vec::map(i.attrs, fold_attribute), @@ -381,9 +381,9 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ { expr: fld.fold_expr(field.node.expr)}, span: fld.new_span(field.span)}; } - let fold_field = bind fold_field_(_, fld); + let fold_field = {|x|fold_field_(x, fld)}; - let fold_mac = bind fold_mac_(_, fld); + let fold_mac = {|x|fold_mac_(x, fld)}; ret alt e { expr_new(p, i, v) { @@ -406,10 +406,6 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ { expr_call(fld.fold_expr(f), fld.map_exprs(fld.fold_expr, args), blk) } - expr_bind(f, args) { - let opt_map_se = bind option::map(_, fld.fold_expr); - expr_bind(fld.fold_expr(f), vec::map(args, opt_map_se)) - } expr_binary(binop, lhs, rhs) { expr_binary(binop, fld.fold_expr(lhs), fld.fold_expr(rhs)) } @@ -483,7 +479,7 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ { } fn noop_fold_ty(t: ty_, fld: ast_fold) -> ty_ { - let fold_mac = bind fold_mac_(_, fld); + let fold_mac = {|x|fold_mac_(x, fld)}; fn fold_mt(mt: mt, fld: ast_fold) -> mt { {ty: fld.fold_ty(mt.ty), mutbl: mt.mutbl} } @@ -536,10 +532,10 @@ fn noop_fold_variant(v: variant_, fld: ast_fold) -> variant_ { fn fold_variant_arg_(va: variant_arg, fld: ast_fold) -> variant_arg { ret {ty: fld.fold_ty(va.ty), id: fld.new_id(va.id)}; } - let fold_variant_arg = bind fold_variant_arg_(_, fld); + let fold_variant_arg = {|x|fold_variant_arg_(x, fld)}; let args = vec::map(v.args, fold_variant_arg); - let fold_attribute = bind fold_attribute_(_, fld); + let fold_attribute = {|x|fold_attribute_(x, fld)}; let attrs = vec::map(v.attrs, fold_attribute); let de = alt v.disr_expr { diff --git a/src/libsyntax/parse.rs b/src/libsyntax/parse.rs index b483e1eb9e4..4ebdd0dd5b5 100644 --- a/src/libsyntax/parse.rs +++ b/src/libsyntax/parse.rs @@ -17,8 +17,9 @@ import attr::parser_attr; import common::parser_common; import ast::node_id; import util::interner; -import lexer::{string_reader_as_reader, tt_reader_as_reader, - reader, string_reader, tt_reader}; +// FIXME: resolve badness +import lexer::*;//{string_reader_as_reader, tt_reader_as_reader, + //reader, string_reader, tt_reader}; import diagnostic::{span_handler, mk_span_handler, mk_handler, emitter}; type parse_sess = @{ diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 45badde0016..146c3ab3de9 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -829,14 +829,6 @@ class parser { let ex_ext = self.parse_syntax_ext(); hi = ex_ext.span.hi; ex = ex_ext.node; - } else if self.eat_keyword("bind") { - let e = self.parse_expr_res(RESTRICT_NO_CALL_EXPRS); - let es = self.parse_unspanned_seq( - token::LPAREN, token::RPAREN, - seq_sep_trailing_disallowed(token::COMMA), - {|p| p.parse_expr_or_hole()}); - hi = self.span.hi; - ex = expr_bind(e, es); } else if self.eat_keyword("fail") { if can_begin_expr(self.token) { let e = self.parse_expr(); @@ -1008,19 +1000,13 @@ class parser { alt copy self.token { // expr(...) token::LPAREN if self.permits_call() { - let es_opt = self.parse_unspanned_seq( + let es = self.parse_unspanned_seq( token::LPAREN, token::RPAREN, seq_sep_trailing_disallowed(token::COMMA), - {|p| p.parse_expr_or_hole()}); + {|p| p.parse_expr()}); hi = self.span.hi; - let nd = - if vec::any(es_opt, {|e| option::is_none(e) }) { - expr_bind(self.to_expr(e), es_opt) - } else { - let es = vec::map(es_opt) {|e| option::get(e) }; - expr_call(self.to_expr(e), es, false) - }; + let nd = expr_call(self.to_expr(e), es, false); e = self.mk_pexpr(lo, hi, nd); } @@ -1370,13 +1356,6 @@ class parser { ret self.parse_expr_res(UNRESTRICTED); } - fn parse_expr_or_hole() -> option<@expr> { - alt self.token { - token::UNDERSCORE { self.bump(); ret none; } - _ { ret some(self.parse_expr()); } - } - } - fn parse_expr_res(r: restriction) -> @expr { let old = self.restriction; self.restriction = r; diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index ec14778dc02..39327f1efad 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -250,7 +250,6 @@ fn contextual_keyword_table() -> hashmap<str, ()> { let words = str_hash(); let keys = [ "as", - "bind", "else", "implements", "move", diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index e0e30dc72fc..6bd9e79b727 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -102,7 +102,7 @@ fn typarams_to_str(tps: [ast::ty_param]) -> str { } fn path_to_str(&&p: @ast::path) -> str { - ret to_str(p, bind print_path(_, _, false)); + ret to_str(p, {|a,b|print_path(a, b, false)}); } fn fun_to_str(decl: ast::fn_decl, name: ast::ident, @@ -840,7 +840,7 @@ fn print_mac(s: ps, m: ast::mac) { some(@{node: ast::expr_vec(_, _), _}) { } _ { word(s.s, " "); } } - option::iter(arg, bind print_expr(s, _)); + option::iter(arg, {|a|print_expr(s, a)}); // FIXME: extension 'body' (#2339) } ast::mac_embed_type(ty) { @@ -938,24 +938,6 @@ fn print_expr(s: ps, &&expr: @ast::expr) { print_expr(s, option::get(blk)); } } - ast::expr_bind(func, args) { - fn print_opt(s: ps, expr: option<@ast::expr>) { - alt expr { - some(expr) { print_expr(s, expr); } - _ { word(s.s, "_"); } - } - } - - // "bind" keyword is only needed if there are no "_" arguments. - if !vec::any(args) {|arg| option::is_none(arg) } { - word_nbsp(s, "bind"); - } - - print_expr(s, func); - popen(s); - commasep(s, inconsistent, args, print_opt); - pclose(s); - } ast::expr_binary(op, lhs, rhs) { let prec = operator_prec(op); print_op_maybe_parens(s, lhs, prec); @@ -1780,7 +1762,7 @@ fn ast_ty_fn_constr_to_str(&&c: @ast::constr) -> str { } fn ast_fn_constr_to_str(decl: ast::fn_decl, &&c: @ast::constr) -> str { - let arg_to_str = bind fn_arg_idx_to_str(decl, _); + let arg_to_str = {|a|fn_arg_idx_to_str(decl, a)}; ret path_to_str(c.node.path) + constr_args_to_str(arg_to_str, c.node.args); } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 4a68850674d..3b5b73d78de 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -65,22 +65,22 @@ type visitor<E> = visit_class_item: fn@(@class_member, E, vt<E>)}; fn default_visitor<E>() -> visitor<E> { - ret @{visit_mod: bind visit_mod::<E>(_, _, _, _, _), - visit_view_item: bind visit_view_item::<E>(_, _, _), - visit_native_item: bind visit_native_item::<E>(_, _, _), - visit_item: bind visit_item::<E>(_, _, _), - visit_local: bind visit_local::<E>(_, _, _), - visit_block: bind visit_block::<E>(_, _, _), - visit_stmt: bind visit_stmt::<E>(_, _, _), - visit_arm: bind visit_arm::<E>(_, _, _), - visit_pat: bind visit_pat::<E>(_, _, _), - visit_decl: bind visit_decl::<E>(_, _, _), - visit_expr: bind visit_expr::<E>(_, _, _), - visit_ty: bind skip_ty::<E>(_, _, _), - visit_ty_params: bind visit_ty_params::<E>(_, _, _), - visit_constr: bind visit_constr::<E>(_, _, _, _, _), - visit_fn: bind visit_fn::<E>(_, _, _, _, _, _, _), - visit_class_item: bind visit_class_item::<E>(_,_,_)}; + ret @{visit_mod: {|a,b,c,d,e|visit_mod::<E>(a, b, c, d, e)}, + visit_view_item: {|a,b,c|visit_view_item::<E>(a, b, c)}, + visit_native_item: {|a,b,c|visit_native_item::<E>(a, b, c)}, + visit_item: {|a,b,c|visit_item::<E>(a, b, c)}, + visit_local: {|a,b,c|visit_local::<E>(a, b, c)}, + visit_block: {|a,b,c|visit_block::<E>(a, b, c)}, + visit_stmt: {|a,b,c|visit_stmt::<E>(a, b, c)}, + visit_arm: {|a,b,c|visit_arm::<E>(a, b, c)}, + visit_pat: {|a,b,c|visit_pat::<E>(a, b, c)}, + visit_decl: {|a,b,c|visit_decl::<E>(a, b, c)}, + visit_expr: {|a,b,c|visit_expr::<E>(a, b, c)}, + visit_ty: {|a,b,c|skip_ty::<E>(a, b, c)}, + visit_ty_params: {|a,b,c|visit_ty_params::<E>(a, b, c)}, + visit_constr: {|a,b,c,d,e|visit_constr::<E>(a, b, c, d, e)}, + visit_fn: {|a,b,c,d,e,f,g|visit_fn::<E>(a, b, c, d, e, f, g)}, + visit_class_item: {|a,b,c|visit_class_item::<E>(a, b, c)}}; } fn visit_crate<E>(c: crate, e: E, v: vt<E>) { @@ -377,10 +377,6 @@ fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) { visit_exprs(args, e, v); v.visit_expr(callee, e, v); } - expr_bind(callee, args) { - v.visit_expr(callee, e, v); - for args.each {|eo| visit_expr_opt(eo, e, v); } - } expr_binary(_, a, b) { v.visit_expr(a, e, v); v.visit_expr(b, e, v); } expr_addr_of(_, x) | expr_unary(_, x) | expr_loop_body(x) | expr_do_body(x) | @@ -559,9 +555,9 @@ fn mk_simple_visitor(v: simple_visitor) -> vt<()> { visit_fn(fk, decl, body, sp, id, e, v); } let visit_ty = if v.visit_ty == simple_ignore_ty { - bind skip_ty(_, _, _) + {|a,b,c| skip_ty(a, b, c)} } else { - bind v_ty(v.visit_ty, _, _, _) + {|a,b,c| v_ty(v.visit_ty, a, b, c)} }; fn v_class_item(f: fn@(@class_member), cm: @class_member, &&e: (), @@ -569,24 +565,33 @@ fn mk_simple_visitor(v: simple_visitor) -> vt<()> { f(cm); visit_class_item(cm, e, v); } - ret mk_vt(@{visit_mod: bind v_mod(v.visit_mod, _, _, _, _, _), - visit_view_item: bind v_view_item(v.visit_view_item, _, _, _), + ret mk_vt(@{visit_mod: {|a,b,c,d,e|v_mod(v.visit_mod, a, b, c, d, e)}, + visit_view_item: {|a,b,c| + v_view_item(v.visit_view_item, a, b, c) + }, visit_native_item: - bind v_native_item(v.visit_native_item, _, _, _), - visit_item: bind v_item(v.visit_item, _, _, _), - visit_local: bind v_local(v.visit_local, _, _, _), - visit_block: bind v_block(v.visit_block, _, _, _), - visit_stmt: bind v_stmt(v.visit_stmt, _, _, _), - visit_arm: bind v_arm(v.visit_arm, _, _, _), - visit_pat: bind v_pat(v.visit_pat, _, _, _), - visit_decl: bind v_decl(v.visit_decl, _, _, _), - visit_expr: bind v_expr(v.visit_expr, _, _, _), + {|a,b,c|v_native_item(v.visit_native_item, a, b, c)}, + visit_item: {|a,b,c|v_item(v.visit_item, a, b, c)}, + visit_local: {|a,b,c|v_local(v.visit_local, a, b, c)}, + visit_block: {|a,b,c|v_block(v.visit_block, a, b, c)}, + visit_stmt: {|a,b,c|v_stmt(v.visit_stmt, a, b, c)}, + visit_arm: {|a,b,c|v_arm(v.visit_arm, a, b, c)}, + visit_pat: {|a,b,c|v_pat(v.visit_pat, a, b, c)}, + visit_decl: {|a,b,c|v_decl(v.visit_decl, a, b, c)}, + visit_expr: {|a,b,c|v_expr(v.visit_expr, a, b, c)}, visit_ty: visit_ty, - visit_ty_params: bind v_ty_params(v.visit_ty_params, _, _, _), - visit_constr: bind v_constr(v.visit_constr, _, _, _, _, _), - visit_fn: bind v_fn(v.visit_fn, _, _, _, _, _, _, _), - visit_class_item: bind v_class_item(v.visit_class_item, _, _, - _) + visit_ty_params: {|a,b,c| + v_ty_params(v.visit_ty_params, a, b, c) + }, + visit_constr: {|a,b,c,d,e| + v_constr(v.visit_constr, a, b, c, d, e) + }, + visit_fn: {|a,b,c,d,e,f,g| + v_fn(v.visit_fn, a, b, c, d, e, f, g) + }, + visit_class_item: {|a,b,c| + v_class_item(v.visit_class_item, a, b, c) + } }); } |
