Add support for using qualified paths with structs in expression and pattern

position.
This commit is contained in:
Ryan Levick
2020-12-10 13:20:07 +01:00
committed by Ryan Levick
parent c5fbcd35a8
commit 6936349233
38 changed files with 374 additions and 187 deletions

View File

@@ -497,7 +497,10 @@ pub fn walk_assoc_ty_constraint<'a, V: Visitor<'a>>(
pub fn walk_pat<'a, V: Visitor<'a>>(visitor: &mut V, pattern: &'a Pat) {
match pattern.kind {
PatKind::TupleStruct(ref path, ref elems) => {
PatKind::TupleStruct(ref opt_qself, ref path, ref elems) => {
if let Some(ref qself) = *opt_qself {
visitor.visit_ty(&qself.ty);
}
visitor.visit_path(path, pattern.id);
walk_list!(visitor, visit_pat, elems);
}
@@ -507,7 +510,10 @@ pub fn walk_pat<'a, V: Visitor<'a>>(visitor: &mut V, pattern: &'a Pat) {
}
visitor.visit_path(path, pattern.id)
}
PatKind::Struct(ref path, ref fields, _) => {
PatKind::Struct(ref opt_qself, ref path, ref fields, _) => {
if let Some(ref qself) = *opt_qself {
visitor.visit_ty(&qself.ty);
}
visitor.visit_path(path, pattern.id);
walk_list!(visitor, visit_pat_field, fields);
}
@@ -740,6 +746,9 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
visitor.visit_anon_const(count)
}
ExprKind::Struct(ref se) => {
if let Some(ref qself) = se.qself {
visitor.visit_ty(&qself.ty);
}
visitor.visit_path(&se.path, expression.id);
walk_list!(visitor, visit_expr_field, &se.fields);
match &se.rest {