From 60f47eabe2ef2730b98713dee2b5fd59513e8c6c Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 6 Aug 2012 18:54:20 -0700 Subject: rustc: Parse and stub (broken) typechecking for bounded function types --- src/libsyntax/visit.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/libsyntax/visit.rs') diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index c988c89f8c2..08572e83f6e 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -195,8 +195,9 @@ fn visit_ty(t: @ty, e: E, v: vt) { ty_tup(ts) => for ts.each |tt| { v.visit_ty(tt, e, v); } - ty_fn(_, decl) => { + ty_fn(_, bounds, decl) => { for decl.inputs.each |a| { v.visit_ty(a.ty, e, v); } + visit_ty_param_bounds(bounds, e, v); v.visit_ty(decl.output, e, v); } ty_path(p, _) => visit_path(p, e, v), @@ -251,14 +252,18 @@ fn visit_foreign_item(ni: @foreign_item, e: E, v: vt) { } } +fn visit_ty_param_bounds(bounds: @~[ty_param_bound], e: E, v: vt) { + for vec::each(*bounds) |bound| { + match bound { + bound_trait(t) => v.visit_ty(t, e, v), + bound_copy | bound_send | bound_const | bound_owned => () + } + } +} + fn visit_ty_params(tps: ~[ty_param], e: E, v: vt) { for tps.each |tp| { - for vec::each(*tp.bounds) |bound| { - match bound { - bound_trait(t) => v.visit_ty(t, e, v), - bound_copy | bound_send | bound_const | bound_owned => () - } - } + visit_ty_param_bounds(tp.bounds, e, v); } } -- cgit 1.4.1-3-g733a5