Skip to content

Commit 5bca515

Browse files
committed
---
yaml --- r: 144101 b: refs/heads/try2 c: 23ce08a h: refs/heads/master i: 144099: 4f7818d v: v3
1 parent b5a0ef8 commit 5bca515

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 3281d58a5d6b719219c451b490d2758a8770e16a
8+
refs/heads/try2: 23ce08a4cde573f3ab5e3f57a7c5142a472595ff
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/trans/callee.rs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ use middle::trans::type_::Type;
4747

4848
use syntax::ast;
4949
use syntax::ast_map;
50-
use syntax::oldvisit;
50+
use syntax::visit;
51+
use syntax::visit::Visitor;
5152

5253
// Represents a (possibly monomorphized) top-level fn item or method
5354
// item. Note that this is just the fn-ptr and is not a Rust closure
@@ -525,21 +526,29 @@ pub fn trans_lang_call_with_type_params(bcx: @mut Block,
525526
ArgVals(args), Some(dest), DontAutorefArg).bcx;
526527
}
527528

528-
pub fn body_contains_ret(body: &ast::Block) -> bool {
529-
let cx = @mut false;
530-
oldvisit::visit_block(body, (cx, oldvisit::mk_vt(@oldvisit::Visitor {
531-
visit_item: |_i, (_cx, _v)| { },
532-
visit_expr: |e: @ast::expr,
533-
(cx, v): (@mut bool, oldvisit::vt<@mut bool>)| {
529+
530+
struct CalleeTranslationVisitor;
531+
532+
impl Visitor<@mut bool> for CalleeTranslationVisitor {
533+
534+
fn visit_item(&mut self, _:@ast::item, _:@mut bool) { }
535+
536+
fn visit_expr(&mut self, e:@ast::expr, cx:@mut bool) {
537+
534538
if !*cx {
535539
match e.node {
536540
ast::expr_ret(_) => *cx = true,
537-
_ => oldvisit::visit_expr(e, (cx, v)),
541+
_ => visit::walk_expr(self, e, cx),
538542
}
539543
}
540-
},
541-
..*oldvisit::default_visitor()
542-
})));
544+
}
545+
546+
}
547+
548+
pub fn body_contains_ret(body: &ast::Block) -> bool {
549+
let cx = @mut false;
550+
let mut v = CalleeTranslationVisitor;
551+
visit::walk_block(&mut v, body, cx);
543552
*cx
544553
}
545554

0 commit comments

Comments
 (0)