1
Fork 0

Apply visit_path to import prefixes by default

This commit is contained in:
Vadim Petrochenkov 2016-03-06 15:54:44 +03:00
parent dd6e8d45e1
commit 40285ca717
3 changed files with 8 additions and 26 deletions

View file

@ -274,12 +274,9 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
visitor.visit_path(path, item.id);
}
ViewPathList(ref prefix, ref list) => {
if !list.is_empty() {
for item in list {
visitor.visit_path_list_item(prefix, item)
}
} else {
visitor.visit_path(prefix, item.id);
visitor.visit_path(prefix, item.id);
for item in list {
visitor.visit_path_list_item(prefix, item)
}
}
}
@ -413,12 +410,8 @@ pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v Path) {
}
pub fn walk_path_list_item<'v, V: Visitor<'v>>(visitor: &mut V,
prefix: &'v Path,
_prefix: &'v Path,
item: &'v PathListItem) {
for segment in &prefix.segments {
visitor.visit_path_segment(prefix.span, segment);
}
walk_opt_name(visitor, item.span, item.node.name());
walk_opt_name(visitor, item.span, item.node.rename());
}

View file

@ -401,10 +401,6 @@ mod svh_visitor {
SawPath.hash(self.st); visit::walk_path(self, path)
}
fn visit_path_list_item(&mut self, prefix: &'a Path, item: &'a PathListItem) {
SawPath.hash(self.st); visit::walk_path_list_item(self, prefix, item)
}
fn visit_block(&mut self, b: &'a Block) {
SawBlock.hash(self.st); visit::walk_block(self, b)
}

View file

@ -247,12 +247,9 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
visitor.visit_path(path, item.id);
}
ViewPathList(ref prefix, ref list) => {
if !list.is_empty() {
for item in list {
visitor.visit_path_list_item(prefix, item)
}
} else {
visitor.visit_path(prefix, item.id);
visitor.visit_path(prefix, item.id);
for item in list {
visitor.visit_path_list_item(prefix, item)
}
}
}
@ -382,12 +379,8 @@ pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v Path) {
}
}
pub fn walk_path_list_item<'v, V: Visitor<'v>>(visitor: &mut V, prefix: &'v Path,
pub fn walk_path_list_item<'v, V: Visitor<'v>>(visitor: &mut V, _prefix: &'v Path,
item: &'v PathListItem) {
for segment in &prefix.segments {
visitor.visit_path_segment(prefix.span, segment);
}
walk_opt_ident(visitor, item.span, item.node.name());
walk_opt_ident(visitor, item.span, item.node.rename());
}