]> git.lizzy.rs Git - rust.git/commitdiff
Comment methods in `CfgFolder`
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>
Tue, 24 May 2016 05:15:07 +0000 (05:15 +0000)
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>
Fri, 27 May 2016 23:57:02 +0000 (23:57 +0000)
src/libsyntax/config.rs

index 77f20934d805b33bc59cbbc81182cbb14643f11f..14035d8d116a3b2502be7f718c8d277467210851 100644 (file)
 use util::small_vector::SmallVector;
 
 pub trait CfgFolder: fold::Folder {
+    // Check if a node with the given attributes is in this configuration.
     fn in_cfg(&mut self, attrs: &[ast::Attribute]) -> bool;
+
+    // Update a node before checking if it is in this configuration (used to implement `cfg_attr`).
     fn process_attrs<T: HasAttrs>(&mut self, node: T) -> T { node }
+
+    // Visit attributes on expression and statements (but not attributes on items in blocks).
     fn visit_stmt_or_expr_attrs(&mut self, _attrs: &[ast::Attribute]) {}
+
+    // Visit unremovable (non-optional) expressions -- c.f. `fold_expr` vs `fold_opt_expr`.
     fn visit_unremovable_expr(&mut self, _expr: &ast::Expr) {}
 
     fn configure<T: HasAttrs>(&mut self, node: T) -> Option<T> {