2014-09-12 13:10:30 +03:00
|
|
|
//! AST walker. Each overridden visit method has full control over what
|
|
|
|
|
//! happens with its node, it can do its own traversal of the node's children,
|
|
|
|
|
//! call `visit::walk_*` to apply the default traversal algorithm, or prevent
|
|
|
|
|
//! deeper traversal by doing nothing.
|
2014-06-09 13:12:30 -07:00
|
|
|
//!
|
|
|
|
|
//! Note: it is an important invariant that the default visitor walks the body
|
|
|
|
|
//! of a function in "execution order" (more concretely, reverse post-order
|
|
|
|
|
//! with respect to the CFG implied by the AST), meaning that if AST node A may
|
2019-02-08 14:53:55 +01:00
|
|
|
//! execute before AST node B, then A is visited first. The borrow checker in
|
2014-06-09 13:12:30 -07:00
|
|
|
//! particular relies on this property.
|
|
|
|
|
//!
|
2014-07-09 14:48:12 -07:00
|
|
|
//! Note: walking an AST before macro expansion is probably a bad idea. For
|
|
|
|
|
//! instance, a walker looking for item names in a module will miss all of
|
|
|
|
|
//! those that are created by the expansion of a macro.
|
|
|
|
|
|
2023-11-10 10:11:24 +08:00
|
|
|
use crate::ast::*;
|
2019-02-07 02:33:01 +09:00
|
|
|
|
2022-07-29 13:43:28 +10:00
|
|
|
use rustc_span::symbol::Ident;
|
2019-12-31 20:15:40 +03:00
|
|
|
use rustc_span::Span;
|
2012-12-23 17:41:37 -05:00
|
|
|
|
2024-02-24 15:22:42 -05:00
|
|
|
pub use rustc_ast_ir::visit::VisitorResult;
|
|
|
|
|
pub use rustc_ast_ir::{try_visit, visit_opt, walk_list, walk_visitable_list};
|
|
|
|
|
|
2021-08-19 16:34:01 -04:00
|
|
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
2020-01-30 00:18:54 +01:00
|
|
|
pub enum AssocCtxt {
|
|
|
|
|
Trait,
|
|
|
|
|
Impl,
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-19 16:34:01 -04:00
|
|
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
2020-01-30 00:18:54 +01:00
|
|
|
pub enum FnCtxt {
|
|
|
|
|
Free,
|
|
|
|
|
Foreign,
|
|
|
|
|
Assoc(AssocCtxt),
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-20 19:06:32 +08:00
|
|
|
#[derive(Copy, Clone, Debug)]
|
2022-04-21 10:09:32 +08:00
|
|
|
pub enum BoundKind {
|
|
|
|
|
/// Trait bounds in generics bounds and type/trait alias.
|
|
|
|
|
/// E.g., `<T: Bound>`, `type A: Bound`, or `where T: Bound`.
|
|
|
|
|
Bound,
|
|
|
|
|
|
|
|
|
|
/// Trait bounds in `impl` type.
|
|
|
|
|
/// E.g., `type Foo = impl Bound1 + Bound2 + Bound3`.
|
|
|
|
|
Impl,
|
|
|
|
|
|
|
|
|
|
/// Trait bounds in trait object type.
|
|
|
|
|
/// E.g., `dyn Bound1 + Bound2 + Bound3`.
|
2022-04-20 19:06:32 +08:00
|
|
|
TraitObject,
|
2022-04-21 10:09:32 +08:00
|
|
|
|
|
|
|
|
/// Super traits of a trait.
|
|
|
|
|
/// E.g., `trait A: B`
|
2022-04-20 19:06:32 +08:00
|
|
|
SuperTraits,
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-19 16:34:01 -04:00
|
|
|
#[derive(Copy, Clone, Debug)]
|
2014-01-09 15:05:33 +02:00
|
|
|
pub enum FnKind<'a> {
|
2020-01-30 00:18:54 +01:00
|
|
|
/// E.g., `fn foo()`, `fn foo(&self)`, or `extern "Abi" fn foo()`.
|
2021-11-19 22:03:43 +01:00
|
|
|
Fn(FnCtxt, Ident, &'a FnSig, &'a Visibility, &'a Generics, Option<&'a Block>),
|
2013-03-13 22:25:28 -04:00
|
|
|
|
2019-09-06 03:56:45 +01:00
|
|
|
/// E.g., `|x, y| body`.
|
2022-06-02 20:15:05 +04:00
|
|
|
Closure(&'a ClosureBinder, &'a FnDecl, &'a Expr),
|
2011-12-29 20:07:55 -08:00
|
|
|
}
|
|
|
|
|
|
2019-04-18 19:15:43 +01:00
|
|
|
impl<'a> FnKind<'a> {
|
|
|
|
|
pub fn header(&self) -> Option<&'a FnHeader> {
|
|
|
|
|
match *self {
|
2021-11-19 22:03:43 +01:00
|
|
|
FnKind::Fn(_, _, sig, _, _, _) => Some(&sig.header),
|
2022-06-02 20:15:05 +04:00
|
|
|
FnKind::Closure(_, _, _) => None,
|
2020-01-30 00:18:54 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-13 17:52:33 -07:00
|
|
|
pub fn ident(&self) -> Option<&Ident> {
|
|
|
|
|
match self {
|
|
|
|
|
FnKind::Fn(_, ident, ..) => Some(ident),
|
|
|
|
|
_ => None,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-30 00:18:54 +01:00
|
|
|
pub fn decl(&self) -> &'a FnDecl {
|
|
|
|
|
match self {
|
2021-11-19 22:03:43 +01:00
|
|
|
FnKind::Fn(_, _, sig, _, _, _) => &sig.decl,
|
2022-06-02 20:15:05 +04:00
|
|
|
FnKind::Closure(_, decl, _) => decl,
|
2020-01-30 00:18:54 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn ctxt(&self) -> Option<FnCtxt> {
|
|
|
|
|
match self {
|
|
|
|
|
FnKind::Fn(ctxt, ..) => Some(*ctxt),
|
|
|
|
|
FnKind::Closure(..) => None,
|
2019-04-18 19:15:43 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-10 19:56:46 +02:00
|
|
|
#[derive(Copy, Clone, Debug)]
|
|
|
|
|
pub enum LifetimeCtxt {
|
|
|
|
|
/// Appears in a reference type.
|
2022-12-28 18:06:11 +01:00
|
|
|
Ref,
|
2022-05-10 19:56:46 +02:00
|
|
|
/// Appears as a bound on a type or another lifetime.
|
|
|
|
|
Bound,
|
|
|
|
|
/// Appears as a generic argument.
|
|
|
|
|
GenericArg,
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-06 03:56:45 +01:00
|
|
|
/// Each method of the `Visitor` trait is a hook to be potentially
|
2019-02-08 14:53:55 +01:00
|
|
|
/// overridden. Each method's default implementation recursively visits
|
2014-05-12 18:58:23 +02:00
|
|
|
/// the substructure of the input via the corresponding `walk` method;
|
2021-02-14 21:14:12 +03:00
|
|
|
/// e.g., the `visit_item` method by default calls `visit::walk_item`.
|
2014-05-12 18:58:23 +02:00
|
|
|
///
|
|
|
|
|
/// If you want to ensure that your code handles every variant
|
2019-02-08 14:53:55 +01:00
|
|
|
/// explicitly, you need to override each method. (And you also need
|
2014-05-12 18:58:23 +02:00
|
|
|
/// to monitor future changes to `Visitor` in case a new method with a
|
|
|
|
|
/// new default implementation gets introduced.)
|
2016-12-06 11:26:52 +01:00
|
|
|
pub trait Visitor<'ast>: Sized {
|
2024-02-18 03:12:44 -05:00
|
|
|
/// The result type of the `visit_*` methods. Can be either `()`,
|
|
|
|
|
/// or `ControlFlow<T>`.
|
|
|
|
|
type Result: VisitorResult = ();
|
|
|
|
|
|
|
|
|
|
fn visit_ident(&mut self, _ident: Ident) -> Self::Result {
|
|
|
|
|
Self::Result::output()
|
|
|
|
|
}
|
|
|
|
|
fn visit_foreign_item(&mut self, i: &'ast ForeignItem) -> Self::Result {
|
2019-12-22 17:42:04 -05:00
|
|
|
walk_foreign_item(self, i)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_item(&mut self, i: &'ast Item) -> Self::Result {
|
2019-12-22 17:42:04 -05:00
|
|
|
walk_item(self, i)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_local(&mut self, l: &'ast Local) -> Self::Result {
|
2019-12-22 17:42:04 -05:00
|
|
|
walk_local(self, l)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_block(&mut self, b: &'ast Block) -> Self::Result {
|
2019-12-22 17:42:04 -05:00
|
|
|
walk_block(self, b)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_stmt(&mut self, s: &'ast Stmt) -> Self::Result {
|
2019-12-22 17:42:04 -05:00
|
|
|
walk_stmt(self, s)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_param(&mut self, param: &'ast Param) -> Self::Result {
|
2019-12-22 17:42:04 -05:00
|
|
|
walk_param(self, param)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_arm(&mut self, a: &'ast Arm) -> Self::Result {
|
2019-12-22 17:42:04 -05:00
|
|
|
walk_arm(self, a)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_pat(&mut self, p: &'ast Pat) -> Self::Result {
|
2019-12-22 17:42:04 -05:00
|
|
|
walk_pat(self, p)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_anon_const(&mut self, c: &'ast AnonConst) -> Self::Result {
|
2019-12-22 17:42:04 -05:00
|
|
|
walk_anon_const(self, c)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_expr(&mut self, ex: &'ast Expr) -> Self::Result {
|
2019-12-22 17:42:04 -05:00
|
|
|
walk_expr(self, ex)
|
|
|
|
|
}
|
2022-10-23 09:22:19 +00:00
|
|
|
/// This method is a hack to workaround unstable of `stmt_expr_attributes`.
|
|
|
|
|
/// It can be removed once that feature is stabilized.
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_method_receiver_expr(&mut self, ex: &'ast Expr) -> Self::Result {
|
2022-10-23 09:22:19 +00:00
|
|
|
self.visit_expr(ex)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_expr_post(&mut self, _ex: &'ast Expr) -> Self::Result {
|
|
|
|
|
Self::Result::output()
|
|
|
|
|
}
|
|
|
|
|
fn visit_ty(&mut self, t: &'ast Ty) -> Self::Result {
|
2019-12-22 17:42:04 -05:00
|
|
|
walk_ty(self, t)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_generic_param(&mut self, param: &'ast GenericParam) -> Self::Result {
|
2018-05-26 00:27:54 +01:00
|
|
|
walk_generic_param(self, param)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_generics(&mut self, g: &'ast Generics) -> Self::Result {
|
2019-12-22 17:42:04 -05:00
|
|
|
walk_generics(self, g)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_closure_binder(&mut self, b: &'ast ClosureBinder) -> Self::Result {
|
2022-06-02 20:15:05 +04:00
|
|
|
walk_closure_binder(self, b)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_where_predicate(&mut self, p: &'ast WherePredicate) -> Self::Result {
|
2017-01-25 22:01:11 +02:00
|
|
|
walk_where_predicate(self, p)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_fn(&mut self, fk: FnKind<'ast>, _: Span, _: NodeId) -> Self::Result {
|
2022-09-12 13:13:22 +10:00
|
|
|
walk_fn(self, fk)
|
2019-12-22 17:42:04 -05:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_assoc_item(&mut self, i: &'ast AssocItem, ctxt: AssocCtxt) -> Self::Result {
|
2020-01-30 00:18:54 +01:00
|
|
|
walk_assoc_item(self, i, ctxt)
|
2019-12-22 17:42:04 -05:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_trait_ref(&mut self, t: &'ast TraitRef) -> Self::Result {
|
2019-12-22 17:42:04 -05:00
|
|
|
walk_trait_ref(self, t)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_param_bound(&mut self, bounds: &'ast GenericBound, _ctxt: BoundKind) -> Self::Result {
|
2018-05-28 15:23:16 +01:00
|
|
|
walk_param_bound(self, bounds)
|
2014-11-15 16:55:27 -05:00
|
|
|
}
|
2024-04-03 21:47:02 -04:00
|
|
|
fn visit_precise_capturing_arg(&mut self, arg: &'ast PreciseCapturingArg) {
|
|
|
|
|
walk_precise_capturing_arg(self, arg);
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_poly_trait_ref(&mut self, t: &'ast PolyTraitRef) -> Self::Result {
|
2022-08-11 11:05:26 +10:00
|
|
|
walk_poly_trait_ref(self, t)
|
2014-11-07 06:53:45 -05:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_variant_data(&mut self, s: &'ast VariantData) -> Self::Result {
|
2014-09-12 13:10:30 +03:00
|
|
|
walk_struct_def(self, s)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_field_def(&mut self, s: &'ast FieldDef) -> Self::Result {
|
2021-03-16 00:36:07 +03:00
|
|
|
walk_field_def(self, s)
|
2019-12-22 17:42:04 -05:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_enum_def(&mut self, enum_definition: &'ast EnumDef) -> Self::Result {
|
2022-08-10 12:02:48 +10:00
|
|
|
walk_enum_def(self, enum_definition)
|
2015-10-02 16:14:20 +03:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_variant(&mut self, v: &'ast Variant) -> Self::Result {
|
2019-08-24 13:54:40 -03:00
|
|
|
walk_variant(self, v)
|
2015-06-22 20:55:57 -06:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_variant_discr(&mut self, discr: &'ast AnonConst) -> Self::Result {
|
|
|
|
|
self.visit_anon_const(discr)
|
2023-05-05 21:31:00 +01:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_label(&mut self, label: &'ast Label) -> Self::Result {
|
2018-01-16 01:44:32 +03:00
|
|
|
walk_label(self, label)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_lifetime(&mut self, lifetime: &'ast Lifetime, _: LifetimeCtxt) -> Self::Result {
|
2015-09-28 14:26:26 +03:00
|
|
|
walk_lifetime(self, lifetime)
|
2013-10-28 17:37:10 -04:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_mac_call(&mut self, mac: &'ast MacCall) -> Self::Result {
|
2020-11-03 20:26:17 +03:00
|
|
|
walk_mac(self, mac)
|
2013-10-28 17:37:10 -04:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_mac_def(&mut self, _mac: &'ast MacroDef, _id: NodeId) -> Self::Result {
|
|
|
|
|
Self::Result::output()
|
2017-05-12 08:05:52 +02:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_path(&mut self, path: &'ast Path, _id: NodeId) -> Self::Result {
|
2014-09-12 13:10:30 +03:00
|
|
|
walk_path(self, path)
|
2013-12-08 11:25:35 -08:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_use_tree(
|
|
|
|
|
&mut self,
|
|
|
|
|
use_tree: &'ast UseTree,
|
|
|
|
|
id: NodeId,
|
|
|
|
|
_nested: bool,
|
|
|
|
|
) -> Self::Result {
|
2017-09-26 23:04:00 +02:00
|
|
|
walk_use_tree(self, use_tree, id)
|
2015-09-12 16:10:12 +03:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_path_segment(&mut self, path_segment: &'ast PathSegment) -> Self::Result {
|
2022-09-12 10:43:34 +10:00
|
|
|
walk_path_segment(self, path_segment)
|
2014-11-15 16:55:27 -05:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_generic_args(&mut self, generic_args: &'ast GenericArgs) -> Self::Result {
|
2022-09-12 10:43:34 +10:00
|
|
|
walk_generic_args(self, generic_args)
|
2018-02-13 11:32:37 +00:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_generic_arg(&mut self, generic_arg: &'ast GenericArg) -> Self::Result {
|
2020-10-09 19:20:06 -03:00
|
|
|
walk_generic_arg(self, generic_arg)
|
2014-11-15 16:55:27 -05:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_assoc_constraint(&mut self, constraint: &'ast AssocConstraint) -> Self::Result {
|
2021-07-30 08:56:45 +00:00
|
|
|
walk_assoc_constraint(self, constraint)
|
2014-12-28 10:07:21 -05:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_attribute(&mut self, attr: &'ast Attribute) -> Self::Result {
|
2017-10-23 17:22:28 +09:00
|
|
|
walk_attribute(self, attr)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_vis(&mut self, vis: &'ast Visibility) -> Self::Result {
|
2016-03-31 19:10:38 +00:00
|
|
|
walk_vis(self, vis)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_fn_ret_ty(&mut self, ret_ty: &'ast FnRetTy) -> Self::Result {
|
2016-08-01 20:15:54 +08:00
|
|
|
walk_fn_ret_ty(self, ret_ty)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_fn_header(&mut self, _header: &'ast FnHeader) -> Self::Result {
|
|
|
|
|
Self::Result::output()
|
2019-02-23 18:39:27 +00:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_expr_field(&mut self, f: &'ast ExprField) -> Self::Result {
|
2021-03-16 00:36:07 +03:00
|
|
|
walk_expr_field(self, f)
|
2019-08-24 13:54:40 -03:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_pat_field(&mut self, fp: &'ast PatField) -> Self::Result {
|
2021-03-16 00:36:07 +03:00
|
|
|
walk_pat_field(self, fp)
|
2019-08-24 13:54:40 -03:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_crate(&mut self, krate: &'ast Crate) -> Self::Result {
|
2021-10-17 19:32:34 +03:00
|
|
|
walk_crate(self, krate)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_inline_asm(&mut self, asm: &'ast InlineAsm) -> Self::Result {
|
2022-03-01 00:50:56 +00:00
|
|
|
walk_inline_asm(self, asm)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_format_args(&mut self, fmt: &'ast FormatArgs) -> Self::Result {
|
2023-01-11 21:41:13 +01:00
|
|
|
walk_format_args(self, fmt)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_inline_asm_sym(&mut self, sym: &'ast InlineAsmSym) -> Self::Result {
|
2022-03-01 00:50:56 +00:00
|
|
|
walk_inline_asm_sym(self, sym)
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
fn visit_capture_by(&mut self, _capture_by: &'ast CaptureBy) -> Self::Result {
|
|
|
|
|
Self::Result::output()
|
2023-11-04 20:39:15 +01:00
|
|
|
}
|
2013-08-08 14:23:25 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_crate<'a, V: Visitor<'a>>(visitor: &mut V, krate: &'a Crate) -> V::Result {
|
2021-02-14 21:14:12 +03:00
|
|
|
walk_list!(visitor, visit_item, &krate.items);
|
2015-09-28 14:26:26 +03:00
|
|
|
walk_list!(visitor, visit_attribute, &krate.attrs);
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2015-09-28 14:26:26 +03:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_local<'a, V: Visitor<'a>>(visitor: &mut V, local: &'a Local) -> V::Result {
|
|
|
|
|
walk_list!(visitor, visit_attribute, &local.attrs);
|
|
|
|
|
try_visit!(visitor.visit_pat(&local.pat));
|
|
|
|
|
visit_opt!(visitor, visit_ty, &local.ty);
|
2021-06-22 13:00:58 -05:00
|
|
|
if let Some((init, els)) = local.kind.init_else_opt() {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(init));
|
|
|
|
|
visit_opt!(visitor, visit_block, els);
|
2021-06-22 13:00:58 -05:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2014-12-13 05:34:34 -05:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_label<'a, V: Visitor<'a>>(visitor: &mut V, label: &'a Label) -> V::Result {
|
|
|
|
|
visitor.visit_ident(label.ident)
|
2018-01-16 01:44:32 +03:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_lifetime<'a, V: Visitor<'a>>(visitor: &mut V, lifetime: &'a Lifetime) -> V::Result {
|
|
|
|
|
visitor.visit_ident(lifetime.ident)
|
2015-09-28 14:26:26 +03:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_poly_trait_ref<'a, V>(visitor: &mut V, trait_ref: &'a PolyTraitRef) -> V::Result
|
2022-08-11 11:05:26 +10:00
|
|
|
where
|
2019-12-22 17:42:04 -05:00
|
|
|
V: Visitor<'a>,
|
2014-11-07 06:53:45 -05:00
|
|
|
{
|
2017-10-16 21:07:26 +02:00
|
|
|
walk_list!(visitor, visit_generic_param, &trait_ref.bound_generic_params);
|
2024-02-18 03:12:44 -05:00
|
|
|
visitor.visit_trait_ref(&trait_ref.trait_ref)
|
2014-11-07 06:53:45 -05:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_trait_ref<'a, V: Visitor<'a>>(visitor: &mut V, trait_ref: &'a TraitRef) -> V::Result {
|
2014-09-12 13:10:30 +03:00
|
|
|
visitor.visit_path(&trait_ref.path, trait_ref.ref_id)
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) -> V::Result {
|
|
|
|
|
try_visit!(visitor.visit_vis(&item.vis));
|
|
|
|
|
try_visit!(visitor.visit_ident(item.ident));
|
2022-11-16 19:26:38 +00:00
|
|
|
match &item.kind {
|
2022-07-29 13:43:28 +10:00
|
|
|
ItemKind::ExternCrate(_) => {}
|
2024-02-18 03:12:44 -05:00
|
|
|
ItemKind::Use(use_tree) => try_visit!(visitor.visit_use_tree(use_tree, item.id, false)),
|
2023-05-04 16:08:33 +02:00
|
|
|
ItemKind::Static(box StaticItem { ty, mutability: _, expr }) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(ty));
|
|
|
|
|
visit_opt!(visitor, visit_expr, expr);
|
2023-05-04 16:08:33 +02:00
|
|
|
}
|
|
|
|
|
ItemKind::Const(box ConstItem { defaultness: _, generics, ty, expr }) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_generics(generics));
|
|
|
|
|
try_visit!(visitor.visit_ty(ty));
|
|
|
|
|
visit_opt!(visitor, visit_expr, expr);
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ItemKind::Fn(box Fn { defaultness: _, generics, sig, body }) => {
|
2021-11-19 22:03:43 +01:00
|
|
|
let kind =
|
|
|
|
|
FnKind::Fn(FnCtxt::Free, item.ident, sig, &item.vis, generics, body.as_deref());
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_fn(kind, item.span, item.id));
|
2019-12-22 17:42:04 -05:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ItemKind::Mod(_unsafety, mod_kind) => match mod_kind {
|
2021-02-17 00:56:07 +03:00
|
|
|
ModKind::Loaded(items, _inline, _inner_span) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
walk_list!(visitor, visit_item, items);
|
2021-02-17 00:56:07 +03:00
|
|
|
}
|
|
|
|
|
ModKind::Unloaded => {}
|
|
|
|
|
},
|
2022-11-16 19:26:38 +00:00
|
|
|
ItemKind::ForeignMod(foreign_module) => {
|
2015-09-28 14:26:26 +03:00
|
|
|
walk_list!(visitor, visit_foreign_item, &foreign_module.items);
|
2011-12-20 16:33:55 +01:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
ItemKind::GlobalAsm(asm) => try_visit!(visitor.visit_inline_asm(asm)),
|
2022-11-16 19:26:38 +00:00
|
|
|
ItemKind::TyAlias(box TyAlias { generics, bounds, ty, .. }) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_generics(generics));
|
2022-04-21 10:09:32 +08:00
|
|
|
walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_ty, ty);
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ItemKind::Enum(enum_definition, generics) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_generics(generics));
|
|
|
|
|
try_visit!(visitor.visit_enum_def(enum_definition));
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2021-11-07 16:43:49 +08:00
|
|
|
ItemKind::Impl(box Impl {
|
2020-01-13 20:30:20 -08:00
|
|
|
defaultness: _,
|
2021-11-07 16:43:49 +08:00
|
|
|
unsafety: _,
|
2022-11-16 19:26:38 +00:00
|
|
|
generics,
|
2021-11-07 16:43:49 +08:00
|
|
|
constness: _,
|
|
|
|
|
polarity: _,
|
2022-11-16 19:26:38 +00:00
|
|
|
of_trait,
|
|
|
|
|
self_ty,
|
|
|
|
|
items,
|
2021-01-29 08:31:08 +01:00
|
|
|
}) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_generics(generics));
|
|
|
|
|
visit_opt!(visitor, visit_trait_ref, of_trait);
|
|
|
|
|
try_visit!(visitor.visit_ty(self_ty));
|
2020-01-30 00:18:54 +01:00
|
|
|
walk_list!(visitor, visit_assoc_item, items, AssocCtxt::Impl);
|
2013-02-18 21:25:44 -08:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ItemKind::Struct(struct_definition, generics)
|
|
|
|
|
| ItemKind::Union(struct_definition, generics) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_generics(generics));
|
|
|
|
|
try_visit!(visitor.visit_variant_data(struct_definition));
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ItemKind::Trait(box Trait { unsafety: _, is_auto: _, generics, bounds, items }) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_generics(generics));
|
2022-04-21 10:09:32 +08:00
|
|
|
walk_list!(visitor, visit_param_bound, bounds, BoundKind::SuperTraits);
|
2020-01-30 00:18:54 +01:00
|
|
|
walk_list!(visitor, visit_assoc_item, items, AssocCtxt::Trait);
|
2013-02-18 21:25:44 -08:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ItemKind::TraitAlias(generics, bounds) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_generics(generics));
|
2022-04-21 10:09:32 +08:00
|
|
|
walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
|
2017-10-02 12:27:45 +00:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
ItemKind::MacCall(mac) => try_visit!(visitor.visit_mac_call(mac)),
|
|
|
|
|
ItemKind::MacroDef(ts) => try_visit!(visitor.visit_mac_def(ts, item.id)),
|
2024-01-24 17:33:33 +01:00
|
|
|
ItemKind::Delegation(box Delegation { id, qself, path, body }) => {
|
2023-11-26 15:57:31 +03:00
|
|
|
if let Some(qself) = qself {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(&qself.ty));
|
2023-11-26 15:57:31 +03:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_path(path, *id));
|
|
|
|
|
visit_opt!(visitor, visit_block, body);
|
2023-11-26 15:57:31 +03:00
|
|
|
}
|
2014-06-07 23:02:48 -07:00
|
|
|
}
|
2015-09-28 14:26:26 +03:00
|
|
|
walk_list!(visitor, visit_attribute, &item.attrs);
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2011-06-08 22:48:19 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_enum_def<'a, V: Visitor<'a>>(
|
|
|
|
|
visitor: &mut V,
|
|
|
|
|
enum_definition: &'a EnumDef,
|
|
|
|
|
) -> V::Result {
|
2019-08-24 13:54:40 -03:00
|
|
|
walk_list!(visitor, visit_variant, &enum_definition.variants);
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2013-11-11 22:17:47 -06:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_variant<'a, V: Visitor<'a>>(visitor: &mut V, variant: &'a Variant) -> V::Result
|
2019-12-22 17:42:04 -05:00
|
|
|
where
|
|
|
|
|
V: Visitor<'a>,
|
2016-06-12 07:51:31 +00:00
|
|
|
{
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ident(variant.ident));
|
|
|
|
|
try_visit!(visitor.visit_vis(&variant.vis));
|
|
|
|
|
try_visit!(visitor.visit_variant_data(&variant.data));
|
|
|
|
|
visit_opt!(visitor, visit_variant_discr, &variant.disr_expr);
|
2019-08-13 21:40:21 -03:00
|
|
|
walk_list!(visitor, visit_attribute, &variant.attrs);
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2015-01-02 20:55:31 +09:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_expr_field<'a, V: Visitor<'a>>(visitor: &mut V, f: &'a ExprField) -> V::Result {
|
|
|
|
|
try_visit!(visitor.visit_expr(&f.expr));
|
|
|
|
|
try_visit!(visitor.visit_ident(f.ident));
|
|
|
|
|
walk_list!(visitor, visit_attribute, &f.attrs);
|
|
|
|
|
V::Result::output()
|
2019-08-24 13:54:40 -03:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_pat_field<'a, V: Visitor<'a>>(visitor: &mut V, fp: &'a PatField) -> V::Result {
|
|
|
|
|
try_visit!(visitor.visit_ident(fp.ident));
|
|
|
|
|
try_visit!(visitor.visit_pat(&fp.pat));
|
|
|
|
|
walk_list!(visitor, visit_attribute, &fp.attrs);
|
|
|
|
|
V::Result::output()
|
2019-08-24 13:54:40 -03:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) -> V::Result {
|
2022-11-16 19:26:38 +00:00
|
|
|
match &typ.kind {
|
2024-02-18 03:12:44 -05:00
|
|
|
TyKind::Slice(ty) | TyKind::Paren(ty) => try_visit!(visitor.visit_ty(ty)),
|
|
|
|
|
TyKind::Ptr(mutable_type) => try_visit!(visitor.visit_ty(&mutable_type.ty)),
|
2022-12-28 18:06:11 +01:00
|
|
|
TyKind::Ref(opt_lifetime, mutable_type) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_lifetime, opt_lifetime, LifetimeCtxt::Ref);
|
|
|
|
|
try_visit!(visitor.visit_ty(&mutable_type.ty));
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2023-01-30 18:08:50 +00:00
|
|
|
TyKind::Tup(tuple_element_types) => {
|
|
|
|
|
walk_list!(visitor, visit_ty, tuple_element_types);
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
TyKind::BareFn(function_declaration) => {
|
2017-10-16 21:07:26 +02:00
|
|
|
walk_list!(visitor, visit_generic_param, &function_declaration.generic_params);
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(walk_fn_decl(visitor, &function_declaration.decl));
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
TyKind::Path(maybe_qself, path) => {
|
|
|
|
|
if let Some(qself) = maybe_qself {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(&qself.ty));
|
2015-02-17 19:29:13 +02:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_path(path, typ.id));
|
2014-11-20 15:08:48 -05:00
|
|
|
}
|
2023-01-30 09:50:16 +00:00
|
|
|
TyKind::Pat(ty, pat) => {
|
|
|
|
|
try_visit!(visitor.visit_ty(ty));
|
|
|
|
|
try_visit!(visitor.visit_pat(pat));
|
|
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
TyKind::Array(ty, length) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(ty));
|
|
|
|
|
try_visit!(visitor.visit_anon_const(length));
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
TyKind::TraitObject(bounds, ..) => {
|
2022-04-21 10:09:32 +08:00
|
|
|
walk_list!(visitor, visit_param_bound, bounds, BoundKind::TraitObject);
|
2022-04-20 19:06:32 +08:00
|
|
|
}
|
2024-04-03 19:58:50 -04:00
|
|
|
TyKind::ImplTrait(_, bounds, precise_capturing) => {
|
2022-04-21 10:09:32 +08:00
|
|
|
walk_list!(visitor, visit_param_bound, bounds, BoundKind::Impl);
|
2024-04-04 10:48:47 -04:00
|
|
|
if let Some(precise_capturing) = precise_capturing {
|
|
|
|
|
for arg in precise_capturing {
|
|
|
|
|
try_visit!(visitor.visit_precise_capturing_arg(arg));
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-01 04:25:32 +03:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
TyKind::Typeof(expression) => try_visit!(visitor.visit_anon_const(expression)),
|
2024-02-14 14:50:49 +11:00
|
|
|
TyKind::Infer | TyKind::ImplicitSelf | TyKind::Dummy | TyKind::Err(_) => {}
|
2024-02-18 03:12:44 -05:00
|
|
|
TyKind::MacCall(mac) => try_visit!(visitor.visit_mac_call(mac)),
|
2019-12-22 17:42:04 -05:00
|
|
|
TyKind::Never | TyKind::CVarArgs => {}
|
2024-01-04 21:53:06 +08:00
|
|
|
TyKind::AnonStruct(_, ref fields) | TyKind::AnonUnion(_, ref fields) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
walk_list!(visitor, visit_field_def, fields);
|
2023-08-23 20:53:47 +08:00
|
|
|
}
|
2011-06-08 22:48:19 +02:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2011-06-08 22:48:19 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_path<'a, V: Visitor<'a>>(visitor: &mut V, path: &'a Path) -> V::Result {
|
|
|
|
|
walk_list!(visitor, visit_path_segment, &path.segments);
|
|
|
|
|
V::Result::output()
|
2014-11-15 16:55:27 -05:00
|
|
|
}
|
2013-11-22 23:24:49 +11:00
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_use_tree<'a, V: Visitor<'a>>(
|
|
|
|
|
visitor: &mut V,
|
|
|
|
|
use_tree: &'a UseTree,
|
|
|
|
|
id: NodeId,
|
|
|
|
|
) -> V::Result {
|
|
|
|
|
try_visit!(visitor.visit_path(&use_tree.prefix, id));
|
|
|
|
|
match use_tree.kind {
|
2022-12-01 18:51:20 +03:00
|
|
|
UseTreeKind::Simple(rename) => {
|
2024-02-11 09:22:52 +01:00
|
|
|
// The extra IDs are handled during AST lowering.
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_ident, rename);
|
2017-09-26 23:04:00 +02:00
|
|
|
}
|
2019-12-22 17:42:04 -05:00
|
|
|
UseTreeKind::Glob => {}
|
2024-02-18 03:12:44 -05:00
|
|
|
UseTreeKind::Nested(ref use_trees) => {
|
2017-09-26 23:04:00 +02:00
|
|
|
for &(ref nested_tree, nested_id) in use_trees {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_use_tree(nested_tree, nested_id, true));
|
2017-09-26 23:04:00 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2015-09-12 16:10:12 +03:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_path_segment<'a, V: Visitor<'a>>(
|
|
|
|
|
visitor: &mut V,
|
|
|
|
|
segment: &'a PathSegment,
|
|
|
|
|
) -> V::Result {
|
|
|
|
|
try_visit!(visitor.visit_ident(segment.ident));
|
|
|
|
|
visit_opt!(visitor, visit_generic_args, &segment.args);
|
|
|
|
|
V::Result::output()
|
2014-11-15 16:55:27 -05:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_generic_args<'a, V>(visitor: &mut V, generic_args: &'a GenericArgs) -> V::Result
|
2019-12-22 17:42:04 -05:00
|
|
|
where
|
|
|
|
|
V: Visitor<'a>,
|
2016-06-12 07:51:31 +00:00
|
|
|
{
|
2022-11-16 19:26:38 +00:00
|
|
|
match generic_args {
|
|
|
|
|
GenericArgs::AngleBracketed(data) => {
|
2020-03-22 04:40:05 +01:00
|
|
|
for arg in &data.args {
|
|
|
|
|
match arg {
|
2024-02-18 03:12:44 -05:00
|
|
|
AngleBracketedArg::Arg(a) => try_visit!(visitor.visit_generic_arg(a)),
|
|
|
|
|
AngleBracketedArg::Constraint(c) => {
|
|
|
|
|
try_visit!(visitor.visit_assoc_constraint(c))
|
|
|
|
|
}
|
2020-03-22 04:40:05 +01:00
|
|
|
}
|
|
|
|
|
}
|
2014-11-15 16:55:27 -05:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
GenericArgs::Parenthesized(data) => {
|
2015-09-28 14:26:26 +03:00
|
|
|
walk_list!(visitor, visit_ty, &data.inputs);
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_fn_ret_ty(&data.output));
|
2013-08-07 09:47:28 -07:00
|
|
|
}
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2011-12-13 13:19:56 +01:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_generic_arg<'a, V>(visitor: &mut V, generic_arg: &'a GenericArg) -> V::Result
|
2020-10-09 19:20:06 -03:00
|
|
|
where
|
|
|
|
|
V: Visitor<'a>,
|
|
|
|
|
{
|
|
|
|
|
match generic_arg {
|
2022-05-10 19:56:46 +02:00
|
|
|
GenericArg::Lifetime(lt) => visitor.visit_lifetime(lt, LifetimeCtxt::GenericArg),
|
2020-10-09 19:20:06 -03:00
|
|
|
GenericArg::Type(ty) => visitor.visit_ty(ty),
|
|
|
|
|
GenericArg::Const(ct) => visitor.visit_anon_const(ct),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_assoc_constraint<'a, V: Visitor<'a>>(
|
|
|
|
|
visitor: &mut V,
|
|
|
|
|
constraint: &'a AssocConstraint,
|
|
|
|
|
) -> V::Result {
|
|
|
|
|
try_visit!(visitor.visit_ident(constraint.ident));
|
|
|
|
|
visit_opt!(visitor, visit_generic_args, &constraint.gen_args);
|
2022-11-16 19:26:38 +00:00
|
|
|
match &constraint.kind {
|
|
|
|
|
AssocConstraintKind::Equality { term } => match term {
|
2024-02-18 03:12:44 -05:00
|
|
|
Term::Ty(ty) => try_visit!(visitor.visit_ty(ty)),
|
|
|
|
|
Term::Const(c) => try_visit!(visitor.visit_anon_const(c)),
|
2022-01-07 03:58:32 +00:00
|
|
|
},
|
2022-11-16 19:26:38 +00:00
|
|
|
AssocConstraintKind::Bound { bounds } => {
|
2022-04-21 10:09:32 +08:00
|
|
|
walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
|
2019-02-28 22:43:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2014-12-28 10:07:21 -05:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_pat<'a, V: Visitor<'a>>(visitor: &mut V, pattern: &'a Pat) -> V::Result {
|
2022-11-16 19:26:38 +00:00
|
|
|
match &pattern.kind {
|
|
|
|
|
PatKind::TupleStruct(opt_qself, path, elems) => {
|
|
|
|
|
if let Some(qself) = opt_qself {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(&qself.ty));
|
2020-12-10 13:20:07 +01:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_path(path, pattern.id));
|
2019-07-09 09:25:18 +02:00
|
|
|
walk_list!(visitor, visit_pat, elems);
|
2012-08-06 17:01:14 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
PatKind::Path(opt_qself, path) => {
|
|
|
|
|
if let Some(qself) = opt_qself {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(&qself.ty));
|
2016-06-11 18:47:47 +03:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_path(path, pattern.id))
|
2015-03-25 10:53:28 -06:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
PatKind::Struct(opt_qself, path, fields, _) => {
|
|
|
|
|
if let Some(qself) = opt_qself {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(&qself.ty));
|
2020-12-10 13:20:07 +01:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_path(path, pattern.id));
|
2021-03-16 00:36:07 +03:00
|
|
|
walk_list!(visitor, visit_pat_field, fields);
|
2013-02-17 22:20:36 -08:00
|
|
|
}
|
2024-03-20 16:53:50 -04:00
|
|
|
PatKind::Box(subpattern)
|
|
|
|
|
| PatKind::Deref(subpattern)
|
|
|
|
|
| PatKind::Ref(subpattern, _)
|
|
|
|
|
| PatKind::Paren(subpattern) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_pat(subpattern));
|
2022-11-16 19:26:38 +00:00
|
|
|
}
|
|
|
|
|
PatKind::Ident(_, ident, optional_subpattern) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ident(*ident));
|
|
|
|
|
visit_opt!(visitor, visit_pat, optional_subpattern);
|
2012-12-08 20:22:43 +00:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
PatKind::Lit(expression) => try_visit!(visitor.visit_expr(expression)),
|
2022-11-16 19:26:38 +00:00
|
|
|
PatKind::Range(lower_bound, upper_bound, _) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_expr, lower_bound);
|
|
|
|
|
visit_opt!(visitor, visit_expr, upper_bound);
|
2013-02-17 22:20:36 -08:00
|
|
|
}
|
2024-01-17 03:14:16 +01:00
|
|
|
PatKind::Wild | PatKind::Rest | PatKind::Never | PatKind::Err(_) => {}
|
2022-11-16 19:26:38 +00:00
|
|
|
PatKind::Tuple(elems) | PatKind::Slice(elems) | PatKind::Or(elems) => {
|
2019-07-09 09:25:18 +02:00
|
|
|
walk_list!(visitor, visit_pat, elems);
|
2012-12-08 20:22:43 +00:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
PatKind::MacCall(mac) => try_visit!(visitor.visit_mac_call(mac)),
|
2011-06-08 22:48:19 +02:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2011-06-08 22:48:19 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_foreign_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a ForeignItem) -> V::Result {
|
2022-11-16 19:26:38 +00:00
|
|
|
let &Item { id, span, ident, ref vis, ref attrs, ref kind, tokens: _ } = item;
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_vis(vis));
|
|
|
|
|
try_visit!(visitor.visit_ident(ident));
|
2020-02-29 15:51:08 +03:00
|
|
|
walk_list!(visitor, visit_attribute, attrs);
|
|
|
|
|
match kind {
|
|
|
|
|
ForeignItemKind::Static(ty, _, expr) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(ty));
|
|
|
|
|
visit_opt!(visitor, visit_expr, expr);
|
2020-02-29 15:51:08 +03:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ForeignItemKind::Fn(box Fn { defaultness: _, generics, sig, body }) => {
|
2021-11-19 22:03:43 +01:00
|
|
|
let kind = FnKind::Fn(FnCtxt::Foreign, ident, sig, vis, generics, body.as_deref());
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_fn(kind, span, id));
|
2020-02-29 15:51:08 +03:00
|
|
|
}
|
2021-10-19 18:45:48 -04:00
|
|
|
ForeignItemKind::TyAlias(box TyAlias { generics, bounds, ty, .. }) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_generics(generics));
|
2022-04-21 10:09:32 +08:00
|
|
|
walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_ty, ty);
|
2020-02-29 15:51:08 +03:00
|
|
|
}
|
2020-02-29 19:32:20 +03:00
|
|
|
ForeignItemKind::MacCall(mac) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_mac_call(mac));
|
2020-02-29 15:51:08 +03:00
|
|
|
}
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2014-11-15 16:55:27 -05:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_param_bound<'a, V: Visitor<'a>>(visitor: &mut V, bound: &'a GenericBound) -> V::Result {
|
2022-11-16 19:26:38 +00:00
|
|
|
match bound {
|
|
|
|
|
GenericBound::Trait(typ, _modifier) => visitor.visit_poly_trait_ref(typ),
|
|
|
|
|
GenericBound::Outlives(lifetime) => visitor.visit_lifetime(lifetime, LifetimeCtxt::Bound),
|
2012-08-06 18:54:20 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-03 21:47:02 -04:00
|
|
|
pub fn walk_precise_capturing_arg<'a, V: Visitor<'a>>(
|
|
|
|
|
visitor: &mut V,
|
|
|
|
|
arg: &'a PreciseCapturingArg,
|
|
|
|
|
) {
|
|
|
|
|
match arg {
|
|
|
|
|
PreciseCapturingArg::Lifetime(lt) => {
|
|
|
|
|
visitor.visit_lifetime(lt, LifetimeCtxt::GenericArg);
|
|
|
|
|
}
|
|
|
|
|
PreciseCapturingArg::Arg(ident, _) => {
|
|
|
|
|
visitor.visit_ident(*ident);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_generic_param<'a, V: Visitor<'a>>(
|
|
|
|
|
visitor: &mut V,
|
|
|
|
|
param: &'a GenericParam,
|
|
|
|
|
) -> V::Result {
|
|
|
|
|
try_visit!(visitor.visit_ident(param.ident));
|
|
|
|
|
walk_list!(visitor, visit_attribute, ¶m.attrs);
|
2022-04-21 10:09:32 +08:00
|
|
|
walk_list!(visitor, visit_param_bound, ¶m.bounds, BoundKind::Bound);
|
2022-11-16 19:26:38 +00:00
|
|
|
match ¶m.kind {
|
2019-02-28 22:43:53 +00:00
|
|
|
GenericParamKind::Lifetime => (),
|
2024-02-18 03:12:44 -05:00
|
|
|
GenericParamKind::Type { default } => visit_opt!(visitor, visit_ty, default),
|
2022-11-16 19:26:38 +00:00
|
|
|
GenericParamKind::Const { ty, default, .. } => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(ty));
|
|
|
|
|
visit_opt!(visitor, visit_anon_const, default);
|
2020-12-31 01:58:27 +01:00
|
|
|
}
|
2011-12-28 17:50:12 +01:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2017-10-16 21:07:26 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_generics<'a, V: Visitor<'a>>(visitor: &mut V, generics: &'a Generics) -> V::Result {
|
2017-10-16 21:07:26 +02:00
|
|
|
walk_list!(visitor, visit_generic_param, &generics.params);
|
2017-01-25 22:01:11 +02:00
|
|
|
walk_list!(visitor, visit_where_predicate, &generics.where_clause.predicates);
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2017-01-25 22:01:11 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_closure_binder<'a, V: Visitor<'a>>(
|
|
|
|
|
visitor: &mut V,
|
|
|
|
|
binder: &'a ClosureBinder,
|
|
|
|
|
) -> V::Result {
|
2022-06-02 20:15:05 +04:00
|
|
|
match binder {
|
|
|
|
|
ClosureBinder::NotPresent => {}
|
2022-07-12 13:34:24 +04:00
|
|
|
ClosureBinder::For { generic_params, span: _ } => {
|
2022-06-02 20:15:05 +04:00
|
|
|
walk_list!(visitor, visit_generic_param, generic_params)
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2022-06-02 20:15:05 +04:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_where_predicate<'a, V: Visitor<'a>>(
|
|
|
|
|
visitor: &mut V,
|
|
|
|
|
predicate: &'a WherePredicate,
|
|
|
|
|
) -> V::Result {
|
2022-11-16 19:26:38 +00:00
|
|
|
match predicate {
|
2019-12-22 17:42:04 -05:00
|
|
|
WherePredicate::BoundPredicate(WhereBoundPredicate {
|
2022-11-16 19:26:38 +00:00
|
|
|
bounded_ty,
|
|
|
|
|
bounds,
|
|
|
|
|
bound_generic_params,
|
2019-12-22 17:42:04 -05:00
|
|
|
..
|
|
|
|
|
}) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(bounded_ty));
|
2022-04-21 10:09:32 +08:00
|
|
|
walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
|
2017-10-16 21:07:26 +02:00
|
|
|
walk_list!(visitor, visit_generic_param, bound_generic_params);
|
2017-01-25 22:01:11 +02:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
WherePredicate::RegionPredicate(WhereRegionPredicate { lifetime, bounds, .. }) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_lifetime(lifetime, LifetimeCtxt::Bound));
|
2022-04-21 10:09:32 +08:00
|
|
|
walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
|
2017-01-25 22:01:11 +02:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
WherePredicate::EqPredicate(WhereEqPredicate { lhs_ty, rhs_ty, .. }) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(lhs_ty));
|
|
|
|
|
try_visit!(visitor.visit_ty(rhs_ty));
|
2014-11-29 17:08:30 +13:00
|
|
|
}
|
2014-08-11 09:32:26 -07:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2011-12-28 17:50:12 +01:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_fn_ret_ty<'a, V: Visitor<'a>>(visitor: &mut V, ret_ty: &'a FnRetTy) -> V::Result {
|
2022-11-16 19:26:38 +00:00
|
|
|
if let FnRetTy::Ty(output_ty) = ret_ty {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(output_ty));
|
2015-09-29 00:23:54 +03:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2015-09-29 00:23:54 +03:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_fn_decl<'a, V: Visitor<'a>>(
|
|
|
|
|
visitor: &mut V,
|
|
|
|
|
function_declaration: &'a FnDecl,
|
|
|
|
|
) -> V::Result {
|
|
|
|
|
walk_list!(visitor, visit_param, &function_declaration.inputs);
|
|
|
|
|
visitor.visit_fn_ret_ty(&function_declaration.output)
|
2011-06-08 22:48:19 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_fn<'a, V: Visitor<'a>>(visitor: &mut V, kind: FnKind<'a>) -> V::Result {
|
2016-10-26 02:17:29 +03:00
|
|
|
match kind {
|
2021-11-19 22:03:43 +01:00
|
|
|
FnKind::Fn(_, _, sig, _, generics, body) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_generics(generics));
|
|
|
|
|
try_visit!(visitor.visit_fn_header(&sig.header));
|
|
|
|
|
try_visit!(walk_fn_decl(visitor, &sig.decl));
|
|
|
|
|
visit_opt!(visitor, visit_block, body);
|
2016-10-26 02:17:29 +03:00
|
|
|
}
|
2022-06-02 20:15:05 +04:00
|
|
|
FnKind::Closure(binder, decl, body) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_closure_binder(binder));
|
|
|
|
|
try_visit!(walk_fn_decl(visitor, decl));
|
|
|
|
|
try_visit!(visitor.visit_expr(body));
|
2013-10-28 17:37:10 -04:00
|
|
|
}
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2015-09-29 00:23:54 +03:00
|
|
|
}
|
2013-10-28 17:37:10 -04:00
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_assoc_item<'a, V: Visitor<'a>>(
|
|
|
|
|
visitor: &mut V,
|
|
|
|
|
item: &'a AssocItem,
|
|
|
|
|
ctxt: AssocCtxt,
|
|
|
|
|
) -> V::Result {
|
2022-11-16 19:26:38 +00:00
|
|
|
let &Item { id, span, ident, ref vis, ref attrs, ref kind, tokens: _ } = item;
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_vis(vis));
|
|
|
|
|
try_visit!(visitor.visit_ident(ident));
|
2020-02-15 18:42:43 +01:00
|
|
|
walk_list!(visitor, visit_attribute, attrs);
|
|
|
|
|
match kind {
|
2023-05-04 16:08:33 +02:00
|
|
|
AssocItemKind::Const(box ConstItem { defaultness: _, generics, ty, expr }) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_generics(generics));
|
|
|
|
|
try_visit!(visitor.visit_ty(ty));
|
|
|
|
|
visit_opt!(visitor, visit_expr, expr);
|
2015-03-14 12:05:00 -06:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
AssocItemKind::Fn(box Fn { defaultness: _, generics, sig, body }) => {
|
2021-11-19 22:03:43 +01:00
|
|
|
let kind = FnKind::Fn(FnCtxt::Assoc(ctxt), ident, sig, vis, generics, body.as_deref());
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_fn(kind, span, id));
|
2015-03-10 12:28:44 +02:00
|
|
|
}
|
2022-10-10 02:05:24 +00:00
|
|
|
AssocItemKind::Type(box TyAlias { generics, bounds, ty, .. }) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_generics(generics));
|
2022-04-21 10:09:32 +08:00
|
|
|
walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_ty, ty);
|
2014-08-05 19:44:21 -07:00
|
|
|
}
|
2020-02-29 19:32:20 +03:00
|
|
|
AssocItemKind::MacCall(mac) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_mac_call(mac));
|
2015-03-11 23:38:58 +02:00
|
|
|
}
|
2024-01-24 17:33:33 +01:00
|
|
|
AssocItemKind::Delegation(box Delegation { id, qself, path, body }) => {
|
2023-11-26 15:57:31 +03:00
|
|
|
if let Some(qself) = qself {
|
2024-03-18 11:21:06 -04:00
|
|
|
try_visit!(visitor.visit_ty(&qself.ty));
|
2023-11-26 15:57:31 +03:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_path(path, *id));
|
|
|
|
|
visit_opt!(visitor, visit_block, body);
|
2023-11-26 15:57:31 +03:00
|
|
|
}
|
2012-07-10 13:44:20 -07:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2012-07-10 13:44:20 -07:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_struct_def<'a, V: Visitor<'a>>(
|
|
|
|
|
visitor: &mut V,
|
|
|
|
|
struct_definition: &'a VariantData,
|
|
|
|
|
) -> V::Result {
|
2021-03-16 00:36:07 +03:00
|
|
|
walk_list!(visitor, visit_field_def, struct_definition.fields());
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2012-08-07 15:54:59 -07:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_field_def<'a, V: Visitor<'a>>(visitor: &mut V, field: &'a FieldDef) -> V::Result {
|
|
|
|
|
try_visit!(visitor.visit_vis(&field.vis));
|
|
|
|
|
visit_opt!(visitor, visit_ident, field.ident);
|
|
|
|
|
try_visit!(visitor.visit_ty(&field.ty));
|
2021-03-16 00:36:07 +03:00
|
|
|
walk_list!(visitor, visit_attribute, &field.attrs);
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2012-08-15 15:53:58 -07:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_block<'a, V: Visitor<'a>>(visitor: &mut V, block: &'a Block) -> V::Result {
|
2015-09-28 14:26:26 +03:00
|
|
|
walk_list!(visitor, visit_stmt, &block.stmts);
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2011-06-08 22:48:19 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_stmt<'a, V: Visitor<'a>>(visitor: &mut V, statement: &'a Stmt) -> V::Result {
|
2022-11-16 19:26:38 +00:00
|
|
|
match &statement.kind {
|
2024-03-14 11:25:05 +01:00
|
|
|
StmtKind::Let(local) => try_visit!(visitor.visit_local(local)),
|
2024-02-18 03:12:44 -05:00
|
|
|
StmtKind::Item(item) => try_visit!(visitor.visit_item(item)),
|
|
|
|
|
StmtKind::Expr(expr) | StmtKind::Semi(expr) => try_visit!(visitor.visit_expr(expr)),
|
2020-02-27 04:10:42 +01:00
|
|
|
StmtKind::Empty => {}
|
2022-11-16 19:26:38 +00:00
|
|
|
StmtKind::MacCall(mac) => {
|
|
|
|
|
let MacCallStmt { mac, attrs, style: _, tokens: _ } = &**mac;
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_mac_call(mac));
|
|
|
|
|
walk_list!(visitor, visit_attribute, attrs);
|
2015-11-03 17:39:51 +01:00
|
|
|
}
|
2011-06-08 22:48:19 +02:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2011-06-08 22:48:19 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_mac<'a, V: Visitor<'a>>(visitor: &mut V, mac: &'a MacCall) -> V::Result {
|
|
|
|
|
visitor.visit_path(&mac.path, DUMMY_NODE_ID)
|
2011-07-08 16:35:09 -07:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_anon_const<'a, V: Visitor<'a>>(visitor: &mut V, constant: &'a AnonConst) -> V::Result {
|
|
|
|
|
visitor.visit_expr(&constant.value)
|
2018-05-17 21:28:50 +03:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_inline_asm<'a, V: Visitor<'a>>(visitor: &mut V, asm: &'a InlineAsm) -> V::Result {
|
2021-04-11 20:51:28 +01:00
|
|
|
for (op, _) in &asm.operands {
|
|
|
|
|
match op {
|
|
|
|
|
InlineAsmOperand::In { expr, .. }
|
2021-08-16 17:30:23 +02:00
|
|
|
| InlineAsmOperand::Out { expr: Some(expr), .. }
|
2024-02-18 03:12:44 -05:00
|
|
|
| InlineAsmOperand::InOut { expr, .. } => try_visit!(visitor.visit_expr(expr)),
|
2021-08-16 17:30:23 +02:00
|
|
|
InlineAsmOperand::Out { expr: None, .. } => {}
|
2021-04-11 20:51:28 +01:00
|
|
|
InlineAsmOperand::SplitInOut { in_expr, out_expr, .. } => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(in_expr));
|
|
|
|
|
visit_opt!(visitor, visit_expr, out_expr);
|
|
|
|
|
}
|
|
|
|
|
InlineAsmOperand::Const { anon_const, .. } => {
|
|
|
|
|
try_visit!(visitor.visit_anon_const(anon_const))
|
2021-04-11 20:51:28 +01:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
InlineAsmOperand::Sym { sym } => try_visit!(visitor.visit_inline_asm_sym(sym)),
|
2023-12-25 20:53:01 +00:00
|
|
|
InlineAsmOperand::Label { block } => try_visit!(visitor.visit_block(block)),
|
2021-04-11 20:51:28 +01:00
|
|
|
}
|
|
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2021-04-11 20:51:28 +01:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_inline_asm_sym<'a, V: Visitor<'a>>(
|
|
|
|
|
visitor: &mut V,
|
|
|
|
|
sym: &'a InlineAsmSym,
|
|
|
|
|
) -> V::Result {
|
2022-11-16 19:26:38 +00:00
|
|
|
if let Some(qself) = &sym.qself {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(&qself.ty));
|
2022-03-01 00:50:56 +00:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
visitor.visit_path(&sym.path, sym.id)
|
2022-03-01 00:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_format_args<'a, V: Visitor<'a>>(visitor: &mut V, fmt: &'a FormatArgs) -> V::Result {
|
2023-01-11 21:41:13 +01:00
|
|
|
for arg in fmt.arguments.all_args() {
|
|
|
|
|
if let FormatArgumentKind::Named(name) = arg.kind {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ident(name));
|
2023-01-11 21:41:13 +01:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(&arg.expr));
|
2023-01-11 21:41:13 +01:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2023-01-11 21:41:13 +01:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) -> V::Result {
|
|
|
|
|
walk_list!(visitor, visit_attribute, &expression.attrs);
|
2019-08-28 00:57:50 +02:00
|
|
|
|
2022-11-16 19:26:38 +00:00
|
|
|
match &expression.kind {
|
|
|
|
|
ExprKind::Array(subexpressions) => {
|
2015-09-28 14:26:26 +03:00
|
|
|
walk_list!(visitor, visit_expr, subexpressions);
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
ExprKind::ConstBlock(anon_const) => try_visit!(visitor.visit_anon_const(anon_const)),
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Repeat(element, count) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(element));
|
|
|
|
|
try_visit!(visitor.visit_anon_const(count));
|
2013-02-17 22:20:36 -08:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Struct(se) => {
|
|
|
|
|
if let Some(qself) = &se.qself {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(&qself.ty));
|
2020-12-10 13:20:07 +01:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_path(&se.path, expression.id));
|
2021-03-16 03:15:53 +03:00
|
|
|
walk_list!(visitor, visit_expr_field, &se.fields);
|
|
|
|
|
match &se.rest {
|
2024-02-18 03:12:44 -05:00
|
|
|
StructRest::Base(expr) => try_visit!(visitor.visit_expr(expr)),
|
2020-11-07 14:28:55 +00:00
|
|
|
StructRest::Rest(_span) => {}
|
|
|
|
|
StructRest::None => {}
|
|
|
|
|
}
|
2013-02-17 22:20:36 -08:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Tup(subexpressions) => {
|
2015-09-28 14:26:26 +03:00
|
|
|
walk_list!(visitor, visit_expr, subexpressions);
|
2013-02-17 22:20:36 -08:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Call(callee_expression, arguments) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(callee_expression));
|
2015-09-28 14:26:26 +03:00
|
|
|
walk_list!(visitor, visit_expr, arguments);
|
2013-02-17 22:20:36 -08:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::MethodCall(box MethodCall { seg, receiver, args, span: _ }) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_path_segment(seg));
|
|
|
|
|
try_visit!(visitor.visit_expr(receiver));
|
2022-09-08 10:52:51 +10:00
|
|
|
walk_list!(visitor, visit_expr, args);
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Binary(_, left_expression, right_expression) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(left_expression));
|
|
|
|
|
try_visit!(visitor.visit_expr(right_expression));
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::AddrOf(_, _, subexpression) | ExprKind::Unary(_, subexpression) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(subexpression));
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Cast(subexpression, typ) | ExprKind::Type(subexpression, typ) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(subexpression));
|
|
|
|
|
try_visit!(visitor.visit_ty(typ));
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2023-09-08 10:14:36 +00:00
|
|
|
ExprKind::Let(pat, expr, _, _) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_pat(pat));
|
|
|
|
|
try_visit!(visitor.visit_expr(expr));
|
2019-05-15 16:06:58 +02:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::If(head_expression, if_block, optional_else) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(head_expression));
|
|
|
|
|
try_visit!(visitor.visit_block(if_block));
|
|
|
|
|
visit_opt!(visitor, visit_expr, optional_else);
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::While(subexpression, block, opt_label) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_label, opt_label);
|
|
|
|
|
try_visit!(visitor.visit_expr(subexpression));
|
|
|
|
|
try_visit!(visitor.visit_block(block));
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2023-12-08 14:51:50 -08:00
|
|
|
ExprKind::ForLoop { pat, iter, body, label, kind: _ } => {
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_label, label);
|
|
|
|
|
try_visit!(visitor.visit_pat(pat));
|
|
|
|
|
try_visit!(visitor.visit_expr(iter));
|
|
|
|
|
try_visit!(visitor.visit_block(body));
|
2015-09-28 14:26:26 +03:00
|
|
|
}
|
2022-11-02 21:22:24 -07:00
|
|
|
ExprKind::Loop(block, opt_label, _) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_label, opt_label);
|
|
|
|
|
try_visit!(visitor.visit_block(block));
|
2015-09-28 14:26:26 +03:00
|
|
|
}
|
2024-02-17 12:43:54 -05:00
|
|
|
ExprKind::Match(subexpression, arms, _kind) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(subexpression));
|
2015-09-28 14:26:26 +03:00
|
|
|
walk_list!(visitor, visit_arm, arms);
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-09-08 10:52:51 +10:00
|
|
|
ExprKind::Closure(box Closure {
|
2022-11-16 19:26:38 +00:00
|
|
|
binder,
|
2023-11-04 20:39:15 +01:00
|
|
|
capture_clause,
|
2023-12-05 21:39:36 +00:00
|
|
|
coroutine_kind: _,
|
2022-12-20 16:15:55 +00:00
|
|
|
constness: _,
|
2022-09-08 10:52:51 +10:00
|
|
|
movability: _,
|
2022-11-16 19:26:38 +00:00
|
|
|
fn_decl,
|
|
|
|
|
body,
|
2022-09-08 10:52:51 +10:00
|
|
|
fn_decl_span: _,
|
2022-11-09 20:39:28 +05:30
|
|
|
fn_arg_span: _,
|
2022-09-08 10:52:51 +10:00
|
|
|
}) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_capture_by(capture_clause));
|
|
|
|
|
try_visit!(visitor.visit_fn(
|
|
|
|
|
FnKind::Closure(binder, fn_decl, body),
|
|
|
|
|
expression.span,
|
|
|
|
|
expression.id
|
|
|
|
|
))
|
2020-01-30 00:18:54 +01:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Block(block, opt_label) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_label, opt_label);
|
|
|
|
|
try_visit!(visitor.visit_block(block));
|
2018-04-16 05:44:39 +02:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
ExprKind::Gen(_, body, _) => try_visit!(visitor.visit_block(body)),
|
|
|
|
|
ExprKind::Await(expr, _) => try_visit!(visitor.visit_expr(expr)),
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Assign(lhs, rhs, _) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(lhs));
|
|
|
|
|
try_visit!(visitor.visit_expr(rhs));
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::AssignOp(_, left_expression, right_expression) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(left_expression));
|
|
|
|
|
try_visit!(visitor.visit_expr(right_expression));
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Field(subexpression, ident) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(subexpression));
|
|
|
|
|
try_visit!(visitor.visit_ident(*ident));
|
2013-02-17 22:20:36 -08:00
|
|
|
}
|
2023-08-03 21:43:17 +02:00
|
|
|
ExprKind::Index(main_expression, index_expression, _) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_expr(main_expression));
|
|
|
|
|
try_visit!(visitor.visit_expr(index_expression));
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Range(start, end, _) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_expr, start);
|
|
|
|
|
visit_opt!(visitor, visit_expr, end);
|
2014-12-13 18:41:02 +13:00
|
|
|
}
|
2020-11-11 13:15:15 +00:00
|
|
|
ExprKind::Underscore => {}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Path(maybe_qself, path) => {
|
|
|
|
|
if let Some(qself) = maybe_qself {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_ty(&qself.ty));
|
2015-02-17 19:29:13 +02:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_path(path, expression.id));
|
2013-12-08 11:25:35 -08:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Break(opt_label, opt_expr) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_label, opt_label);
|
|
|
|
|
visit_opt!(visitor, visit_expr, opt_expr);
|
Implement the `loop_break_value` feature.
This implements RFC 1624, tracking issue #37339.
- `FnCtxt` (in typeck) gets a stack of `LoopCtxt`s, which store the
currently deduced type of that loop, the desired type, and a list of
break expressions currently seen. `loop` loops get a fresh type
variable as their initial type (this logic is stolen from that for
arrays). `while` loops get `()`.
- `break {expr}` looks up the broken loop, and unifies the type of
`expr` with the type of the loop.
- `break` with no expr unifies the loop's type with `()`.
- When building MIR, `loop` loops no longer construct a `()` value at
termination of the loop; rather, the `break` expression assigns the
result of the loop. `while` loops are unchanged.
- `break` respects contexts in which expressions may not end with braced
blocks. That is, `while break { break-value } { while-body }` is
illegal; this preserves backwards compatibility.
- The RFC did not make it clear, but I chose to make `break ()` inside
of a `while` loop illegal, just in case we wanted to do anything with
that design space in the future.
This is my first time dealing with this part of rustc so I'm sure
there's plenty of problems to pick on here ^_^
2016-10-29 15:15:06 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Continue(opt_label) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_label, opt_label);
|
2015-09-28 14:26:26 +03:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Ret(optional_expression) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_expr, optional_expression);
|
2013-07-19 18:42:11 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Yeet(optional_expression) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_expr, optional_expression);
|
2022-03-25 23:43:54 -07:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
ExprKind::Become(expr) => try_visit!(visitor.visit_expr(expr)),
|
|
|
|
|
ExprKind::MacCall(mac) => try_visit!(visitor.visit_mac_call(mac)),
|
|
|
|
|
ExprKind::Paren(subexpression) => try_visit!(visitor.visit_expr(subexpression)),
|
|
|
|
|
ExprKind::InlineAsm(asm) => try_visit!(visitor.visit_inline_asm(asm)),
|
|
|
|
|
ExprKind::FormatArgs(f) => try_visit!(visitor.visit_format_args(f)),
|
2022-09-11 00:37:49 -07:00
|
|
|
ExprKind::OffsetOf(container, fields) => {
|
2024-03-18 11:21:06 -04:00
|
|
|
try_visit!(visitor.visit_ty(container));
|
2024-02-18 03:12:44 -05:00
|
|
|
walk_list!(visitor, visit_ident, fields.iter().copied());
|
2022-09-11 00:37:49 -07:00
|
|
|
}
|
2022-11-16 19:26:38 +00:00
|
|
|
ExprKind::Yield(optional_expression) => {
|
2024-02-18 03:12:44 -05:00
|
|
|
visit_opt!(visitor, visit_expr, optional_expression);
|
2016-12-26 14:34:03 +01:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
ExprKind::Try(subexpression) => try_visit!(visitor.visit_expr(subexpression)),
|
|
|
|
|
ExprKind::TryBlock(body) => try_visit!(visitor.visit_block(body)),
|
2024-02-25 22:22:11 +01:00
|
|
|
ExprKind::Lit(_) | ExprKind::IncludedBytes(..) | ExprKind::Err(_) | ExprKind::Dummy => {}
|
2011-06-08 22:48:19 +02:00
|
|
|
}
|
2013-07-19 18:42:11 -07:00
|
|
|
|
2014-09-12 13:10:30 +03:00
|
|
|
visitor.visit_expr_post(expression)
|
2011-06-08 22:48:19 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_param<'a, V: Visitor<'a>>(visitor: &mut V, param: &'a Param) -> V::Result {
|
|
|
|
|
walk_list!(visitor, visit_attribute, ¶m.attrs);
|
|
|
|
|
try_visit!(visitor.visit_pat(¶m.pat));
|
|
|
|
|
try_visit!(visitor.visit_ty(¶m.ty));
|
|
|
|
|
V::Result::output()
|
2019-07-26 19:52:37 -03:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_arm<'a, V: Visitor<'a>>(visitor: &mut V, arm: &'a Arm) -> V::Result {
|
|
|
|
|
try_visit!(visitor.visit_pat(&arm.pat));
|
|
|
|
|
visit_opt!(visitor, visit_expr, &arm.guard);
|
|
|
|
|
visit_opt!(visitor, visit_expr, &arm.body);
|
2015-09-28 14:26:26 +03:00
|
|
|
walk_list!(visitor, visit_attribute, &arm.attrs);
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2011-06-08 22:48:19 +02:00
|
|
|
}
|
2016-03-31 19:10:38 +00:00
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_vis<'a, V: Visitor<'a>>(visitor: &mut V, vis: &'a Visibility) -> V::Result {
|
2022-08-09 23:31:45 -04:00
|
|
|
if let VisibilityKind::Restricted { ref path, id, shorthand: _ } = vis.kind {
|
2024-02-18 03:12:44 -05:00
|
|
|
try_visit!(visitor.visit_path(path, id));
|
2016-03-31 19:10:38 +00:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2016-03-31 19:10:38 +00:00
|
|
|
}
|
2017-10-23 17:22:28 +09:00
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_attribute<'a, V: Visitor<'a>>(visitor: &mut V, attr: &'a Attribute) -> V::Result {
|
2022-11-16 19:26:38 +00:00
|
|
|
match &attr.kind {
|
2024-02-18 03:12:44 -05:00
|
|
|
AttrKind::Normal(normal) => try_visit!(walk_attr_args(visitor, &normal.item.args)),
|
2020-07-21 22:16:19 +03:00
|
|
|
AttrKind::DocComment(..) => {}
|
2019-10-24 06:33:12 +11:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2017-10-23 17:22:28 +09:00
|
|
|
}
|
|
|
|
|
|
2024-02-18 03:12:44 -05:00
|
|
|
pub fn walk_attr_args<'a, V: Visitor<'a>>(visitor: &mut V, args: &'a AttrArgs) -> V::Result {
|
2019-12-01 17:07:38 +03:00
|
|
|
match args {
|
2022-11-18 11:24:21 +11:00
|
|
|
AttrArgs::Empty => {}
|
|
|
|
|
AttrArgs::Delimited(_) => {}
|
2024-02-18 03:12:44 -05:00
|
|
|
AttrArgs::Eq(_eq_span, AttrArgsEq::Ast(expr)) => try_visit!(visitor.visit_expr(expr)),
|
2022-11-18 11:24:21 +11:00
|
|
|
AttrArgs::Eq(_, AttrArgsEq::Hir(lit)) => {
|
Overhaul `MacArgs::Eq`.
The value in `MacArgs::Eq` is currently represented as a `Token`.
Because of `TokenKind::Interpolated`, `Token` can be either a token or
an arbitrary AST fragment. In practice, a `MacArgs::Eq` starts out as a
literal or macro call AST fragment, and then is later lowered to a
literal token. But this is very non-obvious. `Token` is a much more
general type than what is needed.
This commit restricts things, by introducing a new type `MacArgsEqKind`
that is either an AST expression (pre-lowering) or an AST literal
(post-lowering). The downside is that the code is a bit more verbose in
a few places. The benefit is that makes it much clearer what the
possibilities are (though also shorter in some other places). Also, it
removes one use of `TokenKind::Interpolated`, taking us a step closer to
removing that variant, which will let us make `Token` impl `Copy` and
remove many "handle Interpolated" code paths in the parser.
Things to note:
- Error messages have improved. Messages like this:
```
unexpected token: `"bug" + "found"`
```
now say "unexpected expression", which makes more sense. Although
arbitrary expressions can exist within tokens thanks to
`TokenKind::Interpolated`, that's not obvious to anyone who doesn't
know compiler internals.
- In `parse_mac_args_common`, we no longer need to collect tokens for
the value expression.
2022-04-29 06:52:01 +10:00
|
|
|
unreachable!("in literal form when walking mac args eq: {:?}", lit)
|
|
|
|
|
}
|
2017-10-23 17:22:28 +09:00
|
|
|
}
|
2024-02-18 03:12:44 -05:00
|
|
|
V::Result::output()
|
2017-10-23 17:22:28 +09:00
|
|
|
}
|