Take &Pat in visit_pat

This commit is contained in:
Seo Sanghyeon 2013-11-26 03:22:21 +09:00
parent eb5cbfebfd
commit 9028330f39
12 changed files with 19 additions and 19 deletions

View File

@ -51,7 +51,7 @@ impl<'self> Visitor<()> for CheckLoanCtxt<'self> {
fn visit_block(&mut self, b:&ast::Block, _:()) {
check_loans_in_block(self, b);
}
fn visit_pat(&mut self, p:@ast::Pat, _:()) {
fn visit_pat(&mut self, p:&ast::Pat, _:()) {
check_loans_in_pat(self, p);
}
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
@ -847,7 +847,7 @@ fn check_loans_in_expr<'a>(this: &mut CheckLoanCtxt<'a>,
}
fn check_loans_in_pat<'a>(this: &mut CheckLoanCtxt<'a>,
pat: @ast::Pat)
pat: &ast::Pat)
{
this.check_for_conflicting_loans(pat.id);
this.check_move_out_from_id(pat.id, pat.span);

View File

@ -87,7 +87,7 @@ impl<'self> visit::Visitor<()> for GatherLoanCtxt<'self> {
fn visit_stmt(&mut self, s:@Stmt, _:()) {
add_stmt_to_map(self, s);
}
fn visit_pat(&mut self, p:@Pat, _:()) {
fn visit_pat(&mut self, p:&Pat, _:()) {
add_pat_to_id_range(self, p);
}
fn visit_local(&mut self, l:@Local, _:()) {
@ -119,7 +119,7 @@ pub fn gather_loans(bccx: &BorrowckCtxt,
}
fn add_pat_to_id_range(this: &mut GatherLoanCtxt,
p: @ast::Pat) {
p: &ast::Pat) {
// NB: This visitor function just adds the pat ids into the id
// range. We gather loans that occur in patterns using the
// `gather_pat()` method below. Eventually these two should be

View File

@ -33,7 +33,7 @@ impl Visitor<bool> for CheckCrateVisitor {
fn visit_item(&mut self, i:@item, env:bool) {
check_item(self, self.sess, self.ast_map, self.def_map, i, env);
}
fn visit_pat(&mut self, p:@Pat, env:bool) {
fn visit_pat(&mut self, p:&Pat, env:bool) {
check_pat(self, p, env);
}
fn visit_expr(&mut self, ex:@Expr, env:bool) {
@ -81,7 +81,7 @@ pub fn check_item(v: &mut CheckCrateVisitor,
}
}
pub fn check_pat(v: &mut CheckCrateVisitor, p: @Pat, _is_const: bool) {
pub fn check_pat(v: &mut CheckCrateVisitor, p: &Pat, _is_const: bool) {
fn is_str(e: @Expr) -> bool {
match e.node {
ExprVstore(

View File

@ -900,7 +900,7 @@ fn check_unsafe_block(cx: &Context, e: &ast::Expr) {
}
}
fn check_unused_mut_pat(cx: &Context, p: @ast::Pat) {
fn check_unused_mut_pat(cx: &Context, p: &ast::Pat) {
match p.node {
ast::PatIdent(ast::BindByValue(ast::MutMutable),
ref path, _) if pat_util::pat_is_binding(cx.tcx.def_map, p)=> {
@ -1119,7 +1119,7 @@ impl<'self> Visitor<()> for Context<'self> {
}
}
fn visit_pat(&mut self, p: @ast::Pat, _: ()) {
fn visit_pat(&mut self, p: &ast::Pat, _: ()) {
check_pat_non_uppercase_statics(self, p);
check_unused_mut_pat(self, p);

View File

@ -739,7 +739,7 @@ impl<'self> Visitor<()> for PrivacyVisitor<'self> {
}
}
fn visit_pat(&mut self, pattern: @ast::Pat, _: ()) {
fn visit_pat(&mut self, pattern: &ast::Pat, _: ()) {
match pattern.node {
ast::PatStruct(_, ref fields, _) => {
match ty::get(ty::pat_ty(self.tcx, pattern)).sty {

View File

@ -340,7 +340,7 @@ fn resolve_arm(visitor: &mut RegionResolutionVisitor,
}
fn resolve_pat(visitor: &mut RegionResolutionVisitor,
pat: @ast::Pat,
pat: &ast::Pat,
cx: Context) {
assert_eq!(cx.var_parent, cx.parent);
parent_to_expr(visitor, cx, pat.id, pat.span);
@ -480,7 +480,7 @@ impl Visitor<Context> for RegionResolutionVisitor {
fn visit_arm(&mut self, a:&Arm, cx:Context) {
resolve_arm(self, a, cx);
}
fn visit_pat(&mut self, p:@Pat, cx:Context) {
fn visit_pat(&mut self, p:&Pat, cx:Context) {
resolve_pat(self, p, cx);
}
fn visit_stmt(&mut self, s:@Stmt, cx:Context) {

View File

@ -375,7 +375,7 @@ impl Visitor<()> for GatherLocalsVisitor {
}
// Add pattern bindings.
fn visit_pat(&mut self, p:@ast::Pat, _:()) {
fn visit_pat(&mut self, p:&ast::Pat, _:()) {
match p.node {
ast::PatIdent(_, ref path, _)
if pat_util::pat_is_binding(self.fcx.ccx.tcx.def_map, p) => {

View File

@ -278,7 +278,7 @@ fn visit_block(b: &ast::Block, wbcx: &mut WbCtxt) {
visit::walk_block(wbcx, b, ());
}
fn visit_pat(p: @ast::Pat, wbcx: &mut WbCtxt) {
fn visit_pat(p: &ast::Pat, wbcx: &mut WbCtxt) {
if !wbcx.success {
return;
}
@ -323,7 +323,7 @@ impl Visitor<()> for WbCtxt {
fn visit_stmt(&mut self, s:@ast::Stmt, _:()) { visit_stmt(s, self); }
fn visit_expr(&mut self, ex:@ast::Expr, _:()) { visit_expr(ex, self); }
fn visit_block(&mut self, b:&ast::Block, _:()) { visit_block(b, self); }
fn visit_pat(&mut self, p:@ast::Pat, _:()) { visit_pat(p, self); }
fn visit_pat(&mut self, p:&ast::Pat, _:()) { visit_pat(p, self); }
fn visit_local(&mut self, l:@ast::Local, _:()) { visit_local(l, self); }
}

View File

@ -242,7 +242,7 @@ impl Ctx {
visit::walk_block(self, b, ());
}
fn map_pat(&mut self, pat: @Pat) {
fn map_pat(&mut self, pat: &Pat) {
match pat.node {
PatIdent(_, ref path, _) => {
// Note: this is at least *potentially* a pattern...
@ -345,7 +345,7 @@ impl Visitor<()> for Ctx {
self.path.pop();
}
fn visit_pat(&mut self, pat: @Pat, _: ()) {
fn visit_pat(&mut self, pat: &Pat, _: ()) {
self.map_pat(pat);
visit::walk_pat(self, pat, ())
}

View File

@ -497,7 +497,7 @@ impl<'self, O: IdVisitingOperation> Visitor<()> for IdVisitor<'self, O> {
visit::walk_stmt(self, statement, env)
}
fn visit_pat(&mut self, pattern: @Pat, env: ()) {
fn visit_pat(&mut self, pattern: &Pat, env: ()) {
self.operation.visit_id(pattern.id);
visit::walk_pat(self, pattern, env)
}

View File

@ -612,7 +612,7 @@ struct NewNameFinderContext {
}
impl Visitor<()> for NewNameFinderContext {
fn visit_pat(&mut self, pattern: @ast::Pat, _: ()) {
fn visit_pat(&mut self, pattern: &ast::Pat, _: ()) {
match *pattern {
// we found a pat_ident!
ast::Pat {

View File

@ -78,7 +78,7 @@ pub trait Visitor<E:Clone> {
fn visit_block(&mut self, b:&Block, e:E) { walk_block(self, b, e) }
fn visit_stmt(&mut self, s:@Stmt, e:E) { walk_stmt(self, s, e) }
fn visit_arm(&mut self, a:&Arm, e:E) { walk_arm(self, a, e) }
fn visit_pat(&mut self, p:@Pat, e:E) { walk_pat(self, p, e) }
fn visit_pat(&mut self, p:&Pat, e:E) { walk_pat(self, p, e) }
fn visit_decl(&mut self, d:@Decl, e:E) { walk_decl(self, d, e) }
fn visit_expr(&mut self, ex:@Expr, e:E) { walk_expr(self, ex, e) }
fn visit_expr_post(&mut self, _ex:@Expr, _e:E) { }