Skip to content

Commit

Permalink
Comment methods in CfgFolder
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed May 24, 2016
1 parent 90d5e6f commit 71193c4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/libsyntax/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ use ptr::P;
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_attrs`).
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> {
Expand Down

0 comments on commit 71193c4

Please sign in to comment.