diff options
| author | bors <bors@rust-lang.org> | 2015-11-19 01:01:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-11-19 01:01:30 +0000 |
| commit | 9303055f37a34adfceec1d1012b87308136295ce (patch) | |
| tree | 6d130e6f61911d1f342b404907e40eb9efa19464 /src/libsyntax | |
| parent | 2978af09d35c931fafe479ac7648436448982444 (diff) | |
| parent | 7926fa1ee9947c5b46e02a58f22172c78fcae2cd (diff) | |
| download | rust-9303055f37a34adfceec1d1012b87308136295ce.tar.gz rust-9303055f37a34adfceec1d1012b87308136295ce.zip | |
Auto merge of #29903 - nikomatsakis:incr-comp-ool-items, r=mw,nrc
This PR moves items into a separate map stored in the krate, rather than storing them inline in the HIR. The HIR visitor is also modified to skip visiting nested items by default. The goal here is to ensure that if you get access to the HIR for one item, you don't automatically get access to a bunch of other items, for better dependency tracking. r? @nrc cc @eddyb
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_util.rs | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index f1c88232fc4..44334762d90 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -289,7 +289,6 @@ pub trait IdVisitingOperation { pub struct IdVisitor<'a, O:'a> { pub operation: &'a mut O, - pub pass_through_items: bool, pub visited_outermost: bool, } @@ -319,12 +318,10 @@ impl<'a, 'v, O: IdVisitingOperation> Visitor<'v> for IdVisitor<'a, O> { } fn visit_item(&mut self, item: &Item) { - if !self.pass_through_items { - if self.visited_outermost { - return - } else { - self.visited_outermost = true - } + if self.visited_outermost { + return + } else { + self.visited_outermost = true } self.operation.visit_id(item.id); @@ -390,12 +387,10 @@ impl<'a, 'v, O: IdVisitingOperation> Visitor<'v> for IdVisitor<'a, O> { block: &'v Block, span: Span, node_id: NodeId) { - if !self.pass_through_items { - match function_kind { - FnKind::Method(..) if self.visited_outermost => return, - FnKind::Method(..) => self.visited_outermost = true, - _ => {} - } + match function_kind { + FnKind::Method(..) if self.visited_outermost => return, + FnKind::Method(..) => self.visited_outermost = true, + _ => {} } self.operation.visit_id(node_id); @@ -420,10 +415,8 @@ impl<'a, 'v, O: IdVisitingOperation> Visitor<'v> for IdVisitor<'a, O> { block, span); - if !self.pass_through_items { - if let FnKind::Method(..) = function_kind { - self.visited_outermost = false; - } + if let FnKind::Method(..) = function_kind { + self.visited_outermost = false; } } @@ -497,7 +490,6 @@ pub fn compute_id_range_for_fn_body(fk: FnKind, let mut visitor = IdRangeComputingVisitor::new(); let mut id_visitor = IdVisitor { operation: &mut visitor, - pass_through_items: false, visited_outermost: false, }; id_visitor.visit_fn(fk, decl, body, sp, id); |
