Refactor how global paths are represented (for both ast and hir).

This commit is contained in:
Jeffrey Seyfried
2016-12-05 03:51:11 +00:00
parent 164619a8cf
commit f10f50b426
27 changed files with 242 additions and 257 deletions

View File

@@ -363,15 +363,12 @@ fn find_type_parameters(ty: &ast::Ty,
impl<'a, 'b> visit::Visitor<'a> for Visitor<'a, 'b> {
fn visit_ty(&mut self, ty: &'a ast::Ty) {
match ty.node {
ast::TyKind::Path(_, ref path) if !path.global => {
if let Some(segment) = path.segments.first() {
if self.ty_param_names.contains(&segment.identifier.name) {
self.types.push(P(ty.clone()));
}
if let ast::TyKind::Path(_, ref path) = ty.node {
if let Some(segment) = path.segments.first() {
if self.ty_param_names.contains(&segment.identifier.name) {
self.types.push(P(ty.clone()));
}
}
_ => {}
}
visit::walk_ty(self, ty)