Skip to main content

mago_syntax/walker/
mod.rs

1#![allow(unused_variables)]
2
3use crate::ast::Program;
4use crate::ast::ast::Access;
5use crate::ast::ast::AnonymousClass;
6use crate::ast::ast::Argument;
7use crate::ast::ast::ArgumentList;
8use crate::ast::ast::Array;
9use crate::ast::ast::ArrayAccess;
10use crate::ast::ast::ArrayAppend;
11use crate::ast::ast::ArrayElement;
12use crate::ast::ast::ArrowFunction;
13use crate::ast::ast::Assignment;
14use crate::ast::ast::AssignmentOperator;
15use crate::ast::ast::Attribute;
16use crate::ast::ast::AttributeList;
17use crate::ast::ast::Binary;
18use crate::ast::ast::BinaryOperator;
19use crate::ast::ast::Block;
20use crate::ast::ast::BracedExpressionStringPart;
21use crate::ast::ast::Break;
22use crate::ast::ast::Call;
23use crate::ast::ast::Class;
24use crate::ast::ast::ClassConstantAccess;
25use crate::ast::ast::ClassLikeConstant;
26use crate::ast::ast::ClassLikeConstantItem;
27use crate::ast::ast::ClassLikeConstantSelector;
28use crate::ast::ast::ClassLikeMember;
29use crate::ast::ast::ClassLikeMemberExpressionSelector;
30use crate::ast::ast::ClassLikeMemberSelector;
31use crate::ast::ast::Clone;
32use crate::ast::ast::ClosingTag;
33use crate::ast::ast::Closure;
34use crate::ast::ast::ClosureUseClause;
35use crate::ast::ast::ClosureUseClauseVariable;
36use crate::ast::ast::CompositeString;
37use crate::ast::ast::Conditional;
38use crate::ast::ast::Constant;
39use crate::ast::ast::ConstantAccess;
40use crate::ast::ast::ConstantItem;
41use crate::ast::ast::Construct;
42use crate::ast::ast::Continue;
43use crate::ast::ast::Declare;
44use crate::ast::ast::DeclareBody;
45use crate::ast::ast::DeclareColonDelimitedBody;
46use crate::ast::ast::DeclareItem;
47use crate::ast::ast::DieConstruct;
48use crate::ast::ast::DirectVariable;
49use crate::ast::ast::DoWhile;
50use crate::ast::ast::DocumentString;
51use crate::ast::ast::Echo;
52use crate::ast::ast::EchoTag;
53use crate::ast::ast::EmptyConstruct;
54use crate::ast::ast::Enum;
55use crate::ast::ast::EnumBackingTypeHint;
56use crate::ast::ast::EnumCase;
57use crate::ast::ast::EnumCaseBackedItem;
58use crate::ast::ast::EnumCaseItem;
59use crate::ast::ast::EnumCaseUnitItem;
60use crate::ast::ast::EvalConstruct;
61use crate::ast::ast::ExitConstruct;
62use crate::ast::ast::Expression;
63use crate::ast::ast::ExpressionStatement;
64use crate::ast::ast::Extends;
65use crate::ast::ast::For;
66use crate::ast::ast::ForBody;
67use crate::ast::ast::ForColonDelimitedBody;
68use crate::ast::ast::Foreach;
69use crate::ast::ast::ForeachBody;
70use crate::ast::ast::ForeachColonDelimitedBody;
71use crate::ast::ast::ForeachKeyValueTarget;
72use crate::ast::ast::ForeachTarget;
73use crate::ast::ast::ForeachValueTarget;
74use crate::ast::ast::FullOpeningTag;
75use crate::ast::ast::FullyQualifiedIdentifier;
76use crate::ast::ast::Function;
77use crate::ast::ast::FunctionCall;
78use crate::ast::ast::FunctionLikeParameter;
79use crate::ast::ast::FunctionLikeParameterDefaultValue;
80use crate::ast::ast::FunctionLikeParameterList;
81use crate::ast::ast::FunctionLikeReturnTypeHint;
82use crate::ast::ast::FunctionPartialApplication;
83use crate::ast::ast::Global;
84use crate::ast::ast::Goto;
85use crate::ast::ast::HaltCompiler;
86use crate::ast::ast::Hint;
87use crate::ast::ast::HookedProperty;
88use crate::ast::ast::Identifier;
89use crate::ast::ast::If;
90use crate::ast::ast::IfBody;
91use crate::ast::ast::IfColonDelimitedBody;
92use crate::ast::ast::IfColonDelimitedBodyElseClause;
93use crate::ast::ast::IfColonDelimitedBodyElseIfClause;
94use crate::ast::ast::IfStatementBody;
95use crate::ast::ast::IfStatementBodyElseClause;
96use crate::ast::ast::IfStatementBodyElseIfClause;
97use crate::ast::ast::Implements;
98use crate::ast::ast::IncludeConstruct;
99use crate::ast::ast::IncludeOnceConstruct;
100use crate::ast::ast::IndirectVariable;
101use crate::ast::ast::Inline;
102use crate::ast::ast::Instantiation;
103use crate::ast::ast::Interface;
104use crate::ast::ast::InterpolatedString;
105use crate::ast::ast::IntersectionHint;
106use crate::ast::ast::IssetConstruct;
107use crate::ast::ast::KeyValueArrayElement;
108use crate::ast::ast::Keyword;
109use crate::ast::ast::Label;
110use crate::ast::ast::LegacyArray;
111use crate::ast::ast::List;
112use crate::ast::ast::Literal;
113use crate::ast::ast::LiteralFloat;
114use crate::ast::ast::LiteralInteger;
115use crate::ast::ast::LiteralString;
116use crate::ast::ast::LiteralStringPart;
117use crate::ast::ast::LocalIdentifier;
118use crate::ast::ast::MagicConstant;
119use crate::ast::ast::Match;
120use crate::ast::ast::MatchArm;
121use crate::ast::ast::MatchDefaultArm;
122use crate::ast::ast::MatchExpressionArm;
123use crate::ast::ast::MaybeTypedUseItem;
124use crate::ast::ast::Method;
125use crate::ast::ast::MethodAbstractBody;
126use crate::ast::ast::MethodBody;
127use crate::ast::ast::MethodCall;
128use crate::ast::ast::MethodPartialApplication;
129use crate::ast::ast::MissingArrayElement;
130use crate::ast::ast::MixedUseItemList;
131use crate::ast::ast::Modifier;
132use crate::ast::ast::NamedArgument;
133use crate::ast::ast::NamedPlaceholderArgument;
134use crate::ast::ast::Namespace;
135use crate::ast::ast::NamespaceBody;
136use crate::ast::ast::NamespaceImplicitBody;
137use crate::ast::ast::NestedVariable;
138use crate::ast::ast::NullSafeMethodCall;
139use crate::ast::ast::NullSafePropertyAccess;
140use crate::ast::ast::NullableHint;
141use crate::ast::ast::OpeningTag;
142use crate::ast::ast::Parenthesized;
143use crate::ast::ast::ParenthesizedHint;
144use crate::ast::ast::PartialApplication;
145use crate::ast::ast::PartialArgument;
146use crate::ast::ast::PartialArgumentList;
147use crate::ast::ast::Pipe;
148use crate::ast::ast::PlaceholderArgument;
149use crate::ast::ast::PlainProperty;
150use crate::ast::ast::PositionalArgument;
151use crate::ast::ast::PrintConstruct;
152use crate::ast::ast::Property;
153use crate::ast::ast::PropertyAbstractItem;
154use crate::ast::ast::PropertyAccess;
155use crate::ast::ast::PropertyConcreteItem;
156use crate::ast::ast::PropertyHook;
157use crate::ast::ast::PropertyHookAbstractBody;
158use crate::ast::ast::PropertyHookBody;
159use crate::ast::ast::PropertyHookConcreteBody;
160use crate::ast::ast::PropertyHookConcreteExpressionBody;
161use crate::ast::ast::PropertyHookList;
162use crate::ast::ast::PropertyItem;
163use crate::ast::ast::QualifiedIdentifier;
164use crate::ast::ast::RequireConstruct;
165use crate::ast::ast::RequireOnceConstruct;
166use crate::ast::ast::Return;
167use crate::ast::ast::ShellExecuteString;
168use crate::ast::ast::ShortOpeningTag;
169use crate::ast::ast::Statement;
170use crate::ast::ast::Static;
171use crate::ast::ast::StaticAbstractItem;
172use crate::ast::ast::StaticConcreteItem;
173use crate::ast::ast::StaticItem;
174use crate::ast::ast::StaticMethodCall;
175use crate::ast::ast::StaticMethodPartialApplication;
176use crate::ast::ast::StaticPropertyAccess;
177use crate::ast::ast::StringPart;
178use crate::ast::ast::Switch;
179use crate::ast::ast::SwitchBody;
180use crate::ast::ast::SwitchBraceDelimitedBody;
181use crate::ast::ast::SwitchCase;
182use crate::ast::ast::SwitchCaseSeparator;
183use crate::ast::ast::SwitchColonDelimitedBody;
184use crate::ast::ast::SwitchDefaultCase;
185use crate::ast::ast::SwitchExpressionCase;
186use crate::ast::ast::Terminator;
187use crate::ast::ast::Throw;
188use crate::ast::ast::Trait;
189use crate::ast::ast::TraitUse;
190use crate::ast::ast::TraitUseAbsoluteMethodReference;
191use crate::ast::ast::TraitUseAbstractSpecification;
192use crate::ast::ast::TraitUseAdaptation;
193use crate::ast::ast::TraitUseAliasAdaptation;
194use crate::ast::ast::TraitUseConcreteSpecification;
195use crate::ast::ast::TraitUseMethodReference;
196use crate::ast::ast::TraitUsePrecedenceAdaptation;
197use crate::ast::ast::TraitUseSpecification;
198use crate::ast::ast::Try;
199use crate::ast::ast::TryCatchClause;
200use crate::ast::ast::TryFinallyClause;
201use crate::ast::ast::TypedUseItemList;
202use crate::ast::ast::TypedUseItemSequence;
203use crate::ast::ast::UnaryPostfix;
204use crate::ast::ast::UnaryPostfixOperator;
205use crate::ast::ast::UnaryPrefix;
206use crate::ast::ast::UnaryPrefixOperator;
207use crate::ast::ast::UnionHint;
208use crate::ast::ast::Unset;
209use crate::ast::ast::Use;
210use crate::ast::ast::UseItem;
211use crate::ast::ast::UseItemAlias;
212use crate::ast::ast::UseItemSequence;
213use crate::ast::ast::UseItems;
214use crate::ast::ast::UseType;
215use crate::ast::ast::ValueArrayElement;
216use crate::ast::ast::Variable;
217use crate::ast::ast::VariadicArrayElement;
218use crate::ast::ast::VariadicPlaceholderArgument;
219use crate::ast::ast::While;
220use crate::ast::ast::WhileBody;
221use crate::ast::ast::WhileColonDelimitedBody;
222use crate::ast::ast::Yield;
223use crate::ast::ast::YieldFrom;
224use crate::ast::ast::YieldPair;
225use crate::ast::ast::YieldValue;
226
227/// Helper macro to generate the core walk logic.
228macro_rules! define_walk_body {
229    ($walker:ident, $context:ident, $var_name:ident, $code:block) => {
230        paste::paste! {
231            $walker.[<walk_in_ $var_name>]($var_name, $context);
232            $code
233            $walker.[<walk_out_ $var_name>]($var_name, $context);
234        }
235    };
236}
237
238/// Helper macro to generate trait methods for the mutable walker.
239macro_rules! gen_mut_trait_methods {
240    // This arm matches nodes that have an arena lifetime.
241    ('arena, $node_type:ty, $var_name:ident, $walker:ident, $context:ident, $ast:lifetime, $arena:lifetime, $code:block) => {
242        paste::paste! {
243            #[inline]
244            fn [<walk_in_ $var_name>](&mut self, $var_name: & $ast $node_type<$arena>, context: &mut C) {}
245            #[inline]
246            fn [<walk_ $var_name>](&mut self, $var_name: & $ast $node_type<$arena>, $context: &mut C) {
247                let $walker = self;
248                define_walk_body!($walker, $context, $var_name, $code);
249            }
250            #[inline]
251            fn [<walk_out_ $var_name>](&mut self, $var_name: & $ast $node_type<$arena>, context: &mut C) {}
252        }
253    };
254    // This arm matches simple/copy nodes that DO NOT have an arena lifetime.
255    (_, $node_type:ty, $var_name:ident, $walker:ident, $context:ident, $ast:lifetime, $arena:lifetime, $code:block) => {
256        paste::paste! {
257            #[inline]
258            fn [<walk_in_ $var_name>](&mut self, $var_name: & $ast $node_type, context: &mut C) {}
259            #[inline]
260            fn [<walk_ $var_name>](&mut self, $var_name: & $ast $node_type, $context: &mut C) {
261                let $walker = self;
262                define_walk_body!($walker, $context, $var_name, $code);
263            }
264            #[inline]
265            fn [<walk_out_ $var_name>](&mut self, $var_name: & $ast $node_type, context: &mut C) {}
266        }
267    };
268}
269
270/// Helper macro to generate trait methods for the immutable walker.
271macro_rules! gen_const_trait_methods {
272    // This arm matches nodes that have an arena lifetime.
273    ('arena, $node_type:ty, $var_name:ident, $walker:ident, $context:ident, $ast:lifetime, $arena:lifetime, $code:block) => {
274        paste::paste! {
275            #[inline]
276            fn [<walk_in_ $var_name>](&self, $var_name: & $ast $node_type<$arena>, context: &mut C) {}
277            #[inline]
278            fn [<walk_ $var_name>](&self, $var_name: & $ast $node_type<$arena>, $context: &mut C) {
279                let $walker = self;
280                define_walk_body!($walker, $context, $var_name, $code);
281            }
282            #[inline]
283            fn [<walk_out_ $var_name>](&self, $var_name: & $ast $node_type<$arena>, context: &mut C) {}
284        }
285    };
286    // This arm matches simple/copy nodes that DO NOT have an arena lifetime.
287    (_, $node_type:ty, $var_name:ident, $walker:ident, $context:ident, $ast:lifetime, $arena:lifetime, $code:block) => {
288        paste::paste! {
289            #[inline]
290            fn [<walk_in_ $var_name>](&self, $var_name: & $ast $node_type, context: &mut C) {}
291            #[inline]
292            fn [<walk_ $var_name>](&self, $var_name: & $ast $node_type, $context: &mut C) {
293                let $walker = self;
294                define_walk_body!($walker, $context, $var_name, $code);
295            }
296            #[inline]
297            fn [<walk_out_ $var_name>](&self, $var_name: & $ast $node_type, context: &mut C) {}
298        }
299    };
300}
301
302/// Helper macro to generate standalone walk functions.
303macro_rules! gen_standalone_funcs {
304    // This arm matches nodes that have an arena lifetime.
305    ('arena, $node_type:ty, $var_name:ident, $walker:ident, $context:ident, $ast:lifetime, $arena:lifetime, $code:block) => {
306        paste::paste! {
307            #[inline]
308            pub fn [<walk_ $var_name _mut>]<$ast, $arena, W, C>($walker: &mut W, $var_name: & $ast $node_type<$arena>, $context: &mut C)
309                where W: ?Sized + MutWalker<$ast, $arena, C>
310            {
311                define_walk_body!($walker, $context, $var_name, $code);
312            }
313
314            #[inline]
315            pub fn [<walk_ $var_name>]<$ast, $arena, W, C>($walker: &W, $var_name: & $ast $node_type<$arena>, $context: &mut C)
316                where W: ?Sized + Walker<$ast, $arena, C>
317            {
318                define_walk_body!($walker, $context, $var_name, $code);
319            }
320        }
321    };
322    // This arm matches simple/copy nodes that DO NOT have an arena lifetime.
323    (_, $node_type:ty, $var_name:ident, $walker:ident, $context:ident, $ast:lifetime, $arena:lifetime, $code:block) => {
324        paste::paste! {
325            #[inline]
326            pub fn [<walk_ $var_name _mut>]<$ast, $arena, W, C>($walker: &mut W, $var_name: & $ast $node_type, $context: &mut C)
327                where W: ?Sized + MutWalker<$ast, $arena, C>
328            {
329                define_walk_body!($walker, $context, $var_name, $code);
330            }
331
332            #[inline]
333            pub fn [<walk_ $var_name>]<$ast, $arena, W, C>($walker: &W, $var_name: & $ast $node_type, $context: &mut C)
334                where W: ?Sized + Walker<$ast, $arena, C>
335            {
336                define_walk_body!($walker, $context, $var_name, $code);
337            }
338        }
339    };
340}
341
342/// Macro for generating a walker trait and associated functions for traversing an AST.
343macro_rules! generate_ast_walker {
344    (
345        using($walker:ident, $context:ident, $ast:lifetime, $arena:lifetime):
346        $(
347            $prefix:tt $node_type:ty as $var_name:ident => $code:block
348        )*
349    ) => {
350        /// A trait that defines a mutable walker to traverse AST nodes.
351        pub trait MutWalker<$ast, $arena, C>: Sync + Send {
352            $(
353                gen_mut_trait_methods!($prefix, $node_type, $var_name, $walker, $context, $ast, $arena, $code);
354            )*
355        }
356
357        /// A trait that defines an immutable walker to traverse AST nodes.
358        pub trait Walker<$ast, $arena, C>: Sync + Send {
359            $(
360                gen_const_trait_methods!($prefix, $node_type, $var_name, $walker, $context, $ast, $arena, $code);
361            )*
362        }
363
364        $(
365            gen_standalone_funcs!($prefix, $node_type, $var_name, $walker, $context, $ast, $arena, $code);
366        )*
367    }
368}
369
370generate_ast_walker! {
371    using(walker, context, 'ast, 'arena):
372
373    'arena Program as program => {
374        for statement in &program.statements {
375            walker.walk_statement(statement, context);
376        }
377    }
378
379    'arena Statement as statement => {
380        match &statement {
381            Statement::OpeningTag(opening_tag) => walker.walk_opening_tag(opening_tag, context),
382            Statement::ClosingTag(closing_tag) => walker.walk_closing_tag(closing_tag, context),
383            Statement::Inline(inline) => walker.walk_inline(inline, context),
384            Statement::Namespace(namespace) => walker.walk_namespace(namespace, context),
385            Statement::Use(r#use) => walker.walk_use(r#use, context),
386            Statement::Class(class) => walker.walk_class(class, context),
387            Statement::Interface(interface) => walker.walk_interface(interface, context),
388            Statement::Trait(r#trait) => walker.walk_trait(r#trait, context),
389            Statement::Enum(r#enum) => walker.walk_enum(r#enum, context),
390            Statement::Block(block) => walker.walk_block(block, context),
391            Statement::Constant(constant) => walker.walk_constant(constant, context),
392            Statement::Function(function) => walker.walk_function(function, context),
393            Statement::Declare(declare) => walker.walk_declare(declare, context),
394            Statement::Goto(goto) => walker.walk_goto(goto, context),
395            Statement::Label(label) => walker.walk_label(label, context),
396            Statement::Try(r#try) => walker.walk_try(r#try, context),
397            Statement::Foreach(foreach) => walker.walk_foreach(foreach, context),
398            Statement::For(r#for) => walker.walk_for(r#for, context),
399            Statement::While(r#while) => walker.walk_while(r#while, context),
400            Statement::DoWhile(do_while) => walker.walk_do_while(do_while, context),
401            Statement::Continue(r#continue) => walker.walk_continue(r#continue, context),
402            Statement::Break(r#break) => walker.walk_break(r#break, context),
403            Statement::Switch(switch) => walker.walk_switch(switch, context),
404            Statement::If(r#if) => walker.walk_if(r#if, context),
405            Statement::Return(r#return) => walker.walk_return(r#return, context),
406            Statement::Expression(expression) => walker.walk_statement_expression(expression, context),
407            Statement::EchoTag(echo) => walker.walk_echo_tag(echo, context),
408            Statement::Echo(echo) => walker.walk_echo(echo, context),
409            Statement::Global(global) => walker.walk_global(global, context),
410            Statement::Static(r#static) => walker.walk_static(r#static, context),
411            Statement::HaltCompiler(halt_compiler) => walker.walk_halt_compiler(halt_compiler, context),
412            Statement::Unset(unset) => walker.walk_unset(unset, context),
413            Statement::Noop(_) => {
414                // Do nothing by default
415            },
416        }
417    }
418
419    'arena OpeningTag as opening_tag => {
420        match opening_tag {
421            OpeningTag::Full(full_opening_tag) => walker.walk_full_opening_tag(full_opening_tag, context),
422            OpeningTag::Short(short_opening_tag) => walker.walk_short_opening_tag(short_opening_tag, context),
423        }
424    }
425
426    'arena FullOpeningTag as full_opening_tag => {
427        // Do nothing by default
428    }
429
430    _ ShortOpeningTag as short_opening_tag => {
431        // Do nothing by default
432    }
433
434    _ ClosingTag as closing_tag => {
435        // Do nothing by default
436    }
437
438    'arena Inline as inline => {
439        // Do nothing by default
440    }
441
442    'arena Namespace as namespace => {
443        walker.walk_keyword(&namespace.namespace, context);
444        if let Some(name) = &namespace.name {
445            walker.walk_identifier(name, context);
446        }
447
448        walker.walk_namespace_body(&namespace.body, context);
449    }
450
451    'arena NamespaceBody as namespace_body => {
452        match namespace_body {
453            NamespaceBody::Implicit(namespace_implicit_body) => walker.walk_namespace_implicit_body(namespace_implicit_body, context),
454            NamespaceBody::BraceDelimited(block) => walker.walk_block(block, context),
455        }
456    }
457
458    'arena NamespaceImplicitBody as namespace_implicit_body => {
459        walker.walk_terminator(&namespace_implicit_body.terminator, context);
460
461        for statement in &namespace_implicit_body.statements {
462            walker.walk_statement(statement, context);
463        }
464    }
465
466    'arena Terminator as terminator => {
467        match terminator {
468            Terminator::Semicolon(_) => {
469                // Do nothing by default
470            }
471            Terminator::ClosingTag(closing_tag) => {
472                walker.walk_closing_tag(closing_tag, context);
473            }
474            Terminator::TagPair(closing_tag, opening_tag) => {
475                walker.walk_closing_tag(closing_tag, context);
476                walker.walk_opening_tag(opening_tag, context);
477            }
478            Terminator::Missing(_) => {
479                // Do nothing by default
480            }
481        }
482    }
483
484    'arena Use as r#use => {
485        walker.walk_keyword(&r#use.r#use, context);
486
487        walker.walk_use_items(&r#use.items, context);
488
489        walker.walk_terminator(&r#use.terminator, context);
490    }
491
492    'arena UseItems as use_items => {
493        match use_items {
494            UseItems::Sequence(use_item_sequence) => {
495                walker.walk_use_item_sequence(use_item_sequence, context);
496            }
497            UseItems::TypedSequence(typed_use_item_sequence) => {
498                walker.walk_typed_use_item_sequence(typed_use_item_sequence, context);
499            }
500            UseItems::TypedList(typed_use_item_list) => {
501                walker.walk_typed_use_item_list(typed_use_item_list, context);
502            }
503            UseItems::MixedList(mixed_use_item_list) => {
504                walker.walk_mixed_use_item_list(mixed_use_item_list, context);
505            }
506        }
507    }
508
509    'arena UseItemSequence as use_item_sequence => {
510        for use_item in &use_item_sequence.items {
511            walker.walk_use_item(use_item, context);
512        }
513    }
514
515    'arena UseItem as use_item => {
516        walker.walk_identifier(&use_item.name, context);
517
518        if let Some(alias) = &use_item.alias {
519            walker.walk_use_item_alias(alias, context);
520        }
521    }
522
523    'arena UseItemAlias as use_item_alias => {
524        walker.walk_keyword(&use_item_alias.r#as, context);
525        walker.walk_local_identifier(&use_item_alias.identifier, context);
526    }
527
528    'arena TypedUseItemSequence as typed_use_item_sequence => {
529        walker.walk_use_type(&typed_use_item_sequence.r#type, context);
530
531        for use_item in &typed_use_item_sequence.items {
532            walker.walk_use_item(use_item, context);
533        }
534    }
535
536    'arena UseType as use_type => {
537        match &use_type {
538            UseType::Function(keyword) => walker.walk_keyword(keyword, context),
539            UseType::Const(keyword) => walker.walk_keyword(keyword, context),
540        }
541    }
542
543    'arena TypedUseItemList as typed_use_item_list => {
544        walker.walk_use_type(&typed_use_item_list.r#type, context);
545        walker.walk_identifier(&typed_use_item_list.namespace, context);
546
547        for use_item in &typed_use_item_list.items {
548            walker.walk_use_item(use_item, context);
549        }
550    }
551
552    'arena MixedUseItemList as mixed_use_item_list => {
553        walker.walk_identifier(&mixed_use_item_list.namespace, context);
554
555        for maybe_typed_use_item in &mixed_use_item_list.items {
556            walker.walk_maybe_typed_use_item(maybe_typed_use_item, context);
557        }
558    }
559
560    'arena MaybeTypedUseItem as maybe_typed_use_item => {
561        if let Some(use_type) = &maybe_typed_use_item.r#type {
562            walker.walk_use_type(use_type, context);
563        }
564
565        walker.walk_use_item(&maybe_typed_use_item.item, context);
566    }
567
568    'arena AttributeList as attribute_list => {
569        for attribute in &attribute_list.attributes {
570            walker.walk_attribute(attribute, context);
571        }
572    }
573
574    'arena Attribute as attribute => {
575        walker.walk_identifier(&attribute.name, context);
576
577        if let Some(argument_list) = &attribute.argument_list {
578            walker.walk_argument_list(argument_list, context);
579        }
580    }
581
582    'arena ArgumentList as argument_list => {
583        for argument in &argument_list.arguments {
584            walker.walk_argument(argument, context);
585        }
586    }
587
588    'arena PartialArgumentList as partial_argument_list => {
589        for partial_argument in &partial_argument_list.arguments {
590            walker.walk_partial_argument(partial_argument, context);
591        }
592    }
593
594    'arena Argument as argument => {
595        match &argument {
596            Argument::Positional(positional_argument) => {
597                walker.walk_positional_argument(positional_argument, context);
598            }
599            Argument::Named(named_argument) => {
600                walker.walk_named_argument(named_argument, context);
601            }
602        }
603    }
604
605    'arena PartialArgument as partial_argument => {
606        match &partial_argument {
607            PartialArgument::Positional(positional_argument) => {
608                walker.walk_positional_argument(positional_argument, context);
609            }
610            PartialArgument::Named(named_argument) => {
611                walker.walk_named_argument(named_argument, context);
612            }
613            PartialArgument::NamedPlaceholder(named_placeholder_argument) => {
614                walker.walk_named_placeholder_argument(named_placeholder_argument, context);
615            }
616            PartialArgument::Placeholder(placeholder_argument) => {
617                walker.walk_placeholder_argument(placeholder_argument, context);
618            }
619            PartialArgument::VariadicPlaceholder(variadic_placeholder_argument) => {
620                walker.walk_variadic_placeholder_argument(variadic_placeholder_argument, context);
621            }
622        }
623    }
624
625    'arena PositionalArgument as positional_argument => {
626        walker.walk_expression(positional_argument.value, context);
627    }
628
629    'arena NamedArgument as named_argument => {
630        walker.walk_local_identifier(&named_argument.name, context);
631        walker.walk_expression(named_argument.value, context);
632    }
633
634    _ PlaceholderArgument as placeholder_argument => {
635        // Do nothing by default
636    }
637
638    'arena NamedPlaceholderArgument as named_placeholder_argument => {
639        walker.walk_local_identifier(&named_placeholder_argument.name, context);
640    }
641
642    _ VariadicPlaceholderArgument as variadic_placeholder_argument => {
643        // Do nothing by default
644    }
645
646    'arena Modifier as modifier => {
647        walker.walk_keyword(modifier.get_keyword(), context);
648    }
649
650    'arena Extends as extends => {
651        walker.walk_keyword(&extends.extends, context);
652
653        for ty in &extends.types {
654            walker.walk_identifier(ty, context);
655        }
656    }
657
658    'arena Implements as implements => {
659        walker.walk_keyword(&implements.implements, context);
660
661        for ty in &implements.types {
662            walker.walk_identifier(ty, context);
663        }
664    }
665
666    'arena Class as class => {
667        for attribute_list in &class.attribute_lists {
668            walker.walk_attribute_list(attribute_list, context);
669        }
670
671        for modifier in &class.modifiers {
672            walker.walk_modifier(modifier, context);
673        }
674
675        walker.walk_keyword(&class.class, context);
676        walker.walk_local_identifier(&class.name, context);
677        if let Some(extends) = &class.extends {
678            walker.walk_extends(extends, context);
679        }
680
681        if let Some(implements) = &class.implements {
682            walker.walk_implements(implements, context);
683        }
684
685        for class_member in &class.members {
686            walker.walk_class_like_member(class_member, context);
687        }
688    }
689
690    'arena Interface as interface => {
691        for attribute_list in &interface.attribute_lists {
692            walker.walk_attribute_list(attribute_list, context);
693        }
694
695        walker.walk_keyword(&interface.interface, context);
696        walker.walk_local_identifier(&interface.name, context);
697
698        if let Some(extends) = &interface.extends {
699            walker.walk_extends(extends, context);
700        }
701
702        for class_member in &interface.members {
703            walker.walk_class_like_member(class_member, context);
704        }
705    }
706
707    'arena Trait as r#trait => {
708        for attribute_list in &r#trait.attribute_lists {
709            walker.walk_attribute_list(attribute_list, context);
710        }
711
712        walker.walk_keyword(&r#trait.r#trait, context);
713        walker.walk_local_identifier(&r#trait.name, context);
714
715        for class_member in &r#trait.members {
716            walker.walk_class_like_member(class_member, context);
717        }
718    }
719
720    'arena Enum as r#enum => {
721        for attribute_list in &r#enum.attribute_lists {
722            walker.walk_attribute_list(attribute_list, context);
723        }
724
725        walker.walk_keyword(&r#enum.r#enum, context);
726        walker.walk_local_identifier(&r#enum.name, context);
727
728        if let Some(backing_type_hint) = &r#enum.backing_type_hint {
729            walker.walk_enum_backing_type_hint(backing_type_hint, context);
730        }
731
732        if let Some(implements) = &r#enum.implements {
733            walker.walk_implements(implements, context);
734        }
735
736        for class_member in &r#enum.members {
737            walker.walk_class_like_member(class_member, context);
738        }
739    }
740
741    'arena EnumBackingTypeHint as enum_backing_type_hint => {
742        walker.walk_hint(&enum_backing_type_hint.hint, context);
743    }
744
745    'arena ClassLikeMember as class_like_member => {
746        match class_like_member {
747            ClassLikeMember::TraitUse(trait_use) => {
748                walker.walk_trait_use(trait_use, context);
749            }
750            ClassLikeMember::Constant(class_like_constant) => {
751                walker.walk_class_like_constant(class_like_constant, context);
752            }
753            ClassLikeMember::Property(property) => {
754                walker.walk_property(property, context);
755            }
756            ClassLikeMember::EnumCase(enum_case) => {
757                walker.walk_enum_case(enum_case, context);
758            }
759            ClassLikeMember::Method(method) => {
760                walker.walk_method(method, context);
761            }
762        }
763    }
764
765    'arena TraitUse as trait_use => {
766        walker.walk_keyword(&trait_use.r#use, context);
767
768        for trait_name in &trait_use.trait_names {
769            walker.walk_identifier(trait_name, context);
770        }
771
772        walker.walk_trait_use_specification(&trait_use.specification, context);
773    }
774
775    'arena TraitUseSpecification as trait_use_specification => {
776        match trait_use_specification {
777            TraitUseSpecification::Abstract(trait_use_abstract_specification) => {
778                walker.walk_trait_use_abstract_specification(trait_use_abstract_specification, context);
779            }
780            TraitUseSpecification::Concrete(trait_use_concrete_specification) => {
781                walker.walk_trait_use_concrete_specification(trait_use_concrete_specification, context);
782            }
783        }
784    }
785
786    'arena TraitUseAbstractSpecification as trait_use_abstract_specification => {
787        walker.walk_terminator(&trait_use_abstract_specification.0, context);
788    }
789
790    'arena TraitUseConcreteSpecification as trait_use_concrete_specification => {
791        for adaptation in &trait_use_concrete_specification.adaptations {
792            walker.walk_trait_use_adaptation(
793                adaptation,
794
795                context,
796            );
797        }
798    }
799
800    'arena TraitUseAdaptation as trait_use_adaptation => {
801        match trait_use_adaptation {
802            TraitUseAdaptation::Precedence(trait_use_precedence_adaptation) => {
803                walker.walk_trait_use_precedence_adaptation(trait_use_precedence_adaptation, context);
804            },
805            TraitUseAdaptation::Alias(trait_use_alias_adaptation) => {
806                walker.walk_trait_use_alias_adaptation(trait_use_alias_adaptation, context);
807            },
808        }
809    }
810
811    'arena TraitUsePrecedenceAdaptation as trait_use_precedence_adaptation => {
812        walker.walk_trait_use_absolute_method_reference(
813            &trait_use_precedence_adaptation.method_reference,
814
815            context,
816        );
817
818        walker.walk_keyword(&trait_use_precedence_adaptation.insteadof, context);
819
820        for trait_name in &trait_use_precedence_adaptation.trait_names {
821            walker.walk_identifier(trait_name, context);
822        }
823
824        walker.walk_terminator(&trait_use_precedence_adaptation.terminator, context);
825    }
826
827    'arena TraitUseAbsoluteMethodReference as trait_use_absolute_method_reference => {
828        walker.walk_identifier(&trait_use_absolute_method_reference.trait_name, context);
829        walker.walk_local_identifier(&trait_use_absolute_method_reference.method_name, context);
830    }
831
832    'arena TraitUseAliasAdaptation as trait_use_alias_adaptation => {
833        walker.walk_trait_use_method_reference(
834            &trait_use_alias_adaptation.method_reference,
835
836            context,
837        );
838
839        walker.walk_keyword(&trait_use_alias_adaptation.r#as, context);
840
841        if let Some(modifier) = &trait_use_alias_adaptation.visibility {
842            walker.walk_modifier(modifier, context);
843        }
844
845        if let Some(alias) = &trait_use_alias_adaptation.alias {
846            walker.walk_local_identifier(alias, context);
847        }
848
849        walker.walk_terminator(&trait_use_alias_adaptation.terminator, context);
850    }
851
852    'arena TraitUseMethodReference as trait_use_method_reference => {
853        match trait_use_method_reference {
854            TraitUseMethodReference::Identifier(local_identifier) => {
855                walker.walk_local_identifier(local_identifier, context);
856            },
857            TraitUseMethodReference::Absolute(absolute) => {
858                walker.walk_trait_use_absolute_method_reference(absolute, context);
859            },
860        }
861    }
862
863    'arena ClassLikeConstant as class_like_constant => {
864        for attribute_list in &class_like_constant.attribute_lists {
865            walker.walk_attribute_list(attribute_list, context);
866        }
867
868        for modifier in &class_like_constant.modifiers {
869            walker.walk_modifier(modifier, context);
870        }
871
872        walker.walk_keyword(&class_like_constant.r#const, context);
873
874        if let Some(hint) = &class_like_constant.hint {
875            walker.walk_hint(hint, context);
876        }
877
878        for item in &class_like_constant.items {
879            walker.walk_class_like_constant_item(item, context);
880        }
881
882        walker.walk_terminator(&class_like_constant.terminator, context);
883    }
884
885    'arena ClassLikeConstantItem as class_like_constant_item => {
886        walker.walk_local_identifier(&class_like_constant_item.name, context);
887        walker.walk_expression(class_like_constant_item.value, context);
888    }
889
890    'arena Property as property => {
891        match property {
892            Property::Plain(plain_property) => {
893                walker.walk_plain_property(plain_property, context);
894            }
895            Property::Hooked(hooked_property) => {
896                walker.walk_hooked_property(hooked_property, context);
897            }
898        }
899    }
900
901    'arena PlainProperty as plain_property => {
902        for attribute_list in &plain_property.attribute_lists {
903            walker.walk_attribute_list(attribute_list, context);
904        }
905
906        for modifier in &plain_property.modifiers {
907            walker.walk_modifier(modifier, context);
908        }
909
910        if let Some(var) = &plain_property.var {
911            walker.walk_keyword(var, context);
912        }
913
914        if let Some(hint) = &plain_property.hint {
915            walker.walk_hint(hint, context);
916        }
917
918        for item in &plain_property.items {
919            walker.walk_property_item(item, context);
920        }
921
922        walker.walk_terminator(&plain_property.terminator, context);
923    }
924
925    'arena PropertyItem as property_item => {
926        match property_item {
927            PropertyItem::Abstract(property_abstract_item) => {
928                walker.walk_property_abstract_item(property_abstract_item, context);
929            }
930            PropertyItem::Concrete(property_concrete_item) => {
931                walker.walk_property_concrete_item(property_concrete_item, context);
932            }
933        }
934    }
935
936    'arena PropertyAbstractItem as property_abstract_item => {
937        walker.walk_direct_variable(&property_abstract_item.variable, context);
938    }
939
940    'arena PropertyConcreteItem as property_concrete_item => {
941        walker.walk_direct_variable(&property_concrete_item.variable, context);
942        walker.walk_expression(property_concrete_item.value, context);
943    }
944
945    'arena HookedProperty as hooked_property => {
946        for attribute_list in &hooked_property.attribute_lists {
947            walker.walk_attribute_list(attribute_list, context);
948        }
949
950        for modifier in &hooked_property.modifiers {
951            walker.walk_modifier(modifier, context);
952        }
953
954        if let Some(var) = &hooked_property.var {
955            walker.walk_keyword(var, context);
956        }
957
958        if let Some(hint) = &hooked_property.hint {
959            walker.walk_hint(hint, context);
960        }
961
962        walker.walk_property_item(&hooked_property.item, context);
963        walker.walk_property_hook_list(&hooked_property.hook_list, context);
964    }
965
966    'arena PropertyHookList as property_hook_list => {
967        for hook in &property_hook_list.hooks {
968            walker.walk_property_hook(hook, context);
969        }
970    }
971
972    'arena PropertyHook as property_hook => {
973        for attribute_list in &property_hook.attribute_lists {
974            walker.walk_attribute_list(attribute_list, context);
975        }
976
977        for modifier in &property_hook.modifiers {
978            walker.walk_modifier(modifier, context);
979        }
980
981        walker.walk_local_identifier(&property_hook.name, context);
982        if let Some(parameter_list) = &property_hook.parameter_list {
983            walker.walk_function_like_parameter_list(parameter_list, context);
984        }
985
986        walker.walk_property_hook_body(&property_hook.body, context);
987    }
988
989    'arena PropertyHookBody as property_hook_body => {
990        match property_hook_body {
991            PropertyHookBody::Abstract(property_hook_abstract_body) => {
992                walker.walk_property_hook_abstract_body(property_hook_abstract_body, context);
993            }
994            PropertyHookBody::Concrete(property_hook_concrete_body) => {
995                walker.walk_property_hook_concrete_body(property_hook_concrete_body, context);
996            }
997        }
998    }
999
1000    _ PropertyHookAbstractBody as property_hook_abstract_body => {
1001        // Do nothing by default
1002    }
1003
1004    'arena PropertyHookConcreteBody as property_hook_concrete_body => {
1005        match property_hook_concrete_body {
1006            PropertyHookConcreteBody::Block(block) => {
1007                walker.walk_block(block, context);
1008            }
1009            PropertyHookConcreteBody::Expression(property_hook_concrete_expression_body) => {
1010                walker.walk_property_hook_concrete_expression_body(property_hook_concrete_expression_body, context);
1011            }
1012        }
1013    }
1014
1015    'arena PropertyHookConcreteExpressionBody as property_hook_concrete_expression_body => {
1016        walker.walk_expression(property_hook_concrete_expression_body.expression, context);
1017    }
1018
1019    'arena FunctionLikeParameterList as function_like_parameter_list => {
1020        for parameter in &function_like_parameter_list.parameters {
1021            walker.walk_function_like_parameter(parameter, context);
1022        }
1023    }
1024
1025    'arena FunctionLikeParameter as function_like_parameter => {
1026        for attribute_list in &function_like_parameter.attribute_lists {
1027            walker.walk_attribute_list(attribute_list, context);
1028        }
1029
1030        for modifier in &function_like_parameter.modifiers {
1031            walker.walk_modifier(modifier, context);
1032        }
1033
1034        if let Some(hint) = &function_like_parameter.hint {
1035            walker.walk_hint(hint, context);
1036        }
1037
1038        walker.walk_direct_variable(&function_like_parameter.variable, context);
1039        if let Some(default_value) = &function_like_parameter.default_value {
1040            walker.walk_function_like_parameter_default_value(default_value, context);
1041        }
1042
1043        if let Some(hooks) = &function_like_parameter.hooks {
1044            walker.walk_property_hook_list(hooks, context);
1045        }
1046    }
1047
1048    'arena FunctionLikeParameterDefaultValue as function_like_parameter_default_value => {
1049        walker.walk_expression(function_like_parameter_default_value.value, context);
1050    }
1051
1052    'arena EnumCase as enum_case => {
1053        for attribute_list in &enum_case.attribute_lists {
1054            walker.walk_attribute_list(attribute_list, context);
1055        }
1056
1057        walker.walk_keyword(&enum_case.case, context);
1058        walker.walk_enum_case_item(&enum_case.item, context);
1059        walker.walk_terminator(&enum_case.terminator, context);
1060    }
1061
1062    'arena EnumCaseItem as enum_case_item => {
1063        match enum_case_item {
1064            EnumCaseItem::Unit(enum_case_unit_item) => {
1065                walker.walk_enum_case_unit_item(enum_case_unit_item, context);
1066            }
1067            EnumCaseItem::Backed(enum_case_backed_item) => {
1068                walker.walk_enum_case_backed_item(enum_case_backed_item, context);
1069            }
1070        }
1071    }
1072
1073    'arena EnumCaseUnitItem as enum_case_unit_item => {
1074        walker.walk_local_identifier(&enum_case_unit_item.name, context);
1075    }
1076
1077    'arena EnumCaseBackedItem as enum_case_backed_item => {
1078        walker.walk_local_identifier(&enum_case_backed_item.name, context);
1079        walker.walk_expression(enum_case_backed_item.value, context);
1080    }
1081
1082    'arena Method as method => {
1083        for attribute_list in &method.attribute_lists {
1084            walker.walk_attribute_list(attribute_list, context);
1085        }
1086
1087        for modifier in &method.modifiers {
1088            walker.walk_modifier(modifier, context);
1089        }
1090
1091        walker.walk_keyword(&method.function, context);
1092        walker.walk_local_identifier(&method.name, context);
1093        walker.walk_function_like_parameter_list(&method.parameter_list, context);
1094        if let Some(hint) = &method.return_type_hint {
1095            walker.walk_function_like_return_type_hint(hint, context);
1096        }
1097
1098        walker.walk_method_body(&method.body, context);
1099    }
1100
1101    'arena MethodBody as method_body => {
1102        match method_body {
1103            MethodBody::Abstract(method_abstract_body) => {
1104                walker.walk_method_abstract_body(method_abstract_body, context);
1105            }
1106            MethodBody::Concrete(method_concrete_body) => {
1107                walker.walk_block(method_concrete_body, context);
1108            }
1109        }
1110    }
1111
1112    _ MethodAbstractBody as method_abstract_body => {
1113        // Do nothing by default
1114    }
1115
1116    'arena FunctionLikeReturnTypeHint as function_like_return_type_hint => {
1117        walker.walk_hint(&function_like_return_type_hint.hint, context);
1118    }
1119
1120    'arena Block as block => {
1121        for statement in &block.statements {
1122            walker.walk_statement(statement, context);
1123        }
1124    }
1125
1126    'arena Constant as constant => {
1127        for attribute_list in &constant.attribute_lists {
1128            walker.walk_attribute_list(attribute_list, context);
1129        }
1130
1131        walker.walk_keyword(&constant.r#const, context);
1132        for item in &constant.items {
1133            walker.walk_constant_item(item, context);
1134        }
1135
1136        walker.walk_terminator(&constant.terminator, context);
1137    }
1138
1139    'arena ConstantItem as constant_item => {
1140        walker.walk_local_identifier(&constant_item.name, context);
1141        walker.walk_expression(constant_item.value, context);
1142    }
1143
1144    'arena Function as function => {
1145        for attribute_list in &function.attribute_lists {
1146            walker.walk_attribute_list(attribute_list, context);
1147        }
1148
1149        walker.walk_keyword(&function.function, context);
1150        walker.walk_local_identifier(&function.name, context);
1151        walker.walk_function_like_parameter_list(&function.parameter_list, context);
1152        if let Some(hint) = &function.return_type_hint {
1153            walker.walk_function_like_return_type_hint(hint, context);
1154        }
1155
1156        walker.walk_block(&function.body, context);
1157    }
1158
1159    'arena Declare as declare => {
1160        walker.walk_keyword(&declare.declare, context);
1161        for item in &declare.items {
1162            walker.walk_declare_item(item, context);
1163        }
1164
1165        walker.walk_declare_body(&declare.body, context);
1166    }
1167
1168    'arena DeclareItem as declare_item => {
1169        walker.walk_local_identifier(&declare_item.name, context);
1170        walker.walk_expression(declare_item.value, context);
1171    }
1172
1173    'arena DeclareBody as declare_body => {
1174        match declare_body {
1175            DeclareBody::Statement(statement) => {
1176                walker.walk_statement(statement, context);
1177            }
1178            DeclareBody::ColonDelimited(declare_colon_delimited_body) => {
1179                walker.walk_declare_colon_delimited_body(declare_colon_delimited_body, context);
1180            }
1181        }
1182    }
1183
1184    'arena DeclareColonDelimitedBody as declare_colon_delimited_body => {
1185        for statement in &declare_colon_delimited_body.statements {
1186            walker.walk_statement(statement, context);
1187        }
1188
1189        walker.walk_terminator(&declare_colon_delimited_body.terminator, context);
1190    }
1191
1192    'arena Goto as goto => {
1193        walker.walk_keyword(&goto.goto, context);
1194        walker.walk_local_identifier(&goto.label, context);
1195        walker.walk_terminator(&goto.terminator, context);
1196    }
1197
1198    'arena Label as label => {
1199        walker.walk_local_identifier(&label.name, context);
1200    }
1201
1202    'arena Try as r#try => {
1203        walker.walk_keyword(&r#try.r#try, context);
1204        walker.walk_block(&r#try.block, context);
1205        for catch in &r#try.catch_clauses {
1206            walker.walk_try_catch_clause(catch, context);
1207        }
1208
1209        if let Some(finally) = &r#try.finally_clause {
1210            walker.walk_try_finally_clause(finally, context);
1211        }
1212    }
1213
1214    'arena TryCatchClause as try_catch_clause => {
1215        walker.walk_keyword(&try_catch_clause.catch, context);
1216        walker.walk_hint(&try_catch_clause.hint, context);
1217        if let Some(variable) = &try_catch_clause.variable {
1218            walker.walk_direct_variable(variable, context);
1219        }
1220
1221        walker.walk_block(&try_catch_clause.block, context);
1222    }
1223
1224    'arena TryFinallyClause as try_finally_clause => {
1225        walker.walk_keyword(&try_finally_clause.finally, context);
1226        walker.walk_block(&try_finally_clause.block, context);
1227    }
1228
1229    'arena Foreach as foreach => {
1230        walker.walk_keyword(&foreach.foreach, context);
1231        walker.walk_expression(foreach.expression, context);
1232        walker.walk_keyword(&foreach.r#as, context);
1233        walker.walk_foreach_target(&foreach.target, context);
1234        walker.walk_foreach_body(&foreach.body, context);
1235    }
1236
1237    'arena ForeachTarget as foreach_target => {
1238        match foreach_target {
1239            ForeachTarget::Value(foreach_value_target) => {
1240                walker.walk_foreach_value_target(foreach_value_target, context);
1241            }
1242            ForeachTarget::KeyValue(foreach_key_value_target) => {
1243                walker.walk_foreach_key_value_target(foreach_key_value_target, context);
1244            }
1245        }
1246    }
1247
1248    'arena ForeachValueTarget as foreach_value_target => {
1249        walker.walk_expression(foreach_value_target.value, context);
1250    }
1251
1252    'arena ForeachKeyValueTarget as foreach_key_value_target => {
1253        walker.walk_expression(foreach_key_value_target.key, context);
1254        walker.walk_expression(foreach_key_value_target.value, context);
1255    }
1256
1257    'arena ForeachBody as foreach_body => {
1258        match foreach_body {
1259            ForeachBody::Statement(statement) => {
1260                walker.walk_statement(statement, context);
1261            }
1262            ForeachBody::ColonDelimited(foreach_colon_delimited_body) => {
1263                walker.walk_foreach_colon_delimited_body(foreach_colon_delimited_body, context);
1264            }
1265        }
1266    }
1267
1268    'arena ForeachColonDelimitedBody as foreach_colon_delimited_body => {
1269        for statement in &foreach_colon_delimited_body.statements {
1270            walker.walk_statement(statement, context);
1271        }
1272
1273        walker.walk_keyword(&foreach_colon_delimited_body.end_foreach, context);
1274        walker.walk_terminator(&foreach_colon_delimited_body.terminator, context);
1275    }
1276
1277    'arena For as r#for => {
1278        walker.walk_keyword(&r#for.r#for, context);
1279
1280        for initialization in &r#for.initializations {
1281            walker.walk_expression(initialization, context);
1282        }
1283
1284        for condition in &r#for.conditions {
1285            walker.walk_expression(condition, context);
1286        }
1287
1288        for increment in &r#for.increments {
1289            walker.walk_expression(increment, context);
1290        }
1291
1292        walker.walk_for_body(&r#for.body, context);
1293    }
1294
1295    'arena ForBody as for_body => {
1296        match for_body {
1297            ForBody::Statement(statement) => {
1298                walker.walk_statement(statement, context);
1299            }
1300            ForBody::ColonDelimited(for_colon_delimited_body) => {
1301                walker.walk_for_colon_delimited_body(for_colon_delimited_body, context);
1302            }
1303        }
1304    }
1305
1306    'arena ForColonDelimitedBody as for_colon_delimited_body => {
1307        for statement in &for_colon_delimited_body.statements {
1308            walker.walk_statement(statement, context);
1309        }
1310
1311        walker.walk_keyword(&for_colon_delimited_body.end_for, context);
1312        walker.walk_terminator(&for_colon_delimited_body.terminator, context);
1313    }
1314
1315    'arena While as r#while => {
1316        walker.walk_keyword(&r#while.r#while, context);
1317        walker.walk_expression(r#while.condition, context);
1318        walker.walk_while_body(&r#while.body, context);
1319    }
1320
1321    'arena WhileBody as while_body => {
1322        match while_body {
1323            WhileBody::Statement(statement) => {
1324                walker.walk_statement(statement, context);
1325            }
1326            WhileBody::ColonDelimited(while_colon_delimited_body) => {
1327                walker.walk_while_colon_delimited_body(while_colon_delimited_body, context);
1328            }
1329        }
1330    }
1331
1332    'arena WhileColonDelimitedBody as while_colon_delimited_body => {
1333        for statement in &while_colon_delimited_body.statements {
1334            walker.walk_statement(statement, context);
1335        }
1336
1337        walker.walk_keyword(&while_colon_delimited_body.end_while, context);
1338        walker.walk_terminator(&while_colon_delimited_body.terminator, context);
1339    }
1340
1341    'arena DoWhile as do_while => {
1342        walker.walk_keyword(&do_while.r#do, context);
1343        walker.walk_statement(do_while.statement, context);
1344        walker.walk_keyword(&do_while.r#while, context);
1345        walker.walk_expression(do_while.condition, context);
1346        walker.walk_terminator(&do_while.terminator, context);
1347    }
1348
1349    'arena Continue as r#continue => {
1350        walker.walk_keyword(&r#continue.r#continue, context);
1351        if let Some(level) = &r#continue.level {
1352            walker.walk_expression(level, context);
1353        }
1354
1355        walker.walk_terminator(&r#continue.terminator, context);
1356    }
1357
1358    'arena Break as r#break => {
1359        walker.walk_keyword(&r#break.r#break, context);
1360        if let Some(level) = &r#break.level {
1361            walker.walk_expression(level, context);
1362        }
1363
1364        walker.walk_terminator(&r#break.terminator, context);
1365    }
1366
1367    'arena Switch as switch => {
1368        walker.walk_keyword(&switch.r#switch, context);
1369        walker.walk_expression(switch.expression, context);
1370        walker.walk_switch_body(&switch.body, context);
1371    }
1372
1373    'arena SwitchBody as switch_body => {
1374        match switch_body {
1375            SwitchBody::BraceDelimited(switch_brace_delimited_body) => {
1376                walker.walk_switch_brace_delimited_body(switch_brace_delimited_body, context);
1377            }
1378            SwitchBody::ColonDelimited(switch_colon_delimited_body) => {
1379                walker.walk_switch_colon_delimited_body(switch_colon_delimited_body, context);
1380            }
1381        }
1382    }
1383
1384    'arena SwitchBraceDelimitedBody as switch_brace_delimited_body => {
1385        if let Some(terminator) = &switch_brace_delimited_body.optional_terminator {
1386            walker.walk_terminator(terminator, context);
1387        }
1388
1389        for case in &switch_brace_delimited_body.cases {
1390            walker.walk_switch_case(case, context);
1391        }
1392    }
1393
1394    'arena SwitchColonDelimitedBody as switch_colon_delimited_body => {
1395        if let Some(terminator) = &switch_colon_delimited_body.optional_terminator {
1396            walker.walk_terminator(terminator, context);
1397        }
1398
1399        for case in &switch_colon_delimited_body.cases {
1400            walker.walk_switch_case(case, context);
1401        }
1402
1403        walker.walk_keyword(&switch_colon_delimited_body.end_switch, context);
1404        walker.walk_terminator(&switch_colon_delimited_body.terminator, context);
1405    }
1406
1407    'arena SwitchCase as switch_case => {
1408        match switch_case {
1409            SwitchCase::Expression(switch_expression_case) => {
1410                walker.walk_switch_expression_case(switch_expression_case, context);
1411            }
1412            SwitchCase::Default(switch_default_case) => {
1413                walker.walk_switch_default_case(switch_default_case, context);
1414            }
1415        }
1416    }
1417
1418    'arena SwitchExpressionCase as switch_expression_case => {
1419        walker.walk_keyword(&switch_expression_case.r#case, context);
1420        walker.walk_expression(switch_expression_case.expression, context);
1421        walker.walk_switch_case_separator(&switch_expression_case.separator, context);
1422        for statement in &switch_expression_case.statements {
1423            walker.walk_statement(statement, context);
1424        }
1425    }
1426
1427    'arena SwitchDefaultCase as switch_default_case => {
1428        walker.walk_keyword(&switch_default_case.r#default, context);
1429        walker.walk_switch_case_separator(&switch_default_case.separator, context);
1430        for statement in &switch_default_case.statements {
1431            walker.walk_statement(statement, context);
1432        }
1433    }
1434
1435    _ SwitchCaseSeparator as switch_case_separator => {
1436        // Do nothing by default
1437    }
1438
1439    'arena If as r#if => {
1440        walker.walk_keyword(&r#if.r#if, context);
1441        walker.walk_expression(r#if.condition, context);
1442        walker.walk_if_body(&r#if.body, context);
1443    }
1444
1445    'arena IfBody as if_body => {
1446        match if_body {
1447            IfBody::Statement(statement) => {
1448                walker.walk_if_statement_body(statement, context);
1449            }
1450            IfBody::ColonDelimited(if_colon_delimited_body) => {
1451                walker.walk_if_colon_delimited_body(if_colon_delimited_body, context);
1452            }
1453        }
1454    }
1455
1456    'arena IfStatementBody as if_statement_body => {
1457        walker.walk_statement(if_statement_body.statement, context);
1458
1459        for else_if_clause in &if_statement_body.else_if_clauses {
1460            walker.walk_if_statement_body_else_if_clause(else_if_clause, context);
1461        }
1462
1463        if let Some(else_clause) = &if_statement_body.else_clause {
1464            walker.walk_if_statement_body_else_clause(else_clause, context);
1465        }
1466    }
1467
1468    'arena IfStatementBodyElseIfClause as if_statement_body_else_if_clause => {
1469        walker.walk_keyword(&if_statement_body_else_if_clause.r#elseif, context);
1470        walker.walk_expression(if_statement_body_else_if_clause.condition, context);
1471        walker.walk_statement(if_statement_body_else_if_clause.statement, context);
1472    }
1473
1474    'arena IfStatementBodyElseClause as if_statement_body_else_clause => {
1475        walker.walk_keyword(&if_statement_body_else_clause.r#else, context);
1476        walker.walk_statement(if_statement_body_else_clause.statement, context);
1477    }
1478
1479    'arena IfColonDelimitedBody as if_colon_delimited_body => {
1480        for statement in &if_colon_delimited_body.statements {
1481            walker.walk_statement(statement, context);
1482        }
1483
1484        for else_if_clause in &if_colon_delimited_body.else_if_clauses {
1485            walker.walk_if_colon_delimited_body_else_if_clause(else_if_clause, context);
1486        }
1487
1488        if let Some(else_clause) = &if_colon_delimited_body.else_clause {
1489            walker.walk_if_colon_delimited_body_else_clause(else_clause, context);
1490        }
1491
1492        walker.walk_keyword(&if_colon_delimited_body.endif, context);
1493        walker.walk_terminator(&if_colon_delimited_body.terminator, context);
1494    }
1495
1496    'arena IfColonDelimitedBodyElseIfClause as if_colon_delimited_body_else_if_clause => {
1497        walker.walk_keyword(&if_colon_delimited_body_else_if_clause.r#elseif, context);
1498        walker.walk_expression(if_colon_delimited_body_else_if_clause.condition, context);
1499        for statement in &if_colon_delimited_body_else_if_clause.statements {
1500            walker.walk_statement(statement, context);
1501        }
1502    }
1503
1504    'arena IfColonDelimitedBodyElseClause as if_colon_delimited_body_else_clause => {
1505        walker.walk_keyword(&if_colon_delimited_body_else_clause.r#else, context);
1506        for statement in &if_colon_delimited_body_else_clause.statements {
1507            walker.walk_statement(statement, context);
1508        }
1509    }
1510
1511    'arena Return as r#return => {
1512        walker.walk_keyword(&r#return.r#return, context);
1513        if let Some(expression) = &r#return.value {
1514            walker.walk_expression(expression, context);
1515        }
1516
1517        walker.walk_terminator(&r#return.terminator, context);
1518    }
1519
1520    'arena ExpressionStatement as statement_expression => {
1521        walker.walk_expression(statement_expression.expression, context);
1522        walker.walk_terminator(&statement_expression.terminator, context);
1523    }
1524
1525    'arena EchoTag as echo_tag => {
1526        for expression in &echo_tag.values {
1527            walker.walk_expression(expression, context);
1528        }
1529
1530        walker.walk_terminator(&echo_tag.terminator, context);
1531    }
1532
1533    'arena Echo as echo => {
1534        walker.walk_keyword(&echo.echo, context);
1535        for expression in &echo.values {
1536            walker.walk_expression(expression, context);
1537        }
1538
1539        walker.walk_terminator(&echo.terminator, context);
1540    }
1541
1542    'arena Global as global => {
1543        walker.walk_keyword(&global.global, context);
1544        for variable in &global.variables {
1545            walker.walk_variable(variable, context);
1546        }
1547
1548        walker.walk_terminator(&global.terminator, context);
1549    }
1550
1551    'arena Static as r#static => {
1552        walker.walk_keyword(&r#static.r#static, context);
1553        for item in &r#static.items {
1554            walker.walk_static_item(item, context);
1555        }
1556
1557        walker.walk_terminator(&r#static.terminator, context);
1558    }
1559
1560    'arena StaticItem as static_item => {
1561        match static_item {
1562            StaticItem::Abstract(static_abstract_item) => {
1563                walker.walk_static_abstract_item(static_abstract_item, context);
1564            }
1565            StaticItem::Concrete(static_concrete_item) => {
1566                walker.walk_static_concrete_item(static_concrete_item, context);
1567            }
1568        }
1569    }
1570
1571    'arena StaticAbstractItem as static_abstract_item => {
1572        walker.walk_direct_variable(&static_abstract_item.variable, context);
1573    }
1574
1575    'arena StaticConcreteItem as static_concrete_item => {
1576        walker.walk_direct_variable(&static_concrete_item.variable, context);
1577        walker.walk_expression(static_concrete_item.value, context);
1578    }
1579
1580    'arena HaltCompiler as halt_compiler => {
1581        walker.walk_keyword(&halt_compiler.halt_compiler, context);
1582    }
1583
1584    'arena Unset as unset => {
1585        walker.walk_keyword(&unset.unset, context);
1586        for value in &unset.values {
1587            walker.walk_expression(value, context);
1588        }
1589
1590        walker.walk_terminator(&unset.terminator, context);
1591    }
1592
1593    'arena Expression as expression => {
1594        match &expression {
1595            Expression::Parenthesized(parenthesized) => walker.walk_parenthesized(parenthesized, context),
1596            Expression::Binary(expr) => walker.walk_binary(expr, context),
1597            Expression::UnaryPrefix(operation) => walker.walk_unary_prefix(operation, context),
1598            Expression::UnaryPostfix(operation) => walker.walk_unary_postfix(operation, context),
1599            Expression::Literal(literal) => walker.walk_literal_expression(literal, context),
1600            Expression::CompositeString(string) => walker.walk_composite_string(string, context),
1601            Expression::Assignment(assignment) => {
1602                walker.walk_assignment(assignment, context);
1603            }
1604            Expression::Conditional(conditional) => {
1605                walker.walk_conditional(conditional, context);
1606            }
1607            Expression::Array(array) => walker.walk_array(array, context),
1608            Expression::LegacyArray(legacy_array) => walker.walk_legacy_array(legacy_array, context),
1609            Expression::List(list) => walker.walk_list(list, context),
1610            Expression::ArrayAccess(array_access) => walker.walk_array_access(array_access, context),
1611            Expression::ArrayAppend(array_append) => walker.walk_array_append(array_append, context),
1612            Expression::AnonymousClass(anonymous_class) => {
1613                walker.walk_anonymous_class(anonymous_class, context);
1614            }
1615            Expression::Closure(closure) => walker.walk_closure(closure, context),
1616            Expression::ArrowFunction(arrow_function) => walker.walk_arrow_function(arrow_function, context),
1617            Expression::Variable(variable) => walker.walk_variable(variable, context),
1618            Expression::Identifier(identifier) => walker.walk_identifier(identifier, context),
1619            Expression::Match(r#match) => walker.walk_match(r#match, context),
1620            Expression::Yield(r#yield) => walker.walk_yield(r#yield, context),
1621            Expression::Construct(construct) => walker.walk_construct(construct, context),
1622            Expression::Throw(throw) => walker.walk_throw(throw, context),
1623            Expression::Clone(clone) => walker.walk_clone(clone, context),
1624            Expression::Call(call) => walker.walk_call(call, context),
1625            Expression::PartialApplication(partial_application) => walker.walk_partial_application(partial_application, context),
1626            Expression::Access(access) => walker.walk_access(access, context),
1627            Expression::ConstantAccess(expr) => walker.walk_constant_access(expr, context),
1628            Expression::Parent(keyword) => walker.walk_parent_keyword(keyword, context),
1629            Expression::Static(keyword) => walker.walk_static_keyword(keyword, context),
1630            Expression::Self_(keyword) => walker.walk_self_keyword(keyword, context),
1631            Expression::Instantiation(instantiation) => walker.walk_instantiation(instantiation, context),
1632            Expression::MagicConstant(magic_constant) => walker.walk_magic_constant(magic_constant, context),
1633            Expression::Pipe(pipe) => walker.walk_pipe(pipe, context),
1634            Expression::Error(_) => {
1635                // Nothing to walk for error expressions
1636            }
1637        }
1638    }
1639
1640    'arena Binary as binary => {
1641        walker.walk_expression(binary.lhs, context);
1642        walker.walk_binary_operator(&binary.operator, context);
1643        walker.walk_expression(binary.rhs, context);
1644    }
1645
1646    'arena BinaryOperator as binary_operator => {
1647        match binary_operator {
1648            BinaryOperator::Instanceof(keyword)
1649            | BinaryOperator::LowAnd(keyword)
1650            | BinaryOperator::LowOr(keyword)
1651            | BinaryOperator::LowXor(keyword) => {
1652                walker.walk_keyword(keyword, context);
1653            }
1654            _ => {}
1655        }
1656    }
1657
1658    'arena UnaryPrefix as unary_prefix => {
1659        walker.walk_unary_prefix_operator(&unary_prefix.operator, context);
1660        walker.walk_expression(unary_prefix.operand, context);
1661    }
1662
1663    'arena UnaryPrefixOperator as unary_prefix_operator => {
1664        // Do nothing
1665    }
1666
1667    'arena UnaryPostfix as unary_postfix => {
1668        walker.walk_expression(unary_postfix.operand, context);
1669        walker.walk_unary_postfix_operator(&unary_postfix.operator, context);
1670    }
1671
1672    _ UnaryPostfixOperator as unary_postfix_operator => {
1673        // Do nothing
1674    }
1675
1676    'arena Parenthesized as parenthesized => {
1677        walker.walk_expression(parenthesized.expression, context);
1678    }
1679
1680    'arena Literal as literal_expression => {
1681        match literal_expression {
1682            Literal::String(string) => walker.walk_literal_string(string, context),
1683            Literal::Integer(integer) => walker.walk_literal_integer(integer, context),
1684            Literal::Float(float) => walker.walk_literal_float(float, context),
1685            Literal::True(keyword) => walker.walk_true_keyword(keyword, context),
1686            Literal::False(keyword) => walker.walk_false_keyword(keyword, context),
1687            Literal::Null(keyword) => walker.walk_null_keyword(keyword, context),
1688        }
1689    }
1690
1691    'arena LiteralString as literal_string => {
1692        // Do nothing by default
1693    }
1694
1695    'arena LiteralInteger as literal_integer => {
1696        // Do nothing by default
1697    }
1698
1699    'arena LiteralFloat as literal_float => {
1700        // Do nothing by default
1701    }
1702
1703    'arena Keyword as true_keyword => {
1704        // Do nothing by default
1705    }
1706
1707    'arena Keyword as false_keyword => {
1708        // Do nothing by default
1709    }
1710
1711    'arena Keyword as null_keyword => {
1712        // Do nothing by default
1713    }
1714
1715    'arena CompositeString as composite_string => {
1716        match composite_string {
1717            CompositeString::ShellExecute(str) => walker.walk_shell_execute_string(str, context),
1718            CompositeString::Interpolated(str) => walker.walk_interpolated_string(str, context),
1719            CompositeString::Document(str) => walker.walk_document_string(str, context),
1720        }
1721    }
1722
1723    'arena ShellExecuteString as shell_execute_string => {
1724        for part in &shell_execute_string.parts {
1725            walker.walk_string_part(part, context);
1726        }
1727    }
1728
1729    'arena InterpolatedString as interpolated_string => {
1730        for part in &interpolated_string.parts {
1731            walker.walk_string_part(part, context);
1732        }
1733    }
1734
1735    'arena DocumentString as document_string => {
1736        for part in &document_string.parts {
1737            walker.walk_string_part(part, context);
1738        }
1739    }
1740
1741    'arena StringPart as string_part => {
1742        match string_part {
1743            StringPart::Literal(literal) => walker.walk_literal_string_part(literal, context),
1744            StringPart::Expression(expression) => walker.walk_expression(expression, context),
1745            StringPart::BracedExpression(braced_expression_string_part) => {
1746                walker.walk_braced_expression_string_part(braced_expression_string_part, context);
1747            }
1748        }
1749    }
1750
1751    'arena LiteralStringPart as literal_string_part => {
1752        // Do nothing
1753    }
1754
1755    'arena BracedExpressionStringPart as braced_expression_string_part => {
1756        walker.walk_expression(braced_expression_string_part.expression, context);
1757    }
1758
1759    'arena Assignment as assignment => {
1760        walker.walk_expression(assignment.lhs, context);
1761        walker.walk_assignment_operator(&assignment.operator, context);
1762        walker.walk_expression(assignment.rhs, context);
1763    }
1764
1765    _ AssignmentOperator as assignment_operator => {
1766        // Do nothing
1767    }
1768
1769    'arena Conditional as conditional => {
1770        walker.walk_expression(conditional.condition, context);
1771        if let Some(then) = &conditional.then {
1772            walker.walk_expression(then, context);
1773        }
1774
1775        walker.walk_expression(conditional.r#else, context);
1776    }
1777
1778    'arena Array as array => {
1779        for element in &array.elements {
1780            walker.walk_array_element(element, context);
1781        }
1782    }
1783
1784    'arena ArrayElement as array_element => {
1785        match array_element {
1786            ArrayElement::KeyValue(key_value_array_element) => {
1787                walker.walk_key_value_array_element(key_value_array_element, context);
1788            }
1789            ArrayElement::Value(value_array_element) => {
1790                walker.walk_value_array_element(value_array_element, context);
1791            }
1792            ArrayElement::Variadic(variadic_array_element) => {
1793                walker.walk_variadic_array_element(variadic_array_element, context);
1794            }
1795            ArrayElement::Missing(missing_array_element) => {
1796                walker.walk_missing_array_element(missing_array_element, context);
1797            }
1798        }
1799    }
1800
1801    'arena KeyValueArrayElement as key_value_array_element => {
1802        walker.walk_expression(key_value_array_element.key, context);
1803        walker.walk_expression(key_value_array_element.value, context);
1804    }
1805
1806    'arena ValueArrayElement as value_array_element => {
1807        walker.walk_expression(value_array_element.value, context);
1808    }
1809
1810    'arena VariadicArrayElement as variadic_array_element => {
1811        walker.walk_expression(variadic_array_element.value, context);
1812    }
1813
1814    _ MissingArrayElement as missing_array_element => {
1815        // Do nothing
1816    }
1817
1818    'arena LegacyArray as legacy_array => {
1819        walker.walk_keyword(&legacy_array.array, context);
1820        for element in &legacy_array.elements {
1821            walker.walk_array_element(element, context);
1822        }
1823    }
1824
1825    'arena List as list => {
1826        walker.walk_keyword(&list.list, context);
1827
1828        for element in &list.elements {
1829            walker.walk_array_element(element, context);
1830        }
1831    }
1832
1833    'arena ArrayAccess as array_access => {
1834        walker.walk_expression(array_access.array, context);
1835        walker.walk_expression(array_access.index, context);
1836    }
1837
1838    'arena ArrayAppend as array_append => {
1839        walker.walk_expression(array_append.array, context);
1840    }
1841
1842    'arena AnonymousClass as anonymous_class => {
1843        for attribute_list in &anonymous_class.attribute_lists {
1844            walker.walk_attribute_list(attribute_list, context);
1845        }
1846
1847        for modifier in &anonymous_class.modifiers {
1848            walker.walk_modifier(modifier, context);
1849        }
1850
1851        walker.walk_keyword(&anonymous_class.new, context);
1852        walker.walk_keyword(&anonymous_class.class, context);
1853        if let Some(argument_list) = &anonymous_class.argument_list {
1854            walker.walk_argument_list(argument_list, context);
1855        }
1856
1857        if let Some(extends) = &anonymous_class.extends {
1858            walker.walk_extends(extends, context);
1859        }
1860
1861        if let Some(implements) = &anonymous_class.implements {
1862            walker.walk_implements(implements, context);
1863        }
1864
1865        for class_member in &anonymous_class.members {
1866            walker.walk_class_like_member(class_member, context);
1867        }
1868    }
1869
1870    'arena Closure as closure => {
1871        for attribute_list in &closure.attribute_lists {
1872                walker.walk_attribute_list(attribute_list, context);
1873            }
1874
1875        if let Some(keyword) = &closure.r#static {
1876            walker.walk_keyword(keyword, context);
1877        }
1878
1879        walker.walk_keyword(&closure.function, context);
1880        walker.walk_function_like_parameter_list(&closure.parameter_list, context);
1881        if let Some(use_clause) = &closure.use_clause {
1882            walker.walk_closure_use_clause(use_clause, context);
1883        }
1884
1885        if let Some(return_type_hint) = &closure.return_type_hint {
1886            walker.walk_function_like_return_type_hint(return_type_hint, context);
1887        }
1888
1889        walker.walk_block(&closure.body, context);
1890    }
1891
1892    'arena ClosureUseClause as closure_use_clause => {
1893        for variable in &closure_use_clause.variables {
1894            walker.walk_closure_use_clause_variable(variable, context);
1895        }
1896    }
1897
1898    'arena ClosureUseClauseVariable as closure_use_clause_variable => {
1899        walker.walk_direct_variable(&closure_use_clause_variable.variable, context);
1900    }
1901
1902    'arena ArrowFunction as arrow_function => {
1903        for attribute_list in &arrow_function.attribute_lists {
1904            walker.walk_attribute_list(attribute_list, context);
1905        }
1906
1907        if let Some(keyword) = &arrow_function.r#static {
1908            walker.walk_keyword(keyword, context);
1909        }
1910
1911        walker.walk_keyword(&arrow_function.r#fn, context);
1912        walker.walk_function_like_parameter_list(&arrow_function.parameter_list, context);
1913
1914        if let Some(return_type_hint) = &arrow_function.return_type_hint {
1915            walker.walk_function_like_return_type_hint(return_type_hint, context);
1916        }
1917
1918        walker.walk_expression(arrow_function.expression, context);
1919    }
1920
1921    'arena Variable as variable => {
1922        match variable {
1923            Variable::Direct(direct_variable) => {
1924                walker.walk_direct_variable(direct_variable, context);
1925            }
1926            Variable::Indirect(indirect_variable) => {
1927                walker.walk_indirect_variable(indirect_variable, context);
1928            }
1929            Variable::Nested(nested_variable) => {
1930                walker.walk_nested_variable(nested_variable, context);
1931            }
1932        }
1933    }
1934
1935    'arena DirectVariable as direct_variable => {
1936        // Do nothing by default
1937    }
1938
1939    'arena IndirectVariable as indirect_variable => {
1940        walker.walk_expression(indirect_variable.expression, context);
1941    }
1942
1943    'arena NestedVariable as nested_variable => {
1944        walker.walk_variable(nested_variable.variable, context);
1945    }
1946
1947    'arena Identifier as identifier => {
1948        match identifier {
1949            Identifier::Local(local_identifier) => walker.walk_local_identifier(local_identifier, context),
1950            Identifier::Qualified(qualified_identifier) => walker.walk_qualified_identifier(qualified_identifier, context),
1951            Identifier::FullyQualified(fully_qualified_identifier) => walker.walk_fully_qualified_identifier(fully_qualified_identifier, context),
1952        }
1953    }
1954
1955    'arena LocalIdentifier as local_identifier => {
1956        // Do nothing by default
1957    }
1958
1959    'arena QualifiedIdentifier as qualified_identifier => {
1960        // Do nothing by default
1961    }
1962
1963    'arena FullyQualifiedIdentifier as fully_qualified_identifier => {
1964        // Do nothing by default
1965    }
1966
1967    'arena Match as r#match => {
1968        walker.walk_keyword(&r#match.r#match, context);
1969        walker.walk_expression(r#match.expression, context);
1970        for arm in &r#match.arms {
1971            walker.walk_match_arm(arm, context);
1972        }
1973    }
1974
1975    'arena MatchArm as match_arm => {
1976        match match_arm {
1977            MatchArm::Expression(expression_match_arm) => {
1978                walker.walk_match_expression_arm(expression_match_arm, context);
1979            }
1980            MatchArm::Default(default_match_arm) => {
1981                walker.walk_match_default_arm(default_match_arm, context);
1982            }
1983        }
1984    }
1985
1986    'arena MatchExpressionArm as match_expression_arm => {
1987        for condition in &match_expression_arm.conditions {
1988            walker.walk_expression(condition, context);
1989        }
1990
1991        walker.walk_expression(match_expression_arm.expression, context);
1992    }
1993
1994    'arena MatchDefaultArm as match_default_arm => {
1995        walker.walk_keyword(&match_default_arm.r#default, context);
1996        walker.walk_expression(match_default_arm.expression, context);
1997    }
1998
1999    'arena Yield as r#yield => {
2000        match r#yield {
2001            Yield::Value(yield_value) => {
2002                walker.walk_yield_value(yield_value, context);
2003            }
2004            Yield::Pair(yield_pair) => {
2005                walker.walk_yield_pair(yield_pair, context);
2006            }
2007            Yield::From(yield_from) => {
2008                walker.walk_yield_from(yield_from, context);
2009            }
2010        }
2011    }
2012
2013    'arena YieldValue as yield_value => {
2014        walker.walk_keyword(&yield_value.r#yield, context);
2015
2016        if let Some(value) = &yield_value.value {
2017            walker.walk_expression(value, context);
2018        }
2019    }
2020
2021    'arena YieldPair as yield_pair => {
2022        walker.walk_keyword(&yield_pair.r#yield, context);
2023        walker.walk_expression(yield_pair.key, context);
2024        walker.walk_expression(yield_pair.value, context);
2025    }
2026
2027    'arena YieldFrom as yield_from => {
2028        walker.walk_keyword(&yield_from.r#yield, context);
2029        walker.walk_keyword(&yield_from.from, context);
2030        walker.walk_expression(yield_from.iterator, context);
2031    }
2032
2033    'arena Construct as construct => {
2034        match construct {
2035            Construct::Isset(isset_construct) => {
2036                walker.walk_isset_construct(isset_construct, context);
2037            }
2038            Construct::Empty(empty_construct) => {
2039                walker.walk_empty_construct(empty_construct, context);
2040            }
2041            Construct::Eval(eval_construct) => {
2042                walker.walk_eval_construct(eval_construct, context);
2043            }
2044            Construct::Include(include_construct) => {
2045                walker.walk_include_construct(include_construct, context);
2046            }
2047            Construct::IncludeOnce(include_once_construct) => {
2048                walker.walk_include_once_construct(include_once_construct, context);
2049            }
2050            Construct::Require(require_construct) => {
2051                walker.walk_require_construct(require_construct, context);
2052            }
2053            Construct::RequireOnce(require_once_construct) => {
2054                walker.walk_require_once_construct(require_once_construct, context);
2055            }
2056            Construct::Print(print_construct) => {
2057                walker.walk_print_construct(print_construct, context);
2058            }
2059            Construct::Exit(exit_construct) => {
2060                walker.walk_exit_construct(exit_construct, context);
2061            }
2062            Construct::Die(die_construct) => {
2063                walker.walk_die_construct(die_construct, context);
2064            }
2065        }
2066    }
2067
2068    'arena IssetConstruct as isset_construct => {
2069        walker.walk_keyword(&isset_construct.isset, context);
2070        for value in &isset_construct.values {
2071            walker.walk_expression(value, context);
2072        }
2073    }
2074
2075    'arena EmptyConstruct as empty_construct => {
2076        walker.walk_keyword(&empty_construct.empty, context);
2077        walker.walk_expression(empty_construct.value, context);
2078    }
2079
2080    'arena EvalConstruct as eval_construct => {
2081        walker.walk_keyword(&eval_construct.eval, context);
2082        walker.walk_expression(eval_construct.value, context);
2083    }
2084
2085    'arena IncludeConstruct as include_construct => {
2086        walker.walk_keyword(&include_construct.include, context);
2087        walker.walk_expression(include_construct.value, context);
2088    }
2089
2090    'arena IncludeOnceConstruct as include_once_construct => {
2091        walker.walk_keyword(&include_once_construct.include_once, context);
2092        walker.walk_expression(include_once_construct.value, context);
2093    }
2094
2095    'arena RequireConstruct as require_construct => {
2096        walker.walk_keyword(&require_construct.require, context);
2097        walker.walk_expression(require_construct.value, context);
2098    }
2099
2100    'arena RequireOnceConstruct as require_once_construct => {
2101        walker.walk_keyword(&require_once_construct.require_once, context);
2102        walker.walk_expression(require_once_construct.value, context);
2103    }
2104
2105    'arena PrintConstruct as print_construct => {
2106        walker.walk_keyword(&print_construct.print, context);
2107        walker.walk_expression(print_construct.value, context);
2108    }
2109
2110    'arena ExitConstruct as exit_construct => {
2111        walker.walk_keyword(&exit_construct.exit, context);
2112        if let Some(arguments) = &exit_construct.arguments {
2113            walker.walk_argument_list(arguments, context);
2114        }
2115    }
2116
2117    'arena DieConstruct as die_construct => {
2118        walker.walk_keyword(&die_construct.die, context);
2119        if let Some(arguments) = &die_construct.arguments {
2120            walker.walk_argument_list(arguments, context);
2121        }
2122    }
2123
2124    'arena Throw as r#throw => {
2125        walker.walk_keyword(&r#throw.r#throw, context);
2126        walker.walk_expression(r#throw.exception, context);
2127    }
2128
2129    'arena Clone as clone => {
2130        walker.walk_keyword(&clone.clone, context);
2131        walker.walk_expression(clone.object, context);
2132    }
2133
2134    'arena Call as call => {
2135        match call {
2136            Call::Function(function_call) => {
2137                walker.walk_function_call(function_call, context);
2138            }
2139            Call::Method(method_call) => {
2140                walker.walk_method_call(method_call, context);
2141            }
2142            Call::NullSafeMethod(null_safe_method_call) => {
2143                walker.walk_null_safe_method_call(null_safe_method_call, context);
2144            }
2145            Call::StaticMethod(static_method_call) => {
2146                walker.walk_static_method_call(static_method_call, context);
2147            }
2148        }
2149    }
2150
2151    'arena FunctionCall as function_call => {
2152        walker.walk_expression(function_call.function, context);
2153        walker.walk_argument_list(&function_call.argument_list, context);
2154    }
2155
2156    'arena MethodCall as method_call => {
2157        walker.walk_expression(method_call.object, context);
2158        walker.walk_class_like_member_selector(&method_call.method, context);
2159        walker.walk_argument_list(&method_call.argument_list, context);
2160    }
2161
2162    'arena NullSafeMethodCall as null_safe_method_call => {
2163        walker.walk_expression(null_safe_method_call.object, context);
2164        walker.walk_class_like_member_selector(&null_safe_method_call.method, context);
2165        walker.walk_argument_list(&null_safe_method_call.argument_list, context);
2166    }
2167
2168    'arena StaticMethodCall as static_method_call => {
2169        walker.walk_expression(static_method_call.class, context);
2170        walker.walk_class_like_member_selector(&static_method_call.method, context);
2171        walker.walk_argument_list(&static_method_call.argument_list, context);
2172    }
2173
2174
2175    'arena PartialApplication as partial_application => {
2176        match partial_application {
2177            PartialApplication::Function(function_partial_application) => {
2178                walker.walk_function_partial_application(function_partial_application, context);
2179            }
2180            PartialApplication::Method(method_partial_application) => {
2181                walker.walk_method_partial_application(method_partial_application, context);
2182            }
2183            PartialApplication::StaticMethod(static_method_partial_application) => {
2184                walker.walk_static_method_partial_application(static_method_partial_application, context);
2185            }
2186        }
2187    }
2188
2189    'arena FunctionPartialApplication as function_partial_application => {
2190        walker.walk_expression(function_partial_application.function, context);
2191        walker.walk_partial_argument_list(&function_partial_application.argument_list, context);
2192    }
2193
2194    'arena MethodPartialApplication as method_partial_application => {
2195        walker.walk_expression(method_partial_application.object, context);
2196        walker.walk_class_like_member_selector(&method_partial_application.method, context);
2197        walker.walk_partial_argument_list(&method_partial_application.argument_list, context);
2198    }
2199
2200    'arena StaticMethodPartialApplication as static_method_partial_application => {
2201        walker.walk_expression(static_method_partial_application.class, context);
2202        walker.walk_class_like_member_selector(&static_method_partial_application.method, context);
2203        walker.walk_partial_argument_list(&static_method_partial_application.argument_list, context);
2204    }
2205
2206    'arena ClassLikeMemberSelector as class_like_member_selector => {
2207        match class_like_member_selector {
2208            ClassLikeMemberSelector::Identifier(local_identifier) => {
2209                walker.walk_local_identifier(local_identifier, context);
2210            }
2211            ClassLikeMemberSelector::Variable(variable) => {
2212                walker.walk_variable(variable, context);
2213            }
2214            ClassLikeMemberSelector::Expression(class_like_member_expression_selector) => {
2215                walker.walk_class_like_member_expression_selector(
2216                    class_like_member_expression_selector,
2217                    context,
2218                );
2219            }
2220            ClassLikeMemberSelector::Missing(_) => {
2221                // Nothing to walk for missing selectors
2222            }
2223        }
2224    }
2225
2226    'arena ClassLikeMemberExpressionSelector as class_like_member_expression_selector => {
2227        walker.walk_expression(class_like_member_expression_selector.expression, context);
2228    }
2229
2230    'arena ConstantAccess as constant_access => {
2231        walker.walk_identifier(&constant_access.name, context);
2232    }
2233
2234    'arena Access as access => {
2235        match access {
2236            Access::Property(property_access) => {
2237                walker.walk_property_access(property_access, context);
2238            }
2239            Access::NullSafeProperty(null_safe_property_access) => {
2240                walker.walk_null_safe_property_access(null_safe_property_access, context);
2241            }
2242            Access::StaticProperty(static_property_access) => {
2243                walker.walk_static_property_access(static_property_access, context);
2244            }
2245            Access::ClassConstant(class_constant_access) => {
2246                walker.walk_class_constant_access(class_constant_access, context);
2247            }
2248        }
2249    }
2250
2251    'arena PropertyAccess as property_access => {
2252        walker.walk_expression(property_access.object, context);
2253        walker.walk_class_like_member_selector(&property_access.property, context);
2254    }
2255
2256    'arena NullSafePropertyAccess as null_safe_property_access => {
2257        walker.walk_expression(null_safe_property_access.object, context);
2258        walker.walk_class_like_member_selector(&null_safe_property_access.property, context);
2259    }
2260
2261    'arena StaticPropertyAccess as static_property_access => {
2262        walker.walk_expression(static_property_access.class, context);
2263        walker.walk_variable(&static_property_access.property, context);
2264    }
2265
2266    'arena ClassConstantAccess as class_constant_access => {
2267        walker.walk_expression(class_constant_access.class, context);
2268        walker.walk_class_like_constant_selector(&class_constant_access.constant, context);
2269    }
2270
2271    'arena ClassLikeConstantSelector as class_like_constant_selector => {
2272        match class_like_constant_selector {
2273            ClassLikeConstantSelector::Identifier(local_identifier) => {
2274                walker.walk_local_identifier(local_identifier, context);
2275            }
2276            ClassLikeConstantSelector::Expression(class_like_constant_expression_selector) => {
2277                walker.walk_class_like_member_expression_selector(
2278                    class_like_constant_expression_selector,
2279                    context,
2280                );
2281            }
2282            ClassLikeConstantSelector::Missing(_) => {
2283                // Nothing to walk for missing selectors
2284            }
2285        }
2286    }
2287
2288    'arena Keyword as parent_keyword => {
2289        // Do nothing by default
2290    }
2291
2292    'arena Keyword as static_keyword => {
2293        // Do nothing by default
2294    }
2295
2296    'arena Keyword as self_keyword => {
2297        // Do nothing by default
2298    }
2299
2300    'arena Instantiation as instantiation => {
2301        walker.walk_keyword(&instantiation.new, context);
2302        walker.walk_expression(instantiation.class, context);
2303        if let Some(argument_list) = &instantiation.argument_list {
2304            walker.walk_argument_list(argument_list, context);
2305        }
2306    }
2307
2308    'arena MagicConstant as magic_constant => {
2309        walker.walk_local_identifier(magic_constant.value(), context);
2310    }
2311
2312    'arena Pipe as pipe => {
2313        walker.walk_expression(pipe.input, context);
2314        walker.walk_expression(pipe.callable, context);
2315    }
2316
2317    'arena Hint as hint => {
2318        match hint {
2319            Hint::Identifier(identifier) => {
2320                walker.walk_identifier(identifier, context);
2321            }
2322            Hint::Parenthesized(parenthesized_hint) => {
2323                walker.walk_parenthesized_hint(parenthesized_hint, context);
2324            }
2325            Hint::Nullable(nullable_hint) => {
2326                walker.walk_nullable_hint(nullable_hint, context);
2327            }
2328            Hint::Union(union_hint) => {
2329                walker.walk_union_hint(union_hint, context);
2330            }
2331            Hint::Intersection(intersection_hint) => {
2332                walker.walk_intersection_hint(intersection_hint, context);
2333            }
2334            Hint::Null(keyword) |
2335            Hint::True(keyword) |
2336            Hint::False(keyword) |
2337            Hint::Array(keyword) |
2338            Hint::Callable(keyword) |
2339            Hint::Static(keyword) |
2340            Hint::Self_(keyword) |
2341            Hint::Parent(keyword) => {
2342                walker.walk_keyword(keyword, context);
2343            }
2344            Hint::Void(local_identifier) |
2345            Hint::Never(local_identifier) |
2346            Hint::Float(local_identifier) |
2347            Hint::Bool(local_identifier) |
2348            Hint::Integer(local_identifier) |
2349            Hint::String(local_identifier) |
2350            Hint::Object(local_identifier) |
2351            Hint::Mixed(local_identifier) |
2352            Hint::Iterable(local_identifier) => {
2353                walker.walk_local_identifier(local_identifier, context);
2354            }
2355        }
2356    }
2357
2358    'arena ParenthesizedHint as parenthesized_hint => {
2359        walker.walk_hint(parenthesized_hint.hint, context);
2360    }
2361
2362    'arena NullableHint as nullable_hint => {
2363        walker.walk_hint(nullable_hint.hint, context);
2364    }
2365
2366    'arena UnionHint as union_hint => {
2367        walker.walk_hint(union_hint.left, context);
2368        walker.walk_hint(union_hint.right, context);
2369    }
2370
2371    'arena IntersectionHint as intersection_hint => {
2372        walker.walk_hint(intersection_hint.left, context);
2373        walker.walk_hint(intersection_hint.right, context);
2374    }
2375
2376    'arena Keyword as keyword => {
2377        // Do nothing by default
2378    }
2379}