mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Add Visitor::visit_qself
This commit is contained in:
parent
09c268417f
commit
e65deb5ee1
@ -302,6 +302,9 @@ pub trait Visitor<'ast>: Sized {
|
|||||||
fn visit_fn_decl(&mut self, fn_decl: &'ast FnDecl) -> Self::Result {
|
fn visit_fn_decl(&mut self, fn_decl: &'ast FnDecl) -> Self::Result {
|
||||||
walk_fn_decl(self, fn_decl)
|
walk_fn_decl(self, fn_decl)
|
||||||
}
|
}
|
||||||
|
fn visit_qself(&mut self, qs: &'ast Option<P<QSelf>>) -> Self::Result {
|
||||||
|
walk_qself(self, qs)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn walk_crate<'a, V: Visitor<'a>>(visitor: &mut V, krate: &'a Crate) -> V::Result {
|
pub fn walk_crate<'a, V: Visitor<'a>>(visitor: &mut V, krate: &'a Crate) -> V::Result {
|
||||||
@ -437,13 +440,13 @@ impl WalkItemKind for ItemKind {
|
|||||||
body,
|
body,
|
||||||
from_glob: _,
|
from_glob: _,
|
||||||
}) => {
|
}) => {
|
||||||
try_visit!(walk_qself(visitor, qself));
|
try_visit!(visitor.visit_qself(qself));
|
||||||
try_visit!(visitor.visit_path(path, *id));
|
try_visit!(visitor.visit_path(path, *id));
|
||||||
visit_opt!(visitor, visit_ident, rename);
|
visit_opt!(visitor, visit_ident, rename);
|
||||||
visit_opt!(visitor, visit_block, body);
|
visit_opt!(visitor, visit_block, body);
|
||||||
}
|
}
|
||||||
ItemKind::DelegationMac(box DelegationMac { qself, prefix, suffixes, body }) => {
|
ItemKind::DelegationMac(box DelegationMac { qself, prefix, suffixes, body }) => {
|
||||||
try_visit!(walk_qself(visitor, qself));
|
try_visit!(visitor.visit_qself(qself));
|
||||||
try_visit!(visitor.visit_path(prefix, id));
|
try_visit!(visitor.visit_path(prefix, id));
|
||||||
if let Some(suffixes) = suffixes {
|
if let Some(suffixes) = suffixes {
|
||||||
for (ident, rename) in suffixes {
|
for (ident, rename) in suffixes {
|
||||||
@ -524,7 +527,7 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) -> V::Result {
|
|||||||
try_visit!(visitor.visit_fn_decl(decl));
|
try_visit!(visitor.visit_fn_decl(decl));
|
||||||
}
|
}
|
||||||
TyKind::Path(maybe_qself, path) => {
|
TyKind::Path(maybe_qself, path) => {
|
||||||
try_visit!(walk_qself(visitor, maybe_qself));
|
try_visit!(visitor.visit_qself(maybe_qself));
|
||||||
try_visit!(visitor.visit_path(path, *id));
|
try_visit!(visitor.visit_path(path, *id));
|
||||||
}
|
}
|
||||||
TyKind::Pat(ty, pat) => {
|
TyKind::Pat(ty, pat) => {
|
||||||
@ -655,16 +658,16 @@ pub fn walk_pat<'a, V: Visitor<'a>>(visitor: &mut V, pattern: &'a Pat) -> V::Res
|
|||||||
let Pat { id, kind, span: _, tokens: _ } = pattern;
|
let Pat { id, kind, span: _, tokens: _ } = pattern;
|
||||||
match kind {
|
match kind {
|
||||||
PatKind::TupleStruct(opt_qself, path, elems) => {
|
PatKind::TupleStruct(opt_qself, path, elems) => {
|
||||||
try_visit!(walk_qself(visitor, opt_qself));
|
try_visit!(visitor.visit_qself(opt_qself));
|
||||||
try_visit!(visitor.visit_path(path, *id));
|
try_visit!(visitor.visit_path(path, *id));
|
||||||
walk_list!(visitor, visit_pat, elems);
|
walk_list!(visitor, visit_pat, elems);
|
||||||
}
|
}
|
||||||
PatKind::Path(opt_qself, path) => {
|
PatKind::Path(opt_qself, path) => {
|
||||||
try_visit!(walk_qself(visitor, opt_qself));
|
try_visit!(visitor.visit_qself(opt_qself));
|
||||||
try_visit!(visitor.visit_path(path, *id))
|
try_visit!(visitor.visit_path(path, *id))
|
||||||
}
|
}
|
||||||
PatKind::Struct(opt_qself, path, fields, _rest) => {
|
PatKind::Struct(opt_qself, path, fields, _rest) => {
|
||||||
try_visit!(walk_qself(visitor, opt_qself));
|
try_visit!(visitor.visit_qself(opt_qself));
|
||||||
try_visit!(visitor.visit_path(path, *id));
|
try_visit!(visitor.visit_path(path, *id));
|
||||||
walk_list!(visitor, visit_pat_field, fields);
|
walk_list!(visitor, visit_pat_field, fields);
|
||||||
}
|
}
|
||||||
@ -905,13 +908,13 @@ impl WalkItemKind for AssocItemKind {
|
|||||||
body,
|
body,
|
||||||
from_glob: _,
|
from_glob: _,
|
||||||
}) => {
|
}) => {
|
||||||
try_visit!(walk_qself(visitor, qself));
|
try_visit!(visitor.visit_qself(qself));
|
||||||
try_visit!(visitor.visit_path(path, *id));
|
try_visit!(visitor.visit_path(path, *id));
|
||||||
visit_opt!(visitor, visit_ident, rename);
|
visit_opt!(visitor, visit_ident, rename);
|
||||||
visit_opt!(visitor, visit_block, body);
|
visit_opt!(visitor, visit_block, body);
|
||||||
}
|
}
|
||||||
AssocItemKind::DelegationMac(box DelegationMac { qself, prefix, suffixes, body }) => {
|
AssocItemKind::DelegationMac(box DelegationMac { qself, prefix, suffixes, body }) => {
|
||||||
try_visit!(walk_qself(visitor, qself));
|
try_visit!(visitor.visit_qself(qself));
|
||||||
try_visit!(visitor.visit_path(prefix, id));
|
try_visit!(visitor.visit_path(prefix, id));
|
||||||
if let Some(suffixes) = suffixes {
|
if let Some(suffixes) = suffixes {
|
||||||
for (ident, rename) in suffixes {
|
for (ident, rename) in suffixes {
|
||||||
@ -1026,7 +1029,7 @@ pub fn walk_inline_asm_sym<'a, V: Visitor<'a>>(
|
|||||||
visitor: &mut V,
|
visitor: &mut V,
|
||||||
InlineAsmSym { id, qself, path }: &'a InlineAsmSym,
|
InlineAsmSym { id, qself, path }: &'a InlineAsmSym,
|
||||||
) -> V::Result {
|
) -> V::Result {
|
||||||
try_visit!(walk_qself(visitor, qself));
|
try_visit!(visitor.visit_qself(qself));
|
||||||
visitor.visit_path(path, *id)
|
visitor.visit_path(path, *id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1058,7 +1061,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) -> V
|
|||||||
}
|
}
|
||||||
ExprKind::Struct(se) => {
|
ExprKind::Struct(se) => {
|
||||||
let StructExpr { qself, path, fields, rest } = &**se;
|
let StructExpr { qself, path, fields, rest } = &**se;
|
||||||
try_visit!(walk_qself(visitor, qself));
|
try_visit!(visitor.visit_qself(qself));
|
||||||
try_visit!(visitor.visit_path(path, *id));
|
try_visit!(visitor.visit_path(path, *id));
|
||||||
walk_list!(visitor, visit_expr_field, fields);
|
walk_list!(visitor, visit_expr_field, fields);
|
||||||
match rest {
|
match rest {
|
||||||
@ -1167,7 +1170,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) -> V
|
|||||||
}
|
}
|
||||||
ExprKind::Underscore => {}
|
ExprKind::Underscore => {}
|
||||||
ExprKind::Path(maybe_qself, path) => {
|
ExprKind::Path(maybe_qself, path) => {
|
||||||
try_visit!(walk_qself(visitor, maybe_qself));
|
try_visit!(visitor.visit_qself(maybe_qself));
|
||||||
try_visit!(visitor.visit_path(path, *id));
|
try_visit!(visitor.visit_path(path, *id));
|
||||||
}
|
}
|
||||||
ExprKind::Break(opt_label, opt_expr) => {
|
ExprKind::Break(opt_label, opt_expr) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user