@@ -45,7 +45,7 @@ fn default_visitor<E>() -> visitor<E> {
45
45
visit_pat: bind visit_pat::<E>(_, _, _),
46
46
visit_decl: bind visit_decl::<E>(_, _, _),
47
47
visit_expr: bind visit_expr::<E>(_, _, _),
48
- visit_ty: bind visit_ty ::<E>(_, _, _),
48
+ visit_ty: bind skip_ty ::<E>(_, _, _),
49
49
visit_constr: bind visit_constr::<E>(_, _, _, _, _),
50
50
visit_fn: bind visit_fn::<E>(_, _, _, _, _, _, _)};
51
51
}
@@ -109,6 +109,8 @@ fn visit_item<E>(i: @item, e: E, v: vt<E>) {
109
109
}
110
110
}
111
111
112
+ fn skip_ty<E>(_t: @ty, _e: E, _v: vt<E>) {}
113
+
112
114
fn visit_ty<E>(t: @ty, e: E, v: vt<E>) {
113
115
alt t.node {
114
116
ty_nil. {/* no-op */ }
@@ -355,6 +357,8 @@ type simple_visitor =
355
357
visit_constr: fn@(path, span, node_id),
356
358
visit_fn: fn@(_fn, [ty_param], span, fn_ident, node_id)};
357
359
360
+ fn simple_ignore_ty(_t: @ty) {}
361
+
358
362
fn default_simple_visitor() -> simple_visitor {
359
363
ret @{visit_mod: fn(_m: _mod, _sp: span) { },
360
364
visit_view_item: fn(_vi: @view_item) { },
@@ -367,7 +371,7 @@ fn default_simple_visitor() -> simple_visitor {
367
371
visit_pat: fn(_p: @pat) { },
368
372
visit_decl: fn(_d: @decl) { },
369
373
visit_expr: fn(_e: @expr) { },
370
- visit_ty: fn(_t: @ty) { } ,
374
+ visit_ty: simple_ignore_ty ,
371
375
visit_constr: fn(_p: path, _sp: span, _id: node_id) { },
372
376
visit_fn:
373
377
fn(_f: _fn, _tps: [ty_param], _sp: span, _ident: fn_ident,
@@ -436,6 +440,11 @@ fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
436
440
f(ff, tps, sp, ident, id);
437
441
visit_fn(ff, tps, sp, ident, id, e, v);
438
442
}
443
+ let visit_ty = if v.visit_ty == simple_ignore_ty {
444
+ bind skip_ty(_, _, _)
445
+ } else {
446
+ bind v_ty(v.visit_ty, _, _, _)
447
+ };
439
448
ret mk_vt(@{visit_mod: bind v_mod(v.visit_mod, _, _, _, _),
440
449
visit_view_item: bind v_view_item(v.visit_view_item, _, _, _),
441
450
visit_native_item:
@@ -448,7 +457,7 @@ fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
448
457
visit_pat: bind v_pat(v.visit_pat, _, _, _),
449
458
visit_decl: bind v_decl(v.visit_decl, _, _, _),
450
459
visit_expr: bind v_expr(v.visit_expr, _, _, _),
451
- visit_ty: bind v_ty(v. visit_ty, _, _, _) ,
460
+ visit_ty: visit_ty,
452
461
visit_constr: bind v_constr(v.visit_constr, _, _, _, _, _),
453
462
visit_fn: bind v_fn(v.visit_fn, _, _, _, _, _, _, _)});
454
463
}
0 commit comments