Remove fk_anon

This commit is contained in:
Seo Sanghyeon
2013-12-12 23:01:47 +09:00
parent 1b12dca7f9
commit 5499b45323
8 changed files with 8 additions and 13 deletions

View File

@@ -699,7 +699,6 @@ fn check_loans_in_fn<'a>(this: &mut CheckLoanCtxt<'a>,
return; return;
} }
visit::fk_anon(..) |
visit::fk_fn_block(..) => { visit::fk_fn_block(..) => {
check_captured_variables(this, id, sp); check_captured_variables(this, id, sp);
} }

View File

@@ -140,7 +140,7 @@ fn gather_loans_in_fn(this: &mut GatherLoanCtxt,
} }
// Visit closures as part of the containing item. // Visit closures as part of the containing item.
&visit::fk_anon(..) | &visit::fk_fn_block(..) => { &visit::fk_fn_block(..) => {
this.push_repeating_id(body.id); this.push_repeating_id(body.id);
visit::walk_fn(this, fk, decl, body, sp, id, ()); visit::walk_fn(this, fk, decl, body, sp, id, ());
this.pop_repeating_id(body.id); this.pop_repeating_id(body.id);

View File

@@ -127,7 +127,6 @@ fn borrowck_fn(this: &mut BorrowckCtxt,
sp: Span, sp: Span,
id: ast::NodeId) { id: ast::NodeId) {
match fk { match fk {
&visit::fk_anon(..) |
&visit::fk_fn_block(..) => { &visit::fk_fn_block(..) => {
// Closures are checked as part of their containing fn item. // Closures are checked as part of their containing fn item.
} }

View File

@@ -401,7 +401,7 @@ fn visit_fn(v: &mut LivenessVisitor,
sty_static => {} sty_static => {}
} }
} }
visit::fk_item_fn(..) | visit::fk_anon(..) | visit::fk_fn_block(..) => {} visit::fk_item_fn(..) | visit::fk_fn_block(..) => {}
} }
// gather up the various local variables, significant expressions, // gather up the various local variables, significant expressions,

View File

@@ -456,7 +456,6 @@ fn resolve_fn(visitor: &mut RegionResolutionVisitor,
visit::fk_method(..) => { visit::fk_method(..) => {
Context {parent: None, var_parent: None, ..cx} Context {parent: None, var_parent: None, ..cx}
} }
visit::fk_anon(..) |
visit::fk_fn_block(..) => { visit::fk_fn_block(..) => {
cx cx
} }

View File

@@ -97,7 +97,7 @@ impl<'a> Visitor<&'a ScopeChain<'a>> for LifetimeContext {
visit::walk_fn(self, fk, fd, b, s, n, &scope1); visit::walk_fn(self, fk, fd, b, s, n, &scope1);
debug!("popping fn scope id={} due to item/method", n); debug!("popping fn scope id={} due to item/method", n);
} }
visit::fk_anon(..) | visit::fk_fn_block(..) => { visit::fk_fn_block(..) => {
visit::walk_fn(self, fk, fd, b, s, n, scope); visit::walk_fn(self, fk, fd, b, s, n, scope);
} }
} }

View File

@@ -542,7 +542,7 @@ impl<'a, O: IdVisitingOperation> Visitor<()> for IdVisitor<'a, O> {
self.operation.visit_id(method.self_id); self.operation.visit_id(method.self_id);
self.visit_generics_helper(generics) self.visit_generics_helper(generics)
} }
visit::fk_anon(_) | visit::fk_fn_block => {} visit::fk_fn_block => {}
} }
for argument in function_declaration.inputs.iter() { for argument in function_declaration.inputs.iter() {

View File

@@ -35,10 +35,8 @@ pub enum fn_kind<'a> {
// fn foo(&self) // fn foo(&self)
fk_method(Ident, &'a Generics, &'a method), fk_method(Ident, &'a Generics, &'a method),
// @fn(x, y) { ... }
fk_anon(ast::Sigil),
// |x, y| ... // |x, y| ...
// proc(x, y) ...
fk_fn_block, fk_fn_block,
} }
@@ -47,7 +45,7 @@ pub fn name_of_fn(fk: &fn_kind) -> Ident {
fk_item_fn(name, _, _, _) | fk_method(name, _, _) => { fk_item_fn(name, _, _, _) | fk_method(name, _, _) => {
name name
} }
fk_anon(..) | fk_fn_block(..) => parse::token::special_idents::anon, fk_fn_block(..) => parse::token::special_idents::anon,
} }
} }
@@ -57,7 +55,7 @@ pub fn generics_of_fn(fk: &fn_kind) -> Generics {
fk_method(_, generics, _) => { fk_method(_, generics, _) => {
(*generics).clone() (*generics).clone()
} }
fk_anon(..) | fk_fn_block(..) => { fk_fn_block(..) => {
Generics { Generics {
lifetimes: opt_vec::Empty, lifetimes: opt_vec::Empty,
ty_params: opt_vec::Empty, ty_params: opt_vec::Empty,
@@ -507,7 +505,7 @@ pub fn walk_fn<E:Clone, V:Visitor<E>>(visitor: &mut V,
visitor.visit_explicit_self(&method.explicit_self, env.clone()); visitor.visit_explicit_self(&method.explicit_self, env.clone());
} }
fk_anon(..) | fk_fn_block(..) => { fk_fn_block(..) => {
} }
} }