Skip to content

Commit bb07fe9

Browse files
committed
---
yaml --- r: 145382 b: refs/heads/try2 c: 1676e77 h: refs/heads/master v: v3
1 parent 57956e2 commit bb07fe9

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
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: 7796d519f95305fca9cec9d92d361e3df0dd999c
8+
refs/heads/try2: 1676e77db279772551cf804bafbad5214096b9a9
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/util/common.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ pub fn field_exprs(fields: ~[ast::Field]) -> ~[@ast::Expr] {
6060
fields.map(|f| f.expr)
6161
}
6262

63-
struct LoopQueryVisitor {
64-
p: @fn(&ast::Expr_) -> bool
63+
struct LoopQueryVisitor<'self> {
64+
p: &'self fn(&ast::Expr_) -> bool
6565
}
6666

67-
impl Visitor<@mut bool> for LoopQueryVisitor {
68-
fn visit_expr(&mut self, e:@ast::Expr, flag:@mut bool) {
67+
impl<'self> Visitor<@mut bool> for LoopQueryVisitor<'self> {
68+
fn visit_expr(&mut self, e: @ast::Expr, flag: @mut bool) {
6969
*flag |= (self.p)(&e.node);
7070
match e.node {
7171
// Skip inner loops, since a break in the inner loop isn't a
@@ -78,29 +78,33 @@ impl Visitor<@mut bool> for LoopQueryVisitor {
7878

7979
// Takes a predicate p, returns true iff p is true for any subexpressions
8080
// of b -- skipping any inner loops (loop, while, loop_body)
81-
pub fn loop_query(b: &ast::Block, p: @fn(&ast::Expr_) -> bool) -> bool {
81+
pub fn loop_query(b: &ast::Block, p: &fn(&ast::Expr_) -> bool) -> bool {
8282
let rs = @mut false;
83-
let mut v = LoopQueryVisitor { p: p };
83+
let mut v = LoopQueryVisitor {
84+
p: p,
85+
};
8486
visit::walk_block(&mut v, b, rs);
8587
return *rs;
8688
}
8789

88-
struct BlockQueryVisitor {
89-
p: @fn(@ast::Expr) -> bool
90+
struct BlockQueryVisitor<'self> {
91+
p: &'self fn(@ast::Expr) -> bool
9092
}
9193

92-
impl Visitor<@mut bool> for BlockQueryVisitor {
93-
fn visit_expr(&mut self, e:@ast::Expr, flag:@mut bool) {
94+
impl<'self> Visitor<@mut bool> for BlockQueryVisitor<'self> {
95+
fn visit_expr(&mut self, e: @ast::Expr, flag: @mut bool) {
9496
*flag |= (self.p)(e);
9597
visit::walk_expr(self, e, flag)
9698
}
9799
}
98100

99101
// Takes a predicate p, returns true iff p is true for any subexpressions
100102
// of b -- skipping any inner loops (loop, while, loop_body)
101-
pub fn block_query(b: &ast::Block, p: @fn(@ast::Expr) -> bool) -> bool {
103+
pub fn block_query(b: &ast::Block, p: &fn(@ast::Expr) -> bool) -> bool {
102104
let rs = @mut false;
103-
let mut v = BlockQueryVisitor { p: p };
105+
let mut v = BlockQueryVisitor {
106+
p: p,
107+
};
104108
visit::walk_block(&mut v, b, rs);
105109
return *rs;
106110
}

0 commit comments

Comments
 (0)