summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-08-24 12:47:57 +0000
committerbors <bors@rust-lang.org>2015-08-24 12:47:57 +0000
commit797d0ba59c3d11a61bdfca52b79d511580309713 (patch)
treec4a872798b0190a70c5a61d52bc84833e205e228 /src/libsyntax
parentdb67cbe43dfce043c664c53d709b91252d5afc9e (diff)
parentc03bf18b84bb47b1b86a26c49db7d4e5f1acc30d (diff)
downloadrust-797d0ba59c3d11a61bdfca52b79d511580309713.tar.gz
rust-797d0ba59c3d11a61bdfca52b79d511580309713.zip
Auto merge of #27857 - Manishearth:improve-fnkind, r=pnkfelix
Since enums are namespaced now, should we also remove the `Fk` prefixes from `FnKind` and remove the reexport? (The reexport must be removed because otherwise it clashes with glob imports containing `ItemFn`). IMO writing `FnKind::Method` is much clearer than `FkMethod`.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast_util.rs2
-rw-r--r--src/libsyntax/visit.rs11
2 files changed, 6 insertions, 7 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 45a41edae6c..61c182f638f 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -438,7 +438,7 @@ impl<'a, 'v, O: IdVisitingOperation> Visitor<'v> for IdVisitor<'a, O> {
             visit::FkMethod(_, sig, _) => {
                 self.visit_generics_helper(&sig.generics)
             }
-            visit::FkFnBlock => {}
+            visit::FkClosure => {}
         }
 
         for argument in &function_declaration.inputs {
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 259564337a2..824aee74ce5 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -32,7 +32,7 @@ use codemap::Span;
 use ptr::P;
 use owned_slice::OwnedSlice;
 
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, PartialEq, Eq)]
 pub enum FnKind<'a> {
     /// fn foo() or extern "Abi" fn foo()
     FkItemFn(Ident, &'a Generics, Unsafety, Constness, Abi, Visibility),
@@ -40,9 +40,8 @@ pub enum FnKind<'a> {
     /// fn foo(&self)
     FkMethod(Ident, &'a MethodSig, Option<Visibility>),
 
-    /// |x, y| ...
-    /// proc(x, y) ...
-    FkFnBlock,
+    /// |x, y| {}
+    FkClosure,
 }
 
 /// Each method of the Visitor trait is a hook to be potentially
@@ -616,7 +615,7 @@ pub fn walk_fn<'v, V: Visitor<'v>>(visitor: &mut V,
             visitor.visit_generics(&sig.generics);
             visitor.visit_explicit_self(&sig.explicit_self);
         }
-        FkFnBlock(..) => {}
+        FkClosure(..) => {}
     }
 
     visitor.visit_block(function_body)
@@ -817,7 +816,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) {
             }
         }
         ExprClosure(_, ref function_declaration, ref body) => {
-            visitor.visit_fn(FkFnBlock,
+            visitor.visit_fn(FkClosure,
                              &**function_declaration,
                              &**body,
                              expression.span,