1#![doc = r" This file is generated by `tools/generate-code`. DO NOT MODIFY."]
2#![allow(unused_variables)]
3#![allow(clippy::all)]
4pub use ::swc_visit::All;
5use swc_xml_ast::*;
6#[doc = r" A visitor trait for traversing the AST."]
7pub trait Visit {
8 #[doc = "Visit a node of type `swc_atoms :: Atom`.\n\nBy default, this method calls \
9 [`swc_atoms :: Atom::visit_children_with`]. If you want to recurse, you need to call \
10 it manually."]
11 #[inline]
12 fn visit_atom(&mut self, node: &swc_atoms::Atom) {
13 <swc_atoms::Atom as VisitWith<Self>>::visit_children_with(node, self)
14 }
15 #[doc = "Visit a node of type `Attribute`.\n\nBy default, this method calls \
16 [`Attribute::visit_children_with`]. If you want to recurse, you need to call it \
17 manually."]
18 #[inline]
19 fn visit_attribute(&mut self, node: &Attribute) {
20 <Attribute as VisitWith<Self>>::visit_children_with(node, self)
21 }
22 #[doc = "Visit a node of type `AttributeToken`.\n\nBy default, this method calls \
23 [`AttributeToken::visit_children_with`]. If you want to recurse, you need to call it \
24 manually."]
25 #[inline]
26 fn visit_attribute_token(&mut self, node: &AttributeToken) {
27 <AttributeToken as VisitWith<Self>>::visit_children_with(node, self)
28 }
29 #[doc = "Visit a node of type `Vec < AttributeToken >`.\n\nBy default, this method calls [`Vec \
30 < AttributeToken >::visit_children_with`]. If you want to recurse, you need to call \
31 it manually."]
32 #[inline]
33 fn visit_attribute_tokens(&mut self, node: &[AttributeToken]) {
34 <[AttributeToken] as VisitWith<Self>>::visit_children_with(node, self)
35 }
36 #[doc = "Visit a node of type `Vec < Attribute >`.\n\nBy default, this method calls [`Vec < \
37 Attribute >::visit_children_with`]. If you want to recurse, you need to call it \
38 manually."]
39 #[inline]
40 fn visit_attributes(&mut self, node: &[Attribute]) {
41 <[Attribute] as VisitWith<Self>>::visit_children_with(node, self)
42 }
43 #[doc = "Visit a node of type `CdataSection`.\n\nBy default, this method calls \
44 [`CdataSection::visit_children_with`]. If you want to recurse, you need to call it \
45 manually."]
46 #[inline]
47 fn visit_cdata_section(&mut self, node: &CdataSection) {
48 <CdataSection as VisitWith<Self>>::visit_children_with(node, self)
49 }
50 #[doc = "Visit a node of type `Child`.\n\nBy default, this method calls \
51 [`Child::visit_children_with`]. If you want to recurse, you need to call it manually."]
52 #[inline]
53 fn visit_child(&mut self, node: &Child) {
54 <Child as VisitWith<Self>>::visit_children_with(node, self)
55 }
56 #[doc = "Visit a node of type `Vec < Child >`.\n\nBy default, this method calls [`Vec < Child \
57 >::visit_children_with`]. If you want to recurse, you need to call it manually."]
58 #[inline]
59 fn visit_childs(&mut self, node: &[Child]) {
60 <[Child] as VisitWith<Self>>::visit_children_with(node, self)
61 }
62 #[doc = "Visit a node of type `Comment`.\n\nBy default, this method calls \
63 [`Comment::visit_children_with`]. If you want to recurse, you need to call it \
64 manually."]
65 #[inline]
66 fn visit_comment(&mut self, node: &Comment) {
67 <Comment as VisitWith<Self>>::visit_children_with(node, self)
68 }
69 #[doc = "Visit a node of type `Document`.\n\nBy default, this method calls \
70 [`Document::visit_children_with`]. If you want to recurse, you need to call it \
71 manually."]
72 #[inline]
73 fn visit_document(&mut self, node: &Document) {
74 <Document as VisitWith<Self>>::visit_children_with(node, self)
75 }
76 #[doc = "Visit a node of type `DocumentMode`.\n\nBy default, this method calls \
77 [`DocumentMode::visit_children_with`]. If you want to recurse, you need to call it \
78 manually."]
79 #[inline]
80 fn visit_document_mode(&mut self, node: &DocumentMode) {
81 <DocumentMode as VisitWith<Self>>::visit_children_with(node, self)
82 }
83 #[doc = "Visit a node of type `DocumentType`.\n\nBy default, this method calls \
84 [`DocumentType::visit_children_with`]. If you want to recurse, you need to call it \
85 manually."]
86 #[inline]
87 fn visit_document_type(&mut self, node: &DocumentType) {
88 <DocumentType as VisitWith<Self>>::visit_children_with(node, self)
89 }
90 #[doc = "Visit a node of type `Element`.\n\nBy default, this method calls \
91 [`Element::visit_children_with`]. If you want to recurse, you need to call it \
92 manually."]
93 #[inline]
94 fn visit_element(&mut self, node: &Element) {
95 <Element as VisitWith<Self>>::visit_children_with(node, self)
96 }
97 #[doc = "Visit a node of type `Namespace`.\n\nBy default, this method calls \
98 [`Namespace::visit_children_with`]. If you want to recurse, you need to call it \
99 manually."]
100 #[inline]
101 fn visit_namespace(&mut self, node: &Namespace) {
102 <Namespace as VisitWith<Self>>::visit_children_with(node, self)
103 }
104 #[doc = "Visit a node of type `Option < swc_atoms :: Atom >`.\n\nBy default, this method calls \
105 [`Option < swc_atoms :: Atom >::visit_children_with`]. If you want to recurse, you \
106 need to call it manually."]
107 #[inline]
108 fn visit_opt_atom(&mut self, node: &Option<swc_atoms::Atom>) {
109 <Option<swc_atoms::Atom> as VisitWith<Self>>::visit_children_with(node, self)
110 }
111 #[doc = "Visit a node of type `Option < Namespace >`.\n\nBy default, this method calls \
112 [`Option < Namespace >::visit_children_with`]. If you want to recurse, you need to \
113 call it manually."]
114 #[inline]
115 fn visit_opt_namespace(&mut self, node: &Option<Namespace>) {
116 <Option<Namespace> as VisitWith<Self>>::visit_children_with(node, self)
117 }
118 #[doc = "Visit a node of type `ProcessingInstruction`.\n\nBy default, this method calls \
119 [`ProcessingInstruction::visit_children_with`]. If you want to recurse, you need to \
120 call it manually."]
121 #[inline]
122 fn visit_processing_instruction(&mut self, node: &ProcessingInstruction) {
123 <ProcessingInstruction as VisitWith<Self>>::visit_children_with(node, self)
124 }
125 #[doc = "Visit a node of type `swc_common :: Span`.\n\nBy default, this method calls \
126 [`swc_common :: Span::visit_children_with`]. If you want to recurse, you need to call \
127 it manually."]
128 #[inline]
129 fn visit_span(&mut self, node: &swc_common::Span) {
130 <swc_common::Span as VisitWith<Self>>::visit_children_with(node, self)
131 }
132 #[doc = "Visit a node of type `Text`.\n\nBy default, this method calls \
133 [`Text::visit_children_with`]. If you want to recurse, you need to call it manually."]
134 #[inline]
135 fn visit_text(&mut self, node: &Text) {
136 <Text as VisitWith<Self>>::visit_children_with(node, self)
137 }
138 #[doc = "Visit a node of type `Token`.\n\nBy default, this method calls \
139 [`Token::visit_children_with`]. If you want to recurse, you need to call it manually."]
140 #[inline]
141 fn visit_token(&mut self, node: &Token) {
142 <Token as VisitWith<Self>>::visit_children_with(node, self)
143 }
144 #[doc = "Visit a node of type `TokenAndSpan`.\n\nBy default, this method calls \
145 [`TokenAndSpan::visit_children_with`]. If you want to recurse, you need to call it \
146 manually."]
147 #[inline]
148 fn visit_token_and_span(&mut self, node: &TokenAndSpan) {
149 <TokenAndSpan as VisitWith<Self>>::visit_children_with(node, self)
150 }
151}
152impl<V> Visit for &mut V
153where
154 V: ?Sized + Visit,
155{
156 #[inline]
157 fn visit_atom(&mut self, node: &swc_atoms::Atom) {
158 <V as Visit>::visit_atom(&mut **self, node)
159 }
160
161 #[inline]
162 fn visit_attribute(&mut self, node: &Attribute) {
163 <V as Visit>::visit_attribute(&mut **self, node)
164 }
165
166 #[inline]
167 fn visit_attribute_token(&mut self, node: &AttributeToken) {
168 <V as Visit>::visit_attribute_token(&mut **self, node)
169 }
170
171 #[inline]
172 fn visit_attribute_tokens(&mut self, node: &[AttributeToken]) {
173 <V as Visit>::visit_attribute_tokens(&mut **self, node)
174 }
175
176 #[inline]
177 fn visit_attributes(&mut self, node: &[Attribute]) {
178 <V as Visit>::visit_attributes(&mut **self, node)
179 }
180
181 #[inline]
182 fn visit_cdata_section(&mut self, node: &CdataSection) {
183 <V as Visit>::visit_cdata_section(&mut **self, node)
184 }
185
186 #[inline]
187 fn visit_child(&mut self, node: &Child) {
188 <V as Visit>::visit_child(&mut **self, node)
189 }
190
191 #[inline]
192 fn visit_childs(&mut self, node: &[Child]) {
193 <V as Visit>::visit_childs(&mut **self, node)
194 }
195
196 #[inline]
197 fn visit_comment(&mut self, node: &Comment) {
198 <V as Visit>::visit_comment(&mut **self, node)
199 }
200
201 #[inline]
202 fn visit_document(&mut self, node: &Document) {
203 <V as Visit>::visit_document(&mut **self, node)
204 }
205
206 #[inline]
207 fn visit_document_mode(&mut self, node: &DocumentMode) {
208 <V as Visit>::visit_document_mode(&mut **self, node)
209 }
210
211 #[inline]
212 fn visit_document_type(&mut self, node: &DocumentType) {
213 <V as Visit>::visit_document_type(&mut **self, node)
214 }
215
216 #[inline]
217 fn visit_element(&mut self, node: &Element) {
218 <V as Visit>::visit_element(&mut **self, node)
219 }
220
221 #[inline]
222 fn visit_namespace(&mut self, node: &Namespace) {
223 <V as Visit>::visit_namespace(&mut **self, node)
224 }
225
226 #[inline]
227 fn visit_opt_atom(&mut self, node: &Option<swc_atoms::Atom>) {
228 <V as Visit>::visit_opt_atom(&mut **self, node)
229 }
230
231 #[inline]
232 fn visit_opt_namespace(&mut self, node: &Option<Namespace>) {
233 <V as Visit>::visit_opt_namespace(&mut **self, node)
234 }
235
236 #[inline]
237 fn visit_processing_instruction(&mut self, node: &ProcessingInstruction) {
238 <V as Visit>::visit_processing_instruction(&mut **self, node)
239 }
240
241 #[inline]
242 fn visit_span(&mut self, node: &swc_common::Span) {
243 <V as Visit>::visit_span(&mut **self, node)
244 }
245
246 #[inline]
247 fn visit_text(&mut self, node: &Text) {
248 <V as Visit>::visit_text(&mut **self, node)
249 }
250
251 #[inline]
252 fn visit_token(&mut self, node: &Token) {
253 <V as Visit>::visit_token(&mut **self, node)
254 }
255
256 #[inline]
257 fn visit_token_and_span(&mut self, node: &TokenAndSpan) {
258 <V as Visit>::visit_token_and_span(&mut **self, node)
259 }
260}
261impl<V> Visit for Box<V>
262where
263 V: ?Sized + Visit,
264{
265 #[inline]
266 fn visit_atom(&mut self, node: &swc_atoms::Atom) {
267 <V as Visit>::visit_atom(&mut **self, node)
268 }
269
270 #[inline]
271 fn visit_attribute(&mut self, node: &Attribute) {
272 <V as Visit>::visit_attribute(&mut **self, node)
273 }
274
275 #[inline]
276 fn visit_attribute_token(&mut self, node: &AttributeToken) {
277 <V as Visit>::visit_attribute_token(&mut **self, node)
278 }
279
280 #[inline]
281 fn visit_attribute_tokens(&mut self, node: &[AttributeToken]) {
282 <V as Visit>::visit_attribute_tokens(&mut **self, node)
283 }
284
285 #[inline]
286 fn visit_attributes(&mut self, node: &[Attribute]) {
287 <V as Visit>::visit_attributes(&mut **self, node)
288 }
289
290 #[inline]
291 fn visit_cdata_section(&mut self, node: &CdataSection) {
292 <V as Visit>::visit_cdata_section(&mut **self, node)
293 }
294
295 #[inline]
296 fn visit_child(&mut self, node: &Child) {
297 <V as Visit>::visit_child(&mut **self, node)
298 }
299
300 #[inline]
301 fn visit_childs(&mut self, node: &[Child]) {
302 <V as Visit>::visit_childs(&mut **self, node)
303 }
304
305 #[inline]
306 fn visit_comment(&mut self, node: &Comment) {
307 <V as Visit>::visit_comment(&mut **self, node)
308 }
309
310 #[inline]
311 fn visit_document(&mut self, node: &Document) {
312 <V as Visit>::visit_document(&mut **self, node)
313 }
314
315 #[inline]
316 fn visit_document_mode(&mut self, node: &DocumentMode) {
317 <V as Visit>::visit_document_mode(&mut **self, node)
318 }
319
320 #[inline]
321 fn visit_document_type(&mut self, node: &DocumentType) {
322 <V as Visit>::visit_document_type(&mut **self, node)
323 }
324
325 #[inline]
326 fn visit_element(&mut self, node: &Element) {
327 <V as Visit>::visit_element(&mut **self, node)
328 }
329
330 #[inline]
331 fn visit_namespace(&mut self, node: &Namespace) {
332 <V as Visit>::visit_namespace(&mut **self, node)
333 }
334
335 #[inline]
336 fn visit_opt_atom(&mut self, node: &Option<swc_atoms::Atom>) {
337 <V as Visit>::visit_opt_atom(&mut **self, node)
338 }
339
340 #[inline]
341 fn visit_opt_namespace(&mut self, node: &Option<Namespace>) {
342 <V as Visit>::visit_opt_namespace(&mut **self, node)
343 }
344
345 #[inline]
346 fn visit_processing_instruction(&mut self, node: &ProcessingInstruction) {
347 <V as Visit>::visit_processing_instruction(&mut **self, node)
348 }
349
350 #[inline]
351 fn visit_span(&mut self, node: &swc_common::Span) {
352 <V as Visit>::visit_span(&mut **self, node)
353 }
354
355 #[inline]
356 fn visit_text(&mut self, node: &Text) {
357 <V as Visit>::visit_text(&mut **self, node)
358 }
359
360 #[inline]
361 fn visit_token(&mut self, node: &Token) {
362 <V as Visit>::visit_token(&mut **self, node)
363 }
364
365 #[inline]
366 fn visit_token_and_span(&mut self, node: &TokenAndSpan) {
367 <V as Visit>::visit_token_and_span(&mut **self, node)
368 }
369}
370impl<A, B> Visit for ::swc_visit::Either<A, B>
371where
372 A: Visit,
373 B: Visit,
374{
375 #[inline]
376 fn visit_atom(&mut self, node: &swc_atoms::Atom) {
377 match self {
378 swc_visit::Either::Left(visitor) => Visit::visit_atom(visitor, node),
379 swc_visit::Either::Right(visitor) => Visit::visit_atom(visitor, node),
380 }
381 }
382
383 #[inline]
384 fn visit_attribute(&mut self, node: &Attribute) {
385 match self {
386 swc_visit::Either::Left(visitor) => Visit::visit_attribute(visitor, node),
387 swc_visit::Either::Right(visitor) => Visit::visit_attribute(visitor, node),
388 }
389 }
390
391 #[inline]
392 fn visit_attribute_token(&mut self, node: &AttributeToken) {
393 match self {
394 swc_visit::Either::Left(visitor) => Visit::visit_attribute_token(visitor, node),
395 swc_visit::Either::Right(visitor) => Visit::visit_attribute_token(visitor, node),
396 }
397 }
398
399 #[inline]
400 fn visit_attribute_tokens(&mut self, node: &[AttributeToken]) {
401 match self {
402 swc_visit::Either::Left(visitor) => Visit::visit_attribute_tokens(visitor, node),
403 swc_visit::Either::Right(visitor) => Visit::visit_attribute_tokens(visitor, node),
404 }
405 }
406
407 #[inline]
408 fn visit_attributes(&mut self, node: &[Attribute]) {
409 match self {
410 swc_visit::Either::Left(visitor) => Visit::visit_attributes(visitor, node),
411 swc_visit::Either::Right(visitor) => Visit::visit_attributes(visitor, node),
412 }
413 }
414
415 #[inline]
416 fn visit_cdata_section(&mut self, node: &CdataSection) {
417 match self {
418 swc_visit::Either::Left(visitor) => Visit::visit_cdata_section(visitor, node),
419 swc_visit::Either::Right(visitor) => Visit::visit_cdata_section(visitor, node),
420 }
421 }
422
423 #[inline]
424 fn visit_child(&mut self, node: &Child) {
425 match self {
426 swc_visit::Either::Left(visitor) => Visit::visit_child(visitor, node),
427 swc_visit::Either::Right(visitor) => Visit::visit_child(visitor, node),
428 }
429 }
430
431 #[inline]
432 fn visit_childs(&mut self, node: &[Child]) {
433 match self {
434 swc_visit::Either::Left(visitor) => Visit::visit_childs(visitor, node),
435 swc_visit::Either::Right(visitor) => Visit::visit_childs(visitor, node),
436 }
437 }
438
439 #[inline]
440 fn visit_comment(&mut self, node: &Comment) {
441 match self {
442 swc_visit::Either::Left(visitor) => Visit::visit_comment(visitor, node),
443 swc_visit::Either::Right(visitor) => Visit::visit_comment(visitor, node),
444 }
445 }
446
447 #[inline]
448 fn visit_document(&mut self, node: &Document) {
449 match self {
450 swc_visit::Either::Left(visitor) => Visit::visit_document(visitor, node),
451 swc_visit::Either::Right(visitor) => Visit::visit_document(visitor, node),
452 }
453 }
454
455 #[inline]
456 fn visit_document_mode(&mut self, node: &DocumentMode) {
457 match self {
458 swc_visit::Either::Left(visitor) => Visit::visit_document_mode(visitor, node),
459 swc_visit::Either::Right(visitor) => Visit::visit_document_mode(visitor, node),
460 }
461 }
462
463 #[inline]
464 fn visit_document_type(&mut self, node: &DocumentType) {
465 match self {
466 swc_visit::Either::Left(visitor) => Visit::visit_document_type(visitor, node),
467 swc_visit::Either::Right(visitor) => Visit::visit_document_type(visitor, node),
468 }
469 }
470
471 #[inline]
472 fn visit_element(&mut self, node: &Element) {
473 match self {
474 swc_visit::Either::Left(visitor) => Visit::visit_element(visitor, node),
475 swc_visit::Either::Right(visitor) => Visit::visit_element(visitor, node),
476 }
477 }
478
479 #[inline]
480 fn visit_namespace(&mut self, node: &Namespace) {
481 match self {
482 swc_visit::Either::Left(visitor) => Visit::visit_namespace(visitor, node),
483 swc_visit::Either::Right(visitor) => Visit::visit_namespace(visitor, node),
484 }
485 }
486
487 #[inline]
488 fn visit_opt_atom(&mut self, node: &Option<swc_atoms::Atom>) {
489 match self {
490 swc_visit::Either::Left(visitor) => Visit::visit_opt_atom(visitor, node),
491 swc_visit::Either::Right(visitor) => Visit::visit_opt_atom(visitor, node),
492 }
493 }
494
495 #[inline]
496 fn visit_opt_namespace(&mut self, node: &Option<Namespace>) {
497 match self {
498 swc_visit::Either::Left(visitor) => Visit::visit_opt_namespace(visitor, node),
499 swc_visit::Either::Right(visitor) => Visit::visit_opt_namespace(visitor, node),
500 }
501 }
502
503 #[inline]
504 fn visit_processing_instruction(&mut self, node: &ProcessingInstruction) {
505 match self {
506 swc_visit::Either::Left(visitor) => Visit::visit_processing_instruction(visitor, node),
507 swc_visit::Either::Right(visitor) => Visit::visit_processing_instruction(visitor, node),
508 }
509 }
510
511 #[inline]
512 fn visit_span(&mut self, node: &swc_common::Span) {
513 match self {
514 swc_visit::Either::Left(visitor) => Visit::visit_span(visitor, node),
515 swc_visit::Either::Right(visitor) => Visit::visit_span(visitor, node),
516 }
517 }
518
519 #[inline]
520 fn visit_text(&mut self, node: &Text) {
521 match self {
522 swc_visit::Either::Left(visitor) => Visit::visit_text(visitor, node),
523 swc_visit::Either::Right(visitor) => Visit::visit_text(visitor, node),
524 }
525 }
526
527 #[inline]
528 fn visit_token(&mut self, node: &Token) {
529 match self {
530 swc_visit::Either::Left(visitor) => Visit::visit_token(visitor, node),
531 swc_visit::Either::Right(visitor) => Visit::visit_token(visitor, node),
532 }
533 }
534
535 #[inline]
536 fn visit_token_and_span(&mut self, node: &TokenAndSpan) {
537 match self {
538 swc_visit::Either::Left(visitor) => Visit::visit_token_and_span(visitor, node),
539 swc_visit::Either::Right(visitor) => Visit::visit_token_and_span(visitor, node),
540 }
541 }
542}
543impl<V> Visit for ::swc_visit::Optional<V>
544where
545 V: Visit,
546{
547 #[inline]
548 fn visit_atom(&mut self, node: &swc_atoms::Atom) {
549 if self.enabled {
550 <V as Visit>::visit_atom(&mut self.visitor, node)
551 } else {
552 }
553 }
554
555 #[inline]
556 fn visit_attribute(&mut self, node: &Attribute) {
557 if self.enabled {
558 <V as Visit>::visit_attribute(&mut self.visitor, node)
559 } else {
560 }
561 }
562
563 #[inline]
564 fn visit_attribute_token(&mut self, node: &AttributeToken) {
565 if self.enabled {
566 <V as Visit>::visit_attribute_token(&mut self.visitor, node)
567 } else {
568 }
569 }
570
571 #[inline]
572 fn visit_attribute_tokens(&mut self, node: &[AttributeToken]) {
573 if self.enabled {
574 <V as Visit>::visit_attribute_tokens(&mut self.visitor, node)
575 } else {
576 }
577 }
578
579 #[inline]
580 fn visit_attributes(&mut self, node: &[Attribute]) {
581 if self.enabled {
582 <V as Visit>::visit_attributes(&mut self.visitor, node)
583 } else {
584 }
585 }
586
587 #[inline]
588 fn visit_cdata_section(&mut self, node: &CdataSection) {
589 if self.enabled {
590 <V as Visit>::visit_cdata_section(&mut self.visitor, node)
591 } else {
592 }
593 }
594
595 #[inline]
596 fn visit_child(&mut self, node: &Child) {
597 if self.enabled {
598 <V as Visit>::visit_child(&mut self.visitor, node)
599 } else {
600 }
601 }
602
603 #[inline]
604 fn visit_childs(&mut self, node: &[Child]) {
605 if self.enabled {
606 <V as Visit>::visit_childs(&mut self.visitor, node)
607 } else {
608 }
609 }
610
611 #[inline]
612 fn visit_comment(&mut self, node: &Comment) {
613 if self.enabled {
614 <V as Visit>::visit_comment(&mut self.visitor, node)
615 } else {
616 }
617 }
618
619 #[inline]
620 fn visit_document(&mut self, node: &Document) {
621 if self.enabled {
622 <V as Visit>::visit_document(&mut self.visitor, node)
623 } else {
624 }
625 }
626
627 #[inline]
628 fn visit_document_mode(&mut self, node: &DocumentMode) {
629 if self.enabled {
630 <V as Visit>::visit_document_mode(&mut self.visitor, node)
631 } else {
632 }
633 }
634
635 #[inline]
636 fn visit_document_type(&mut self, node: &DocumentType) {
637 if self.enabled {
638 <V as Visit>::visit_document_type(&mut self.visitor, node)
639 } else {
640 }
641 }
642
643 #[inline]
644 fn visit_element(&mut self, node: &Element) {
645 if self.enabled {
646 <V as Visit>::visit_element(&mut self.visitor, node)
647 } else {
648 }
649 }
650
651 #[inline]
652 fn visit_namespace(&mut self, node: &Namespace) {
653 if self.enabled {
654 <V as Visit>::visit_namespace(&mut self.visitor, node)
655 } else {
656 }
657 }
658
659 #[inline]
660 fn visit_opt_atom(&mut self, node: &Option<swc_atoms::Atom>) {
661 if self.enabled {
662 <V as Visit>::visit_opt_atom(&mut self.visitor, node)
663 } else {
664 }
665 }
666
667 #[inline]
668 fn visit_opt_namespace(&mut self, node: &Option<Namespace>) {
669 if self.enabled {
670 <V as Visit>::visit_opt_namespace(&mut self.visitor, node)
671 } else {
672 }
673 }
674
675 #[inline]
676 fn visit_processing_instruction(&mut self, node: &ProcessingInstruction) {
677 if self.enabled {
678 <V as Visit>::visit_processing_instruction(&mut self.visitor, node)
679 } else {
680 }
681 }
682
683 #[inline]
684 fn visit_span(&mut self, node: &swc_common::Span) {
685 if self.enabled {
686 <V as Visit>::visit_span(&mut self.visitor, node)
687 } else {
688 }
689 }
690
691 #[inline]
692 fn visit_text(&mut self, node: &Text) {
693 if self.enabled {
694 <V as Visit>::visit_text(&mut self.visitor, node)
695 } else {
696 }
697 }
698
699 #[inline]
700 fn visit_token(&mut self, node: &Token) {
701 if self.enabled {
702 <V as Visit>::visit_token(&mut self.visitor, node)
703 } else {
704 }
705 }
706
707 #[inline]
708 fn visit_token_and_span(&mut self, node: &TokenAndSpan) {
709 if self.enabled {
710 <V as Visit>::visit_token_and_span(&mut self.visitor, node)
711 } else {
712 }
713 }
714}
715#[doc = r" A trait implemented for types that can be visited using a visitor."]
716pub trait VisitWith<V: ?Sized + Visit> {
717 #[doc = r" Calls a visitor method (visitor.fold_xxx) with self."]
718 fn visit_with(&self, visitor: &mut V);
719 #[doc = r" Visit children nodes of `self`` with `visitor`."]
720 fn visit_children_with(&self, visitor: &mut V);
721}
722impl<V: ?Sized + Visit> VisitWith<V> for Attribute {
723 #[doc = "Calls [Visit`::visit_attribute`] with `self`."]
724 fn visit_with(&self, visitor: &mut V) {
725 <V as Visit>::visit_attribute(visitor, self)
726 }
727
728 fn visit_children_with(&self, visitor: &mut V) {
729 match self {
730 Attribute {
731 span,
732 namespace,
733 prefix,
734 name,
735 raw_name,
736 value,
737 raw_value,
738 } => {
739 {
740 <swc_common::Span as VisitWith<V>>::visit_with(span, visitor)
741 };
742 {
743 <Option<Namespace> as VisitWith<V>>::visit_with(namespace, visitor)
744 };
745 {
746 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(prefix, visitor)
747 };
748 {
749 <swc_atoms::Atom as VisitWith<V>>::visit_with(name, visitor)
750 };
751 {
752 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(raw_name, visitor)
753 };
754 {
755 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(value, visitor)
756 };
757 {
758 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(raw_value, visitor)
759 };
760 }
761 }
762 }
763}
764impl<V: ?Sized + Visit> VisitWith<V> for AttributeToken {
765 #[doc = "Calls [Visit`::visit_attribute_token`] with `self`."]
766 fn visit_with(&self, visitor: &mut V) {
767 <V as Visit>::visit_attribute_token(visitor, self)
768 }
769
770 fn visit_children_with(&self, visitor: &mut V) {
771 match self {
772 AttributeToken {
773 span,
774 name,
775 raw_name,
776 value,
777 raw_value,
778 } => {
779 {
780 <swc_common::Span as VisitWith<V>>::visit_with(span, visitor)
781 };
782 {
783 <swc_atoms::Atom as VisitWith<V>>::visit_with(name, visitor)
784 };
785 {
786 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(raw_name, visitor)
787 };
788 {
789 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(value, visitor)
790 };
791 {
792 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(raw_value, visitor)
793 };
794 }
795 }
796 }
797}
798impl<V: ?Sized + Visit> VisitWith<V> for CdataSection {
799 #[doc = "Calls [Visit`::visit_cdata_section`] with `self`."]
800 fn visit_with(&self, visitor: &mut V) {
801 <V as Visit>::visit_cdata_section(visitor, self)
802 }
803
804 fn visit_children_with(&self, visitor: &mut V) {
805 match self {
806 CdataSection { span, data, raw } => {
807 {
808 <swc_common::Span as VisitWith<V>>::visit_with(span, visitor)
809 };
810 {
811 <swc_atoms::Atom as VisitWith<V>>::visit_with(data, visitor)
812 };
813 {
814 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(raw, visitor)
815 };
816 }
817 }
818 }
819}
820impl<V: ?Sized + Visit> VisitWith<V> for Child {
821 #[doc = "Calls [Visit`::visit_child`] with `self`."]
822 fn visit_with(&self, visitor: &mut V) {
823 <V as Visit>::visit_child(visitor, self)
824 }
825
826 fn visit_children_with(&self, visitor: &mut V) {
827 match self {
828 Child::DocumentType { 0: _field_0 } => {
829 <DocumentType as VisitWith<V>>::visit_with(_field_0, visitor);
830 }
831 Child::Element { 0: _field_0 } => {
832 <Element as VisitWith<V>>::visit_with(_field_0, visitor);
833 }
834 Child::Text { 0: _field_0 } => {
835 <Text as VisitWith<V>>::visit_with(_field_0, visitor);
836 }
837 Child::CdataSection { 0: _field_0 } => {
838 <CdataSection as VisitWith<V>>::visit_with(_field_0, visitor);
839 }
840 Child::Comment { 0: _field_0 } => {
841 <Comment as VisitWith<V>>::visit_with(_field_0, visitor);
842 }
843 Child::ProcessingInstruction { 0: _field_0 } => {
844 <ProcessingInstruction as VisitWith<V>>::visit_with(_field_0, visitor);
845 }
846 }
847 }
848}
849impl<V: ?Sized + Visit> VisitWith<V> for Comment {
850 #[doc = "Calls [Visit`::visit_comment`] with `self`."]
851 fn visit_with(&self, visitor: &mut V) {
852 <V as Visit>::visit_comment(visitor, self)
853 }
854
855 fn visit_children_with(&self, visitor: &mut V) {
856 match self {
857 Comment { span, data, raw } => {
858 {
859 <swc_common::Span as VisitWith<V>>::visit_with(span, visitor)
860 };
861 {
862 <swc_atoms::Atom as VisitWith<V>>::visit_with(data, visitor)
863 };
864 {
865 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(raw, visitor)
866 };
867 }
868 }
869 }
870}
871impl<V: ?Sized + Visit> VisitWith<V> for Document {
872 #[doc = "Calls [Visit`::visit_document`] with `self`."]
873 fn visit_with(&self, visitor: &mut V) {
874 <V as Visit>::visit_document(visitor, self)
875 }
876
877 fn visit_children_with(&self, visitor: &mut V) {
878 match self {
879 Document { span, children } => {
880 {
881 <swc_common::Span as VisitWith<V>>::visit_with(span, visitor)
882 };
883 {
884 <Vec<Child> as VisitWith<V>>::visit_with(children, visitor)
885 };
886 }
887 }
888 }
889}
890impl<V: ?Sized + Visit> VisitWith<V> for DocumentMode {
891 #[doc = "Calls [Visit`::visit_document_mode`] with `self`."]
892 fn visit_with(&self, visitor: &mut V) {
893 <V as Visit>::visit_document_mode(visitor, self)
894 }
895
896 fn visit_children_with(&self, visitor: &mut V) {
897 match self {
898 DocumentMode::NoQuirks => {}
899 DocumentMode::LimitedQuirks => {}
900 DocumentMode::Quirks => {}
901 }
902 }
903}
904impl<V: ?Sized + Visit> VisitWith<V> for DocumentType {
905 #[doc = "Calls [Visit`::visit_document_type`] with `self`."]
906 fn visit_with(&self, visitor: &mut V) {
907 <V as Visit>::visit_document_type(visitor, self)
908 }
909
910 fn visit_children_with(&self, visitor: &mut V) {
911 match self {
912 DocumentType {
913 span,
914 name,
915 public_id,
916 system_id,
917 raw,
918 } => {
919 {
920 <swc_common::Span as VisitWith<V>>::visit_with(span, visitor)
921 };
922 {
923 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(name, visitor)
924 };
925 {
926 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(public_id, visitor)
927 };
928 {
929 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(system_id, visitor)
930 };
931 {
932 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(raw, visitor)
933 };
934 }
935 }
936 }
937}
938impl<V: ?Sized + Visit> VisitWith<V> for Element {
939 #[doc = "Calls [Visit`::visit_element`] with `self`."]
940 fn visit_with(&self, visitor: &mut V) {
941 <V as Visit>::visit_element(visitor, self)
942 }
943
944 fn visit_children_with(&self, visitor: &mut V) {
945 match self {
946 Element {
947 span,
948 tag_name,
949 attributes,
950 children,
951 } => {
952 {
953 <swc_common::Span as VisitWith<V>>::visit_with(span, visitor)
954 };
955 {
956 <swc_atoms::Atom as VisitWith<V>>::visit_with(tag_name, visitor)
957 };
958 {
959 <Vec<Attribute> as VisitWith<V>>::visit_with(attributes, visitor)
960 };
961 {
962 <Vec<Child> as VisitWith<V>>::visit_with(children, visitor)
963 };
964 }
965 }
966 }
967}
968impl<V: ?Sized + Visit> VisitWith<V> for Namespace {
969 #[doc = "Calls [Visit`::visit_namespace`] with `self`."]
970 fn visit_with(&self, visitor: &mut V) {
971 <V as Visit>::visit_namespace(visitor, self)
972 }
973
974 fn visit_children_with(&self, visitor: &mut V) {
975 match self {
976 Namespace::HTML => {}
977 Namespace::MATHML => {}
978 Namespace::SVG => {}
979 Namespace::XLINK => {}
980 Namespace::XML => {}
981 Namespace::XMLNS => {}
982 }
983 }
984}
985impl<V: ?Sized + Visit> VisitWith<V> for ProcessingInstruction {
986 #[doc = "Calls [Visit`::visit_processing_instruction`] with `self`."]
987 fn visit_with(&self, visitor: &mut V) {
988 <V as Visit>::visit_processing_instruction(visitor, self)
989 }
990
991 fn visit_children_with(&self, visitor: &mut V) {
992 match self {
993 ProcessingInstruction { span, target, data } => {
994 {
995 <swc_common::Span as VisitWith<V>>::visit_with(span, visitor)
996 };
997 {
998 <swc_atoms::Atom as VisitWith<V>>::visit_with(target, visitor)
999 };
1000 {
1001 <swc_atoms::Atom as VisitWith<V>>::visit_with(data, visitor)
1002 };
1003 }
1004 }
1005 }
1006}
1007impl<V: ?Sized + Visit> VisitWith<V> for Text {
1008 #[doc = "Calls [Visit`::visit_text`] with `self`."]
1009 fn visit_with(&self, visitor: &mut V) {
1010 <V as Visit>::visit_text(visitor, self)
1011 }
1012
1013 fn visit_children_with(&self, visitor: &mut V) {
1014 match self {
1015 Text { span, data, raw } => {
1016 {
1017 <swc_common::Span as VisitWith<V>>::visit_with(span, visitor)
1018 };
1019 {
1020 <swc_atoms::Atom as VisitWith<V>>::visit_with(data, visitor)
1021 };
1022 {
1023 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(raw, visitor)
1024 };
1025 }
1026 }
1027 }
1028}
1029impl<V: ?Sized + Visit> VisitWith<V> for Token {
1030 #[doc = "Calls [Visit`::visit_token`] with `self`."]
1031 fn visit_with(&self, visitor: &mut V) {
1032 <V as Visit>::visit_token(visitor, self)
1033 }
1034
1035 fn visit_children_with(&self, visitor: &mut V) {
1036 match self {
1037 Token::Doctype {
1038 name,
1039 public_id,
1040 system_id,
1041 raw,
1042 } => {
1043 {
1044 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(name, visitor)
1045 };
1046 {
1047 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(public_id, visitor)
1048 };
1049 {
1050 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(system_id, visitor)
1051 };
1052 {
1053 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(raw, visitor)
1054 };
1055 }
1056 Token::StartTag {
1057 tag_name,
1058 attributes,
1059 } => {
1060 {
1061 <swc_atoms::Atom as VisitWith<V>>::visit_with(tag_name, visitor)
1062 };
1063 {
1064 <Vec<AttributeToken> as VisitWith<V>>::visit_with(attributes, visitor)
1065 };
1066 }
1067 Token::EndTag {
1068 tag_name,
1069 attributes,
1070 } => {
1071 {
1072 <swc_atoms::Atom as VisitWith<V>>::visit_with(tag_name, visitor)
1073 };
1074 {
1075 <Vec<AttributeToken> as VisitWith<V>>::visit_with(attributes, visitor)
1076 };
1077 }
1078 Token::EmptyTag {
1079 tag_name,
1080 attributes,
1081 } => {
1082 {
1083 <swc_atoms::Atom as VisitWith<V>>::visit_with(tag_name, visitor)
1084 };
1085 {
1086 <Vec<AttributeToken> as VisitWith<V>>::visit_with(attributes, visitor)
1087 };
1088 }
1089 Token::Comment { data, raw } => {
1090 {
1091 <swc_atoms::Atom as VisitWith<V>>::visit_with(data, visitor)
1092 };
1093 {
1094 <swc_atoms::Atom as VisitWith<V>>::visit_with(raw, visitor)
1095 };
1096 }
1097 Token::Character { value, raw } => {
1098 {
1099 <Option<swc_atoms::Atom> as VisitWith<V>>::visit_with(raw, visitor)
1100 };
1101 }
1102 Token::ProcessingInstruction { target, data } => {
1103 {
1104 <swc_atoms::Atom as VisitWith<V>>::visit_with(target, visitor)
1105 };
1106 {
1107 <swc_atoms::Atom as VisitWith<V>>::visit_with(data, visitor)
1108 };
1109 }
1110 Token::Cdata { data, raw } => {
1111 {
1112 <swc_atoms::Atom as VisitWith<V>>::visit_with(data, visitor)
1113 };
1114 {
1115 <swc_atoms::Atom as VisitWith<V>>::visit_with(raw, visitor)
1116 };
1117 }
1118 Token::Eof => {}
1119 }
1120 }
1121}
1122impl<V: ?Sized + Visit> VisitWith<V> for TokenAndSpan {
1123 #[doc = "Calls [Visit`::visit_token_and_span`] with `self`."]
1124 fn visit_with(&self, visitor: &mut V) {
1125 <V as Visit>::visit_token_and_span(visitor, self)
1126 }
1127
1128 fn visit_children_with(&self, visitor: &mut V) {
1129 match self {
1130 TokenAndSpan { span, token } => {
1131 {
1132 <swc_common::Span as VisitWith<V>>::visit_with(span, visitor)
1133 };
1134 {
1135 <Token as VisitWith<V>>::visit_with(token, visitor)
1136 };
1137 }
1138 }
1139 }
1140}
1141impl<V: ?Sized + Visit> VisitWith<V> for swc_atoms::Atom {
1142 #[doc = "Calls [Visit`::visit_atom`] with `self`. (Extra impl)"]
1143 #[inline]
1144 fn visit_with(&self, visitor: &mut V) {
1145 <V as Visit>::visit_atom(visitor, self)
1146 }
1147
1148 #[inline]
1149 fn visit_children_with(&self, visitor: &mut V) {
1150 {}
1151 }
1152}
1153impl<V: ?Sized + Visit> VisitWith<V> for [AttributeToken] {
1154 #[doc = "Calls [Visit`::visit_attribute_tokens`] with `self`. (Extra impl)"]
1155 #[inline]
1156 fn visit_with(&self, visitor: &mut V) {
1157 <V as Visit>::visit_attribute_tokens(visitor, self)
1158 }
1159
1160 #[inline]
1161 fn visit_children_with(&self, visitor: &mut V) {
1162 self.iter()
1163 .for_each(|item| <AttributeToken as VisitWith<V>>::visit_with(item, visitor))
1164 }
1165}
1166impl<V: ?Sized + Visit> VisitWith<V> for [Attribute] {
1167 #[doc = "Calls [Visit`::visit_attributes`] with `self`. (Extra impl)"]
1168 #[inline]
1169 fn visit_with(&self, visitor: &mut V) {
1170 <V as Visit>::visit_attributes(visitor, self)
1171 }
1172
1173 #[inline]
1174 fn visit_children_with(&self, visitor: &mut V) {
1175 self.iter()
1176 .for_each(|item| <Attribute as VisitWith<V>>::visit_with(item, visitor))
1177 }
1178}
1179impl<V: ?Sized + Visit> VisitWith<V> for [Child] {
1180 #[doc = "Calls [Visit`::visit_childs`] with `self`. (Extra impl)"]
1181 #[inline]
1182 fn visit_with(&self, visitor: &mut V) {
1183 <V as Visit>::visit_childs(visitor, self)
1184 }
1185
1186 #[inline]
1187 fn visit_children_with(&self, visitor: &mut V) {
1188 self.iter()
1189 .for_each(|item| <Child as VisitWith<V>>::visit_with(item, visitor))
1190 }
1191}
1192impl<V: ?Sized + Visit> VisitWith<V> for Option<swc_atoms::Atom> {
1193 #[doc = "Calls [Visit`::visit_opt_atom`] with `self`. (Extra impl)"]
1194 #[inline]
1195 fn visit_with(&self, visitor: &mut V) {
1196 <V as Visit>::visit_opt_atom(visitor, self)
1197 }
1198
1199 #[inline]
1200 fn visit_children_with(&self, visitor: &mut V) {
1201 match self {
1202 Some(inner) => <swc_atoms::Atom as VisitWith<V>>::visit_with(inner, visitor),
1203 None => {}
1204 }
1205 }
1206}
1207impl<V: ?Sized + Visit> VisitWith<V> for Option<Namespace> {
1208 #[doc = "Calls [Visit`::visit_opt_namespace`] with `self`. (Extra impl)"]
1209 #[inline]
1210 fn visit_with(&self, visitor: &mut V) {
1211 <V as Visit>::visit_opt_namespace(visitor, self)
1212 }
1213
1214 #[inline]
1215 fn visit_children_with(&self, visitor: &mut V) {
1216 match self {
1217 Some(inner) => <Namespace as VisitWith<V>>::visit_with(inner, visitor),
1218 None => {}
1219 }
1220 }
1221}
1222impl<V: ?Sized + Visit> VisitWith<V> for swc_common::Span {
1223 #[doc = "Calls [Visit`::visit_span`] with `self`. (Extra impl)"]
1224 #[inline]
1225 fn visit_with(&self, visitor: &mut V) {
1226 <V as Visit>::visit_span(visitor, self)
1227 }
1228
1229 #[inline]
1230 fn visit_children_with(&self, visitor: &mut V) {
1231 {}
1232 }
1233}
1234impl<V, T> VisitWith<V> for std::boxed::Box<T>
1235where
1236 V: ?Sized + Visit,
1237 T: VisitWith<V>,
1238{
1239 #[inline]
1240 fn visit_with(&self, visitor: &mut V) {
1241 let v = <T as VisitWith<V>>::visit_with(&**self, visitor);
1242 v
1243 }
1244
1245 #[inline]
1246 fn visit_children_with(&self, visitor: &mut V) {
1247 let v = <T as VisitWith<V>>::visit_children_with(&**self, visitor);
1248 v
1249 }
1250}
1251impl<V, T> VisitWith<V> for std::vec::Vec<T>
1252where
1253 V: ?Sized + Visit,
1254 [T]: VisitWith<V>,
1255{
1256 #[inline]
1257 fn visit_with(&self, visitor: &mut V) {
1258 let v = <[T] as VisitWith<V>>::visit_with(self, visitor);
1259 v
1260 }
1261
1262 #[inline]
1263 fn visit_children_with(&self, visitor: &mut V) {
1264 let v = <[T] as VisitWith<V>>::visit_children_with(self, visitor);
1265 v
1266 }
1267}
1268#[doc = r" A visitor trait for traversing the AST."]
1269#[cfg(any(docsrs, feature = "path"))]
1270#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
1271pub trait VisitAstPath {
1272 #[doc = "Visit a node of type `swc_atoms :: Atom`.\n\nBy default, this method calls \
1273 [`swc_atoms :: Atom::visit_children_with_ast_path`]. If you want to recurse, you need \
1274 to call it manually."]
1275 #[inline]
1276 fn visit_atom<'ast: 'r, 'r>(
1277 &mut self,
1278 node: &'ast swc_atoms::Atom,
1279 __ast_path: &mut AstNodePath<'r>,
1280 ) {
1281 <swc_atoms::Atom as VisitWithAstPath<Self>>::visit_children_with_ast_path(
1282 node, self, __ast_path,
1283 )
1284 }
1285 #[doc = "Visit a node of type `Attribute`.\n\nBy default, this method calls \
1286 [`Attribute::visit_children_with_ast_path`]. If you want to recurse, you need to call \
1287 it manually."]
1288 #[inline]
1289 fn visit_attribute<'ast: 'r, 'r>(
1290 &mut self,
1291 node: &'ast Attribute,
1292 __ast_path: &mut AstNodePath<'r>,
1293 ) {
1294 <Attribute as VisitWithAstPath<Self>>::visit_children_with_ast_path(node, self, __ast_path)
1295 }
1296 #[doc = "Visit a node of type `AttributeToken`.\n\nBy default, this method calls \
1297 [`AttributeToken::visit_children_with_ast_path`]. If you want to recurse, you need to \
1298 call it manually."]
1299 #[inline]
1300 fn visit_attribute_token<'ast: 'r, 'r>(
1301 &mut self,
1302 node: &'ast AttributeToken,
1303 __ast_path: &mut AstNodePath<'r>,
1304 ) {
1305 <AttributeToken as VisitWithAstPath<Self>>::visit_children_with_ast_path(
1306 node, self, __ast_path,
1307 )
1308 }
1309 #[doc = "Visit a node of type `Vec < AttributeToken >`.\n\nBy default, this method calls [`Vec \
1310 < AttributeToken >::visit_children_with_ast_path`]. If you want to recurse, you need \
1311 to call it manually."]
1312 #[inline]
1313 fn visit_attribute_tokens<'ast: 'r, 'r>(
1314 &mut self,
1315 node: &'ast [AttributeToken],
1316 __ast_path: &mut AstNodePath<'r>,
1317 ) {
1318 <[AttributeToken] as VisitWithAstPath<Self>>::visit_children_with_ast_path(
1319 node, self, __ast_path,
1320 )
1321 }
1322 #[doc = "Visit a node of type `Vec < Attribute >`.\n\nBy default, this method calls [`Vec < \
1323 Attribute >::visit_children_with_ast_path`]. If you want to recurse, you need to call \
1324 it manually."]
1325 #[inline]
1326 fn visit_attributes<'ast: 'r, 'r>(
1327 &mut self,
1328 node: &'ast [Attribute],
1329 __ast_path: &mut AstNodePath<'r>,
1330 ) {
1331 <[Attribute] as VisitWithAstPath<Self>>::visit_children_with_ast_path(
1332 node, self, __ast_path,
1333 )
1334 }
1335 #[doc = "Visit a node of type `CdataSection`.\n\nBy default, this method calls \
1336 [`CdataSection::visit_children_with_ast_path`]. If you want to recurse, you need to \
1337 call it manually."]
1338 #[inline]
1339 fn visit_cdata_section<'ast: 'r, 'r>(
1340 &mut self,
1341 node: &'ast CdataSection,
1342 __ast_path: &mut AstNodePath<'r>,
1343 ) {
1344 <CdataSection as VisitWithAstPath<Self>>::visit_children_with_ast_path(
1345 node, self, __ast_path,
1346 )
1347 }
1348 #[doc = "Visit a node of type `Child`.\n\nBy default, this method calls \
1349 [`Child::visit_children_with_ast_path`]. If you want to recurse, you need to call it \
1350 manually."]
1351 #[inline]
1352 fn visit_child<'ast: 'r, 'r>(&mut self, node: &'ast Child, __ast_path: &mut AstNodePath<'r>) {
1353 <Child as VisitWithAstPath<Self>>::visit_children_with_ast_path(node, self, __ast_path)
1354 }
1355 #[doc = "Visit a node of type `Vec < Child >`.\n\nBy default, this method calls [`Vec < Child \
1356 >::visit_children_with_ast_path`]. If you want to recurse, you need to call it \
1357 manually."]
1358 #[inline]
1359 fn visit_childs<'ast: 'r, 'r>(
1360 &mut self,
1361 node: &'ast [Child],
1362 __ast_path: &mut AstNodePath<'r>,
1363 ) {
1364 <[Child] as VisitWithAstPath<Self>>::visit_children_with_ast_path(node, self, __ast_path)
1365 }
1366 #[doc = "Visit a node of type `Comment`.\n\nBy default, this method calls \
1367 [`Comment::visit_children_with_ast_path`]. If you want to recurse, you need to call \
1368 it manually."]
1369 #[inline]
1370 fn visit_comment<'ast: 'r, 'r>(
1371 &mut self,
1372 node: &'ast Comment,
1373 __ast_path: &mut AstNodePath<'r>,
1374 ) {
1375 <Comment as VisitWithAstPath<Self>>::visit_children_with_ast_path(node, self, __ast_path)
1376 }
1377 #[doc = "Visit a node of type `Document`.\n\nBy default, this method calls \
1378 [`Document::visit_children_with_ast_path`]. If you want to recurse, you need to call \
1379 it manually."]
1380 #[inline]
1381 fn visit_document<'ast: 'r, 'r>(
1382 &mut self,
1383 node: &'ast Document,
1384 __ast_path: &mut AstNodePath<'r>,
1385 ) {
1386 <Document as VisitWithAstPath<Self>>::visit_children_with_ast_path(node, self, __ast_path)
1387 }
1388 #[doc = "Visit a node of type `DocumentMode`.\n\nBy default, this method calls \
1389 [`DocumentMode::visit_children_with_ast_path`]. If you want to recurse, you need to \
1390 call it manually."]
1391 #[inline]
1392 fn visit_document_mode<'ast: 'r, 'r>(
1393 &mut self,
1394 node: &'ast DocumentMode,
1395 __ast_path: &mut AstNodePath<'r>,
1396 ) {
1397 <DocumentMode as VisitWithAstPath<Self>>::visit_children_with_ast_path(
1398 node, self, __ast_path,
1399 )
1400 }
1401 #[doc = "Visit a node of type `DocumentType`.\n\nBy default, this method calls \
1402 [`DocumentType::visit_children_with_ast_path`]. If you want to recurse, you need to \
1403 call it manually."]
1404 #[inline]
1405 fn visit_document_type<'ast: 'r, 'r>(
1406 &mut self,
1407 node: &'ast DocumentType,
1408 __ast_path: &mut AstNodePath<'r>,
1409 ) {
1410 <DocumentType as VisitWithAstPath<Self>>::visit_children_with_ast_path(
1411 node, self, __ast_path,
1412 )
1413 }
1414 #[doc = "Visit a node of type `Element`.\n\nBy default, this method calls \
1415 [`Element::visit_children_with_ast_path`]. If you want to recurse, you need to call \
1416 it manually."]
1417 #[inline]
1418 fn visit_element<'ast: 'r, 'r>(
1419 &mut self,
1420 node: &'ast Element,
1421 __ast_path: &mut AstNodePath<'r>,
1422 ) {
1423 <Element as VisitWithAstPath<Self>>::visit_children_with_ast_path(node, self, __ast_path)
1424 }
1425 #[doc = "Visit a node of type `Namespace`.\n\nBy default, this method calls \
1426 [`Namespace::visit_children_with_ast_path`]. If you want to recurse, you need to call \
1427 it manually."]
1428 #[inline]
1429 fn visit_namespace<'ast: 'r, 'r>(
1430 &mut self,
1431 node: &'ast Namespace,
1432 __ast_path: &mut AstNodePath<'r>,
1433 ) {
1434 <Namespace as VisitWithAstPath<Self>>::visit_children_with_ast_path(node, self, __ast_path)
1435 }
1436 #[doc = "Visit a node of type `Option < swc_atoms :: Atom >`.\n\nBy default, this method calls \
1437 [`Option < swc_atoms :: Atom >::visit_children_with_ast_path`]. If you want to \
1438 recurse, you need to call it manually."]
1439 #[inline]
1440 fn visit_opt_atom<'ast: 'r, 'r>(
1441 &mut self,
1442 node: &'ast Option<swc_atoms::Atom>,
1443 __ast_path: &mut AstNodePath<'r>,
1444 ) {
1445 <Option<swc_atoms::Atom> as VisitWithAstPath<Self>>::visit_children_with_ast_path(
1446 node, self, __ast_path,
1447 )
1448 }
1449 #[doc = "Visit a node of type `Option < Namespace >`.\n\nBy default, this method calls \
1450 [`Option < Namespace >::visit_children_with_ast_path`]. If you want to recurse, you \
1451 need to call it manually."]
1452 #[inline]
1453 fn visit_opt_namespace<'ast: 'r, 'r>(
1454 &mut self,
1455 node: &'ast Option<Namespace>,
1456 __ast_path: &mut AstNodePath<'r>,
1457 ) {
1458 <Option<Namespace> as VisitWithAstPath<Self>>::visit_children_with_ast_path(
1459 node, self, __ast_path,
1460 )
1461 }
1462 #[doc = "Visit a node of type `ProcessingInstruction`.\n\nBy default, this method calls \
1463 [`ProcessingInstruction::visit_children_with_ast_path`]. If you want to recurse, you \
1464 need to call it manually."]
1465 #[inline]
1466 fn visit_processing_instruction<'ast: 'r, 'r>(
1467 &mut self,
1468 node: &'ast ProcessingInstruction,
1469 __ast_path: &mut AstNodePath<'r>,
1470 ) {
1471 <ProcessingInstruction as VisitWithAstPath<Self>>::visit_children_with_ast_path(
1472 node, self, __ast_path,
1473 )
1474 }
1475 #[doc = "Visit a node of type `swc_common :: Span`.\n\nBy default, this method calls \
1476 [`swc_common :: Span::visit_children_with_ast_path`]. If you want to recurse, you \
1477 need to call it manually."]
1478 #[inline]
1479 fn visit_span<'ast: 'r, 'r>(
1480 &mut self,
1481 node: &'ast swc_common::Span,
1482 __ast_path: &mut AstNodePath<'r>,
1483 ) {
1484 <swc_common::Span as VisitWithAstPath<Self>>::visit_children_with_ast_path(
1485 node, self, __ast_path,
1486 )
1487 }
1488 #[doc = "Visit a node of type `Text`.\n\nBy default, this method calls \
1489 [`Text::visit_children_with_ast_path`]. If you want to recurse, you need to call it \
1490 manually."]
1491 #[inline]
1492 fn visit_text<'ast: 'r, 'r>(&mut self, node: &'ast Text, __ast_path: &mut AstNodePath<'r>) {
1493 <Text as VisitWithAstPath<Self>>::visit_children_with_ast_path(node, self, __ast_path)
1494 }
1495 #[doc = "Visit a node of type `Token`.\n\nBy default, this method calls \
1496 [`Token::visit_children_with_ast_path`]. If you want to recurse, you need to call it \
1497 manually."]
1498 #[inline]
1499 fn visit_token<'ast: 'r, 'r>(&mut self, node: &'ast Token, __ast_path: &mut AstNodePath<'r>) {
1500 <Token as VisitWithAstPath<Self>>::visit_children_with_ast_path(node, self, __ast_path)
1501 }
1502 #[doc = "Visit a node of type `TokenAndSpan`.\n\nBy default, this method calls \
1503 [`TokenAndSpan::visit_children_with_ast_path`]. If you want to recurse, you need to \
1504 call it manually."]
1505 #[inline]
1506 fn visit_token_and_span<'ast: 'r, 'r>(
1507 &mut self,
1508 node: &'ast TokenAndSpan,
1509 __ast_path: &mut AstNodePath<'r>,
1510 ) {
1511 <TokenAndSpan as VisitWithAstPath<Self>>::visit_children_with_ast_path(
1512 node, self, __ast_path,
1513 )
1514 }
1515}
1516#[cfg(any(docsrs, feature = "path"))]
1517#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
1518impl<V> VisitAstPath for &mut V
1519where
1520 V: ?Sized + VisitAstPath,
1521{
1522 #[inline]
1523 fn visit_atom<'ast: 'r, 'r>(
1524 &mut self,
1525 node: &'ast swc_atoms::Atom,
1526 __ast_path: &mut AstNodePath<'r>,
1527 ) {
1528 <V as VisitAstPath>::visit_atom(&mut **self, node, __ast_path)
1529 }
1530
1531 #[inline]
1532 fn visit_attribute<'ast: 'r, 'r>(
1533 &mut self,
1534 node: &'ast Attribute,
1535 __ast_path: &mut AstNodePath<'r>,
1536 ) {
1537 <V as VisitAstPath>::visit_attribute(&mut **self, node, __ast_path)
1538 }
1539
1540 #[inline]
1541 fn visit_attribute_token<'ast: 'r, 'r>(
1542 &mut self,
1543 node: &'ast AttributeToken,
1544 __ast_path: &mut AstNodePath<'r>,
1545 ) {
1546 <V as VisitAstPath>::visit_attribute_token(&mut **self, node, __ast_path)
1547 }
1548
1549 #[inline]
1550 fn visit_attribute_tokens<'ast: 'r, 'r>(
1551 &mut self,
1552 node: &'ast [AttributeToken],
1553 __ast_path: &mut AstNodePath<'r>,
1554 ) {
1555 <V as VisitAstPath>::visit_attribute_tokens(&mut **self, node, __ast_path)
1556 }
1557
1558 #[inline]
1559 fn visit_attributes<'ast: 'r, 'r>(
1560 &mut self,
1561 node: &'ast [Attribute],
1562 __ast_path: &mut AstNodePath<'r>,
1563 ) {
1564 <V as VisitAstPath>::visit_attributes(&mut **self, node, __ast_path)
1565 }
1566
1567 #[inline]
1568 fn visit_cdata_section<'ast: 'r, 'r>(
1569 &mut self,
1570 node: &'ast CdataSection,
1571 __ast_path: &mut AstNodePath<'r>,
1572 ) {
1573 <V as VisitAstPath>::visit_cdata_section(&mut **self, node, __ast_path)
1574 }
1575
1576 #[inline]
1577 fn visit_child<'ast: 'r, 'r>(&mut self, node: &'ast Child, __ast_path: &mut AstNodePath<'r>) {
1578 <V as VisitAstPath>::visit_child(&mut **self, node, __ast_path)
1579 }
1580
1581 #[inline]
1582 fn visit_childs<'ast: 'r, 'r>(
1583 &mut self,
1584 node: &'ast [Child],
1585 __ast_path: &mut AstNodePath<'r>,
1586 ) {
1587 <V as VisitAstPath>::visit_childs(&mut **self, node, __ast_path)
1588 }
1589
1590 #[inline]
1591 fn visit_comment<'ast: 'r, 'r>(
1592 &mut self,
1593 node: &'ast Comment,
1594 __ast_path: &mut AstNodePath<'r>,
1595 ) {
1596 <V as VisitAstPath>::visit_comment(&mut **self, node, __ast_path)
1597 }
1598
1599 #[inline]
1600 fn visit_document<'ast: 'r, 'r>(
1601 &mut self,
1602 node: &'ast Document,
1603 __ast_path: &mut AstNodePath<'r>,
1604 ) {
1605 <V as VisitAstPath>::visit_document(&mut **self, node, __ast_path)
1606 }
1607
1608 #[inline]
1609 fn visit_document_mode<'ast: 'r, 'r>(
1610 &mut self,
1611 node: &'ast DocumentMode,
1612 __ast_path: &mut AstNodePath<'r>,
1613 ) {
1614 <V as VisitAstPath>::visit_document_mode(&mut **self, node, __ast_path)
1615 }
1616
1617 #[inline]
1618 fn visit_document_type<'ast: 'r, 'r>(
1619 &mut self,
1620 node: &'ast DocumentType,
1621 __ast_path: &mut AstNodePath<'r>,
1622 ) {
1623 <V as VisitAstPath>::visit_document_type(&mut **self, node, __ast_path)
1624 }
1625
1626 #[inline]
1627 fn visit_element<'ast: 'r, 'r>(
1628 &mut self,
1629 node: &'ast Element,
1630 __ast_path: &mut AstNodePath<'r>,
1631 ) {
1632 <V as VisitAstPath>::visit_element(&mut **self, node, __ast_path)
1633 }
1634
1635 #[inline]
1636 fn visit_namespace<'ast: 'r, 'r>(
1637 &mut self,
1638 node: &'ast Namespace,
1639 __ast_path: &mut AstNodePath<'r>,
1640 ) {
1641 <V as VisitAstPath>::visit_namespace(&mut **self, node, __ast_path)
1642 }
1643
1644 #[inline]
1645 fn visit_opt_atom<'ast: 'r, 'r>(
1646 &mut self,
1647 node: &'ast Option<swc_atoms::Atom>,
1648 __ast_path: &mut AstNodePath<'r>,
1649 ) {
1650 <V as VisitAstPath>::visit_opt_atom(&mut **self, node, __ast_path)
1651 }
1652
1653 #[inline]
1654 fn visit_opt_namespace<'ast: 'r, 'r>(
1655 &mut self,
1656 node: &'ast Option<Namespace>,
1657 __ast_path: &mut AstNodePath<'r>,
1658 ) {
1659 <V as VisitAstPath>::visit_opt_namespace(&mut **self, node, __ast_path)
1660 }
1661
1662 #[inline]
1663 fn visit_processing_instruction<'ast: 'r, 'r>(
1664 &mut self,
1665 node: &'ast ProcessingInstruction,
1666 __ast_path: &mut AstNodePath<'r>,
1667 ) {
1668 <V as VisitAstPath>::visit_processing_instruction(&mut **self, node, __ast_path)
1669 }
1670
1671 #[inline]
1672 fn visit_span<'ast: 'r, 'r>(
1673 &mut self,
1674 node: &'ast swc_common::Span,
1675 __ast_path: &mut AstNodePath<'r>,
1676 ) {
1677 <V as VisitAstPath>::visit_span(&mut **self, node, __ast_path)
1678 }
1679
1680 #[inline]
1681 fn visit_text<'ast: 'r, 'r>(&mut self, node: &'ast Text, __ast_path: &mut AstNodePath<'r>) {
1682 <V as VisitAstPath>::visit_text(&mut **self, node, __ast_path)
1683 }
1684
1685 #[inline]
1686 fn visit_token<'ast: 'r, 'r>(&mut self, node: &'ast Token, __ast_path: &mut AstNodePath<'r>) {
1687 <V as VisitAstPath>::visit_token(&mut **self, node, __ast_path)
1688 }
1689
1690 #[inline]
1691 fn visit_token_and_span<'ast: 'r, 'r>(
1692 &mut self,
1693 node: &'ast TokenAndSpan,
1694 __ast_path: &mut AstNodePath<'r>,
1695 ) {
1696 <V as VisitAstPath>::visit_token_and_span(&mut **self, node, __ast_path)
1697 }
1698}
1699#[cfg(any(docsrs, feature = "path"))]
1700#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
1701impl<V> VisitAstPath for Box<V>
1702where
1703 V: ?Sized + VisitAstPath,
1704{
1705 #[inline]
1706 fn visit_atom<'ast: 'r, 'r>(
1707 &mut self,
1708 node: &'ast swc_atoms::Atom,
1709 __ast_path: &mut AstNodePath<'r>,
1710 ) {
1711 <V as VisitAstPath>::visit_atom(&mut **self, node, __ast_path)
1712 }
1713
1714 #[inline]
1715 fn visit_attribute<'ast: 'r, 'r>(
1716 &mut self,
1717 node: &'ast Attribute,
1718 __ast_path: &mut AstNodePath<'r>,
1719 ) {
1720 <V as VisitAstPath>::visit_attribute(&mut **self, node, __ast_path)
1721 }
1722
1723 #[inline]
1724 fn visit_attribute_token<'ast: 'r, 'r>(
1725 &mut self,
1726 node: &'ast AttributeToken,
1727 __ast_path: &mut AstNodePath<'r>,
1728 ) {
1729 <V as VisitAstPath>::visit_attribute_token(&mut **self, node, __ast_path)
1730 }
1731
1732 #[inline]
1733 fn visit_attribute_tokens<'ast: 'r, 'r>(
1734 &mut self,
1735 node: &'ast [AttributeToken],
1736 __ast_path: &mut AstNodePath<'r>,
1737 ) {
1738 <V as VisitAstPath>::visit_attribute_tokens(&mut **self, node, __ast_path)
1739 }
1740
1741 #[inline]
1742 fn visit_attributes<'ast: 'r, 'r>(
1743 &mut self,
1744 node: &'ast [Attribute],
1745 __ast_path: &mut AstNodePath<'r>,
1746 ) {
1747 <V as VisitAstPath>::visit_attributes(&mut **self, node, __ast_path)
1748 }
1749
1750 #[inline]
1751 fn visit_cdata_section<'ast: 'r, 'r>(
1752 &mut self,
1753 node: &'ast CdataSection,
1754 __ast_path: &mut AstNodePath<'r>,
1755 ) {
1756 <V as VisitAstPath>::visit_cdata_section(&mut **self, node, __ast_path)
1757 }
1758
1759 #[inline]
1760 fn visit_child<'ast: 'r, 'r>(&mut self, node: &'ast Child, __ast_path: &mut AstNodePath<'r>) {
1761 <V as VisitAstPath>::visit_child(&mut **self, node, __ast_path)
1762 }
1763
1764 #[inline]
1765 fn visit_childs<'ast: 'r, 'r>(
1766 &mut self,
1767 node: &'ast [Child],
1768 __ast_path: &mut AstNodePath<'r>,
1769 ) {
1770 <V as VisitAstPath>::visit_childs(&mut **self, node, __ast_path)
1771 }
1772
1773 #[inline]
1774 fn visit_comment<'ast: 'r, 'r>(
1775 &mut self,
1776 node: &'ast Comment,
1777 __ast_path: &mut AstNodePath<'r>,
1778 ) {
1779 <V as VisitAstPath>::visit_comment(&mut **self, node, __ast_path)
1780 }
1781
1782 #[inline]
1783 fn visit_document<'ast: 'r, 'r>(
1784 &mut self,
1785 node: &'ast Document,
1786 __ast_path: &mut AstNodePath<'r>,
1787 ) {
1788 <V as VisitAstPath>::visit_document(&mut **self, node, __ast_path)
1789 }
1790
1791 #[inline]
1792 fn visit_document_mode<'ast: 'r, 'r>(
1793 &mut self,
1794 node: &'ast DocumentMode,
1795 __ast_path: &mut AstNodePath<'r>,
1796 ) {
1797 <V as VisitAstPath>::visit_document_mode(&mut **self, node, __ast_path)
1798 }
1799
1800 #[inline]
1801 fn visit_document_type<'ast: 'r, 'r>(
1802 &mut self,
1803 node: &'ast DocumentType,
1804 __ast_path: &mut AstNodePath<'r>,
1805 ) {
1806 <V as VisitAstPath>::visit_document_type(&mut **self, node, __ast_path)
1807 }
1808
1809 #[inline]
1810 fn visit_element<'ast: 'r, 'r>(
1811 &mut self,
1812 node: &'ast Element,
1813 __ast_path: &mut AstNodePath<'r>,
1814 ) {
1815 <V as VisitAstPath>::visit_element(&mut **self, node, __ast_path)
1816 }
1817
1818 #[inline]
1819 fn visit_namespace<'ast: 'r, 'r>(
1820 &mut self,
1821 node: &'ast Namespace,
1822 __ast_path: &mut AstNodePath<'r>,
1823 ) {
1824 <V as VisitAstPath>::visit_namespace(&mut **self, node, __ast_path)
1825 }
1826
1827 #[inline]
1828 fn visit_opt_atom<'ast: 'r, 'r>(
1829 &mut self,
1830 node: &'ast Option<swc_atoms::Atom>,
1831 __ast_path: &mut AstNodePath<'r>,
1832 ) {
1833 <V as VisitAstPath>::visit_opt_atom(&mut **self, node, __ast_path)
1834 }
1835
1836 #[inline]
1837 fn visit_opt_namespace<'ast: 'r, 'r>(
1838 &mut self,
1839 node: &'ast Option<Namespace>,
1840 __ast_path: &mut AstNodePath<'r>,
1841 ) {
1842 <V as VisitAstPath>::visit_opt_namespace(&mut **self, node, __ast_path)
1843 }
1844
1845 #[inline]
1846 fn visit_processing_instruction<'ast: 'r, 'r>(
1847 &mut self,
1848 node: &'ast ProcessingInstruction,
1849 __ast_path: &mut AstNodePath<'r>,
1850 ) {
1851 <V as VisitAstPath>::visit_processing_instruction(&mut **self, node, __ast_path)
1852 }
1853
1854 #[inline]
1855 fn visit_span<'ast: 'r, 'r>(
1856 &mut self,
1857 node: &'ast swc_common::Span,
1858 __ast_path: &mut AstNodePath<'r>,
1859 ) {
1860 <V as VisitAstPath>::visit_span(&mut **self, node, __ast_path)
1861 }
1862
1863 #[inline]
1864 fn visit_text<'ast: 'r, 'r>(&mut self, node: &'ast Text, __ast_path: &mut AstNodePath<'r>) {
1865 <V as VisitAstPath>::visit_text(&mut **self, node, __ast_path)
1866 }
1867
1868 #[inline]
1869 fn visit_token<'ast: 'r, 'r>(&mut self, node: &'ast Token, __ast_path: &mut AstNodePath<'r>) {
1870 <V as VisitAstPath>::visit_token(&mut **self, node, __ast_path)
1871 }
1872
1873 #[inline]
1874 fn visit_token_and_span<'ast: 'r, 'r>(
1875 &mut self,
1876 node: &'ast TokenAndSpan,
1877 __ast_path: &mut AstNodePath<'r>,
1878 ) {
1879 <V as VisitAstPath>::visit_token_and_span(&mut **self, node, __ast_path)
1880 }
1881}
1882#[cfg(any(docsrs, feature = "path"))]
1883#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
1884impl<A, B> VisitAstPath for ::swc_visit::Either<A, B>
1885where
1886 A: VisitAstPath,
1887 B: VisitAstPath,
1888{
1889 #[inline]
1890 fn visit_atom<'ast: 'r, 'r>(
1891 &mut self,
1892 node: &'ast swc_atoms::Atom,
1893 __ast_path: &mut AstNodePath<'r>,
1894 ) {
1895 match self {
1896 swc_visit::Either::Left(visitor) => VisitAstPath::visit_atom(visitor, node, __ast_path),
1897 swc_visit::Either::Right(visitor) => {
1898 VisitAstPath::visit_atom(visitor, node, __ast_path)
1899 }
1900 }
1901 }
1902
1903 #[inline]
1904 fn visit_attribute<'ast: 'r, 'r>(
1905 &mut self,
1906 node: &'ast Attribute,
1907 __ast_path: &mut AstNodePath<'r>,
1908 ) {
1909 match self {
1910 swc_visit::Either::Left(visitor) => {
1911 VisitAstPath::visit_attribute(visitor, node, __ast_path)
1912 }
1913 swc_visit::Either::Right(visitor) => {
1914 VisitAstPath::visit_attribute(visitor, node, __ast_path)
1915 }
1916 }
1917 }
1918
1919 #[inline]
1920 fn visit_attribute_token<'ast: 'r, 'r>(
1921 &mut self,
1922 node: &'ast AttributeToken,
1923 __ast_path: &mut AstNodePath<'r>,
1924 ) {
1925 match self {
1926 swc_visit::Either::Left(visitor) => {
1927 VisitAstPath::visit_attribute_token(visitor, node, __ast_path)
1928 }
1929 swc_visit::Either::Right(visitor) => {
1930 VisitAstPath::visit_attribute_token(visitor, node, __ast_path)
1931 }
1932 }
1933 }
1934
1935 #[inline]
1936 fn visit_attribute_tokens<'ast: 'r, 'r>(
1937 &mut self,
1938 node: &'ast [AttributeToken],
1939 __ast_path: &mut AstNodePath<'r>,
1940 ) {
1941 match self {
1942 swc_visit::Either::Left(visitor) => {
1943 VisitAstPath::visit_attribute_tokens(visitor, node, __ast_path)
1944 }
1945 swc_visit::Either::Right(visitor) => {
1946 VisitAstPath::visit_attribute_tokens(visitor, node, __ast_path)
1947 }
1948 }
1949 }
1950
1951 #[inline]
1952 fn visit_attributes<'ast: 'r, 'r>(
1953 &mut self,
1954 node: &'ast [Attribute],
1955 __ast_path: &mut AstNodePath<'r>,
1956 ) {
1957 match self {
1958 swc_visit::Either::Left(visitor) => {
1959 VisitAstPath::visit_attributes(visitor, node, __ast_path)
1960 }
1961 swc_visit::Either::Right(visitor) => {
1962 VisitAstPath::visit_attributes(visitor, node, __ast_path)
1963 }
1964 }
1965 }
1966
1967 #[inline]
1968 fn visit_cdata_section<'ast: 'r, 'r>(
1969 &mut self,
1970 node: &'ast CdataSection,
1971 __ast_path: &mut AstNodePath<'r>,
1972 ) {
1973 match self {
1974 swc_visit::Either::Left(visitor) => {
1975 VisitAstPath::visit_cdata_section(visitor, node, __ast_path)
1976 }
1977 swc_visit::Either::Right(visitor) => {
1978 VisitAstPath::visit_cdata_section(visitor, node, __ast_path)
1979 }
1980 }
1981 }
1982
1983 #[inline]
1984 fn visit_child<'ast: 'r, 'r>(&mut self, node: &'ast Child, __ast_path: &mut AstNodePath<'r>) {
1985 match self {
1986 swc_visit::Either::Left(visitor) => {
1987 VisitAstPath::visit_child(visitor, node, __ast_path)
1988 }
1989 swc_visit::Either::Right(visitor) => {
1990 VisitAstPath::visit_child(visitor, node, __ast_path)
1991 }
1992 }
1993 }
1994
1995 #[inline]
1996 fn visit_childs<'ast: 'r, 'r>(
1997 &mut self,
1998 node: &'ast [Child],
1999 __ast_path: &mut AstNodePath<'r>,
2000 ) {
2001 match self {
2002 swc_visit::Either::Left(visitor) => {
2003 VisitAstPath::visit_childs(visitor, node, __ast_path)
2004 }
2005 swc_visit::Either::Right(visitor) => {
2006 VisitAstPath::visit_childs(visitor, node, __ast_path)
2007 }
2008 }
2009 }
2010
2011 #[inline]
2012 fn visit_comment<'ast: 'r, 'r>(
2013 &mut self,
2014 node: &'ast Comment,
2015 __ast_path: &mut AstNodePath<'r>,
2016 ) {
2017 match self {
2018 swc_visit::Either::Left(visitor) => {
2019 VisitAstPath::visit_comment(visitor, node, __ast_path)
2020 }
2021 swc_visit::Either::Right(visitor) => {
2022 VisitAstPath::visit_comment(visitor, node, __ast_path)
2023 }
2024 }
2025 }
2026
2027 #[inline]
2028 fn visit_document<'ast: 'r, 'r>(
2029 &mut self,
2030 node: &'ast Document,
2031 __ast_path: &mut AstNodePath<'r>,
2032 ) {
2033 match self {
2034 swc_visit::Either::Left(visitor) => {
2035 VisitAstPath::visit_document(visitor, node, __ast_path)
2036 }
2037 swc_visit::Either::Right(visitor) => {
2038 VisitAstPath::visit_document(visitor, node, __ast_path)
2039 }
2040 }
2041 }
2042
2043 #[inline]
2044 fn visit_document_mode<'ast: 'r, 'r>(
2045 &mut self,
2046 node: &'ast DocumentMode,
2047 __ast_path: &mut AstNodePath<'r>,
2048 ) {
2049 match self {
2050 swc_visit::Either::Left(visitor) => {
2051 VisitAstPath::visit_document_mode(visitor, node, __ast_path)
2052 }
2053 swc_visit::Either::Right(visitor) => {
2054 VisitAstPath::visit_document_mode(visitor, node, __ast_path)
2055 }
2056 }
2057 }
2058
2059 #[inline]
2060 fn visit_document_type<'ast: 'r, 'r>(
2061 &mut self,
2062 node: &'ast DocumentType,
2063 __ast_path: &mut AstNodePath<'r>,
2064 ) {
2065 match self {
2066 swc_visit::Either::Left(visitor) => {
2067 VisitAstPath::visit_document_type(visitor, node, __ast_path)
2068 }
2069 swc_visit::Either::Right(visitor) => {
2070 VisitAstPath::visit_document_type(visitor, node, __ast_path)
2071 }
2072 }
2073 }
2074
2075 #[inline]
2076 fn visit_element<'ast: 'r, 'r>(
2077 &mut self,
2078 node: &'ast Element,
2079 __ast_path: &mut AstNodePath<'r>,
2080 ) {
2081 match self {
2082 swc_visit::Either::Left(visitor) => {
2083 VisitAstPath::visit_element(visitor, node, __ast_path)
2084 }
2085 swc_visit::Either::Right(visitor) => {
2086 VisitAstPath::visit_element(visitor, node, __ast_path)
2087 }
2088 }
2089 }
2090
2091 #[inline]
2092 fn visit_namespace<'ast: 'r, 'r>(
2093 &mut self,
2094 node: &'ast Namespace,
2095 __ast_path: &mut AstNodePath<'r>,
2096 ) {
2097 match self {
2098 swc_visit::Either::Left(visitor) => {
2099 VisitAstPath::visit_namespace(visitor, node, __ast_path)
2100 }
2101 swc_visit::Either::Right(visitor) => {
2102 VisitAstPath::visit_namespace(visitor, node, __ast_path)
2103 }
2104 }
2105 }
2106
2107 #[inline]
2108 fn visit_opt_atom<'ast: 'r, 'r>(
2109 &mut self,
2110 node: &'ast Option<swc_atoms::Atom>,
2111 __ast_path: &mut AstNodePath<'r>,
2112 ) {
2113 match self {
2114 swc_visit::Either::Left(visitor) => {
2115 VisitAstPath::visit_opt_atom(visitor, node, __ast_path)
2116 }
2117 swc_visit::Either::Right(visitor) => {
2118 VisitAstPath::visit_opt_atom(visitor, node, __ast_path)
2119 }
2120 }
2121 }
2122
2123 #[inline]
2124 fn visit_opt_namespace<'ast: 'r, 'r>(
2125 &mut self,
2126 node: &'ast Option<Namespace>,
2127 __ast_path: &mut AstNodePath<'r>,
2128 ) {
2129 match self {
2130 swc_visit::Either::Left(visitor) => {
2131 VisitAstPath::visit_opt_namespace(visitor, node, __ast_path)
2132 }
2133 swc_visit::Either::Right(visitor) => {
2134 VisitAstPath::visit_opt_namespace(visitor, node, __ast_path)
2135 }
2136 }
2137 }
2138
2139 #[inline]
2140 fn visit_processing_instruction<'ast: 'r, 'r>(
2141 &mut self,
2142 node: &'ast ProcessingInstruction,
2143 __ast_path: &mut AstNodePath<'r>,
2144 ) {
2145 match self {
2146 swc_visit::Either::Left(visitor) => {
2147 VisitAstPath::visit_processing_instruction(visitor, node, __ast_path)
2148 }
2149 swc_visit::Either::Right(visitor) => {
2150 VisitAstPath::visit_processing_instruction(visitor, node, __ast_path)
2151 }
2152 }
2153 }
2154
2155 #[inline]
2156 fn visit_span<'ast: 'r, 'r>(
2157 &mut self,
2158 node: &'ast swc_common::Span,
2159 __ast_path: &mut AstNodePath<'r>,
2160 ) {
2161 match self {
2162 swc_visit::Either::Left(visitor) => VisitAstPath::visit_span(visitor, node, __ast_path),
2163 swc_visit::Either::Right(visitor) => {
2164 VisitAstPath::visit_span(visitor, node, __ast_path)
2165 }
2166 }
2167 }
2168
2169 #[inline]
2170 fn visit_text<'ast: 'r, 'r>(&mut self, node: &'ast Text, __ast_path: &mut AstNodePath<'r>) {
2171 match self {
2172 swc_visit::Either::Left(visitor) => VisitAstPath::visit_text(visitor, node, __ast_path),
2173 swc_visit::Either::Right(visitor) => {
2174 VisitAstPath::visit_text(visitor, node, __ast_path)
2175 }
2176 }
2177 }
2178
2179 #[inline]
2180 fn visit_token<'ast: 'r, 'r>(&mut self, node: &'ast Token, __ast_path: &mut AstNodePath<'r>) {
2181 match self {
2182 swc_visit::Either::Left(visitor) => {
2183 VisitAstPath::visit_token(visitor, node, __ast_path)
2184 }
2185 swc_visit::Either::Right(visitor) => {
2186 VisitAstPath::visit_token(visitor, node, __ast_path)
2187 }
2188 }
2189 }
2190
2191 #[inline]
2192 fn visit_token_and_span<'ast: 'r, 'r>(
2193 &mut self,
2194 node: &'ast TokenAndSpan,
2195 __ast_path: &mut AstNodePath<'r>,
2196 ) {
2197 match self {
2198 swc_visit::Either::Left(visitor) => {
2199 VisitAstPath::visit_token_and_span(visitor, node, __ast_path)
2200 }
2201 swc_visit::Either::Right(visitor) => {
2202 VisitAstPath::visit_token_and_span(visitor, node, __ast_path)
2203 }
2204 }
2205 }
2206}
2207#[cfg(any(docsrs, feature = "path"))]
2208#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
2209impl<V> VisitAstPath for ::swc_visit::Optional<V>
2210where
2211 V: VisitAstPath,
2212{
2213 #[inline]
2214 fn visit_atom<'ast: 'r, 'r>(
2215 &mut self,
2216 node: &'ast swc_atoms::Atom,
2217 __ast_path: &mut AstNodePath<'r>,
2218 ) {
2219 if self.enabled {
2220 <V as VisitAstPath>::visit_atom(&mut self.visitor, node, __ast_path)
2221 } else {
2222 }
2223 }
2224
2225 #[inline]
2226 fn visit_attribute<'ast: 'r, 'r>(
2227 &mut self,
2228 node: &'ast Attribute,
2229 __ast_path: &mut AstNodePath<'r>,
2230 ) {
2231 if self.enabled {
2232 <V as VisitAstPath>::visit_attribute(&mut self.visitor, node, __ast_path)
2233 } else {
2234 }
2235 }
2236
2237 #[inline]
2238 fn visit_attribute_token<'ast: 'r, 'r>(
2239 &mut self,
2240 node: &'ast AttributeToken,
2241 __ast_path: &mut AstNodePath<'r>,
2242 ) {
2243 if self.enabled {
2244 <V as VisitAstPath>::visit_attribute_token(&mut self.visitor, node, __ast_path)
2245 } else {
2246 }
2247 }
2248
2249 #[inline]
2250 fn visit_attribute_tokens<'ast: 'r, 'r>(
2251 &mut self,
2252 node: &'ast [AttributeToken],
2253 __ast_path: &mut AstNodePath<'r>,
2254 ) {
2255 if self.enabled {
2256 <V as VisitAstPath>::visit_attribute_tokens(&mut self.visitor, node, __ast_path)
2257 } else {
2258 }
2259 }
2260
2261 #[inline]
2262 fn visit_attributes<'ast: 'r, 'r>(
2263 &mut self,
2264 node: &'ast [Attribute],
2265 __ast_path: &mut AstNodePath<'r>,
2266 ) {
2267 if self.enabled {
2268 <V as VisitAstPath>::visit_attributes(&mut self.visitor, node, __ast_path)
2269 } else {
2270 }
2271 }
2272
2273 #[inline]
2274 fn visit_cdata_section<'ast: 'r, 'r>(
2275 &mut self,
2276 node: &'ast CdataSection,
2277 __ast_path: &mut AstNodePath<'r>,
2278 ) {
2279 if self.enabled {
2280 <V as VisitAstPath>::visit_cdata_section(&mut self.visitor, node, __ast_path)
2281 } else {
2282 }
2283 }
2284
2285 #[inline]
2286 fn visit_child<'ast: 'r, 'r>(&mut self, node: &'ast Child, __ast_path: &mut AstNodePath<'r>) {
2287 if self.enabled {
2288 <V as VisitAstPath>::visit_child(&mut self.visitor, node, __ast_path)
2289 } else {
2290 }
2291 }
2292
2293 #[inline]
2294 fn visit_childs<'ast: 'r, 'r>(
2295 &mut self,
2296 node: &'ast [Child],
2297 __ast_path: &mut AstNodePath<'r>,
2298 ) {
2299 if self.enabled {
2300 <V as VisitAstPath>::visit_childs(&mut self.visitor, node, __ast_path)
2301 } else {
2302 }
2303 }
2304
2305 #[inline]
2306 fn visit_comment<'ast: 'r, 'r>(
2307 &mut self,
2308 node: &'ast Comment,
2309 __ast_path: &mut AstNodePath<'r>,
2310 ) {
2311 if self.enabled {
2312 <V as VisitAstPath>::visit_comment(&mut self.visitor, node, __ast_path)
2313 } else {
2314 }
2315 }
2316
2317 #[inline]
2318 fn visit_document<'ast: 'r, 'r>(
2319 &mut self,
2320 node: &'ast Document,
2321 __ast_path: &mut AstNodePath<'r>,
2322 ) {
2323 if self.enabled {
2324 <V as VisitAstPath>::visit_document(&mut self.visitor, node, __ast_path)
2325 } else {
2326 }
2327 }
2328
2329 #[inline]
2330 fn visit_document_mode<'ast: 'r, 'r>(
2331 &mut self,
2332 node: &'ast DocumentMode,
2333 __ast_path: &mut AstNodePath<'r>,
2334 ) {
2335 if self.enabled {
2336 <V as VisitAstPath>::visit_document_mode(&mut self.visitor, node, __ast_path)
2337 } else {
2338 }
2339 }
2340
2341 #[inline]
2342 fn visit_document_type<'ast: 'r, 'r>(
2343 &mut self,
2344 node: &'ast DocumentType,
2345 __ast_path: &mut AstNodePath<'r>,
2346 ) {
2347 if self.enabled {
2348 <V as VisitAstPath>::visit_document_type(&mut self.visitor, node, __ast_path)
2349 } else {
2350 }
2351 }
2352
2353 #[inline]
2354 fn visit_element<'ast: 'r, 'r>(
2355 &mut self,
2356 node: &'ast Element,
2357 __ast_path: &mut AstNodePath<'r>,
2358 ) {
2359 if self.enabled {
2360 <V as VisitAstPath>::visit_element(&mut self.visitor, node, __ast_path)
2361 } else {
2362 }
2363 }
2364
2365 #[inline]
2366 fn visit_namespace<'ast: 'r, 'r>(
2367 &mut self,
2368 node: &'ast Namespace,
2369 __ast_path: &mut AstNodePath<'r>,
2370 ) {
2371 if self.enabled {
2372 <V as VisitAstPath>::visit_namespace(&mut self.visitor, node, __ast_path)
2373 } else {
2374 }
2375 }
2376
2377 #[inline]
2378 fn visit_opt_atom<'ast: 'r, 'r>(
2379 &mut self,
2380 node: &'ast Option<swc_atoms::Atom>,
2381 __ast_path: &mut AstNodePath<'r>,
2382 ) {
2383 if self.enabled {
2384 <V as VisitAstPath>::visit_opt_atom(&mut self.visitor, node, __ast_path)
2385 } else {
2386 }
2387 }
2388
2389 #[inline]
2390 fn visit_opt_namespace<'ast: 'r, 'r>(
2391 &mut self,
2392 node: &'ast Option<Namespace>,
2393 __ast_path: &mut AstNodePath<'r>,
2394 ) {
2395 if self.enabled {
2396 <V as VisitAstPath>::visit_opt_namespace(&mut self.visitor, node, __ast_path)
2397 } else {
2398 }
2399 }
2400
2401 #[inline]
2402 fn visit_processing_instruction<'ast: 'r, 'r>(
2403 &mut self,
2404 node: &'ast ProcessingInstruction,
2405 __ast_path: &mut AstNodePath<'r>,
2406 ) {
2407 if self.enabled {
2408 <V as VisitAstPath>::visit_processing_instruction(&mut self.visitor, node, __ast_path)
2409 } else {
2410 }
2411 }
2412
2413 #[inline]
2414 fn visit_span<'ast: 'r, 'r>(
2415 &mut self,
2416 node: &'ast swc_common::Span,
2417 __ast_path: &mut AstNodePath<'r>,
2418 ) {
2419 if self.enabled {
2420 <V as VisitAstPath>::visit_span(&mut self.visitor, node, __ast_path)
2421 } else {
2422 }
2423 }
2424
2425 #[inline]
2426 fn visit_text<'ast: 'r, 'r>(&mut self, node: &'ast Text, __ast_path: &mut AstNodePath<'r>) {
2427 if self.enabled {
2428 <V as VisitAstPath>::visit_text(&mut self.visitor, node, __ast_path)
2429 } else {
2430 }
2431 }
2432
2433 #[inline]
2434 fn visit_token<'ast: 'r, 'r>(&mut self, node: &'ast Token, __ast_path: &mut AstNodePath<'r>) {
2435 if self.enabled {
2436 <V as VisitAstPath>::visit_token(&mut self.visitor, node, __ast_path)
2437 } else {
2438 }
2439 }
2440
2441 #[inline]
2442 fn visit_token_and_span<'ast: 'r, 'r>(
2443 &mut self,
2444 node: &'ast TokenAndSpan,
2445 __ast_path: &mut AstNodePath<'r>,
2446 ) {
2447 if self.enabled {
2448 <V as VisitAstPath>::visit_token_and_span(&mut self.visitor, node, __ast_path)
2449 } else {
2450 }
2451 }
2452}
2453#[doc = r" A trait implemented for types that can be visited using a visitor."]
2454#[cfg(any(docsrs, feature = "path"))]
2455#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
2456pub trait VisitWithAstPath<V: ?Sized + VisitAstPath> {
2457 #[doc = r" Calls a visitor method (visitor.fold_xxx) with self."]
2458 fn visit_with_ast_path<'ast: 'r, 'r>(
2459 &'ast self,
2460 visitor: &mut V,
2461 __ast_path: &mut AstNodePath<'r>,
2462 );
2463 #[doc = r" Visit children nodes of `self`` with `visitor`."]
2464 fn visit_children_with_ast_path<'ast: 'r, 'r>(
2465 &'ast self,
2466 visitor: &mut V,
2467 __ast_path: &mut AstNodePath<'r>,
2468 );
2469}
2470#[cfg(any(docsrs, feature = "path"))]
2471#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
2472impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for Attribute {
2473 #[doc = "Calls [VisitAstPath`::visit_attribute`] with `self`."]
2474 fn visit_with_ast_path<'ast: 'r, 'r>(
2475 &'ast self,
2476 visitor: &mut V,
2477 __ast_path: &mut AstNodePath<'r>,
2478 ) {
2479 <V as VisitAstPath>::visit_attribute(visitor, self, __ast_path)
2480 }
2481
2482 fn visit_children_with_ast_path<'ast: 'r, 'r>(
2483 &'ast self,
2484 visitor: &mut V,
2485 __ast_path: &mut AstNodePath<'r>,
2486 ) {
2487 match self {
2488 Attribute {
2489 span,
2490 namespace,
2491 prefix,
2492 name,
2493 raw_name,
2494 value,
2495 raw_value,
2496 } => {
2497 {
2498 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Attribute(
2499 self,
2500 self::fields::AttributeField::Span,
2501 ));
2502 <swc_common::Span as VisitWithAstPath<V>>::visit_with_ast_path(
2503 span,
2504 visitor,
2505 &mut *__ast_path,
2506 )
2507 };
2508 {
2509 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Attribute(
2510 self,
2511 self::fields::AttributeField::Namespace,
2512 ));
2513 <Option<Namespace> as VisitWithAstPath<V>>::visit_with_ast_path(
2514 namespace,
2515 visitor,
2516 &mut *__ast_path,
2517 )
2518 };
2519 {
2520 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Attribute(
2521 self,
2522 self::fields::AttributeField::Prefix,
2523 ));
2524 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
2525 prefix,
2526 visitor,
2527 &mut *__ast_path,
2528 )
2529 };
2530 {
2531 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Attribute(
2532 self,
2533 self::fields::AttributeField::Name,
2534 ));
2535 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
2536 name,
2537 visitor,
2538 &mut *__ast_path,
2539 )
2540 };
2541 {
2542 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Attribute(
2543 self,
2544 self::fields::AttributeField::RawName,
2545 ));
2546 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
2547 raw_name,
2548 visitor,
2549 &mut *__ast_path,
2550 )
2551 };
2552 {
2553 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Attribute(
2554 self,
2555 self::fields::AttributeField::Value,
2556 ));
2557 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
2558 value,
2559 visitor,
2560 &mut *__ast_path,
2561 )
2562 };
2563 {
2564 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Attribute(
2565 self,
2566 self::fields::AttributeField::RawValue,
2567 ));
2568 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
2569 raw_value,
2570 visitor,
2571 &mut *__ast_path,
2572 )
2573 };
2574 }
2575 }
2576 }
2577}
2578#[cfg(any(docsrs, feature = "path"))]
2579#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
2580impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for AttributeToken {
2581 #[doc = "Calls [VisitAstPath`::visit_attribute_token`] with `self`."]
2582 fn visit_with_ast_path<'ast: 'r, 'r>(
2583 &'ast self,
2584 visitor: &mut V,
2585 __ast_path: &mut AstNodePath<'r>,
2586 ) {
2587 <V as VisitAstPath>::visit_attribute_token(visitor, self, __ast_path)
2588 }
2589
2590 fn visit_children_with_ast_path<'ast: 'r, 'r>(
2591 &'ast self,
2592 visitor: &mut V,
2593 __ast_path: &mut AstNodePath<'r>,
2594 ) {
2595 match self {
2596 AttributeToken {
2597 span,
2598 name,
2599 raw_name,
2600 value,
2601 raw_value,
2602 } => {
2603 {
2604 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::AttributeToken(
2605 self,
2606 self::fields::AttributeTokenField::Span,
2607 ));
2608 <swc_common::Span as VisitWithAstPath<V>>::visit_with_ast_path(
2609 span,
2610 visitor,
2611 &mut *__ast_path,
2612 )
2613 };
2614 {
2615 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::AttributeToken(
2616 self,
2617 self::fields::AttributeTokenField::Name,
2618 ));
2619 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
2620 name,
2621 visitor,
2622 &mut *__ast_path,
2623 )
2624 };
2625 {
2626 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::AttributeToken(
2627 self,
2628 self::fields::AttributeTokenField::RawName,
2629 ));
2630 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
2631 raw_name,
2632 visitor,
2633 &mut *__ast_path,
2634 )
2635 };
2636 {
2637 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::AttributeToken(
2638 self,
2639 self::fields::AttributeTokenField::Value,
2640 ));
2641 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
2642 value,
2643 visitor,
2644 &mut *__ast_path,
2645 )
2646 };
2647 {
2648 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::AttributeToken(
2649 self,
2650 self::fields::AttributeTokenField::RawValue,
2651 ));
2652 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
2653 raw_value,
2654 visitor,
2655 &mut *__ast_path,
2656 )
2657 };
2658 }
2659 }
2660 }
2661}
2662#[cfg(any(docsrs, feature = "path"))]
2663#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
2664impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for CdataSection {
2665 #[doc = "Calls [VisitAstPath`::visit_cdata_section`] with `self`."]
2666 fn visit_with_ast_path<'ast: 'r, 'r>(
2667 &'ast self,
2668 visitor: &mut V,
2669 __ast_path: &mut AstNodePath<'r>,
2670 ) {
2671 <V as VisitAstPath>::visit_cdata_section(visitor, self, __ast_path)
2672 }
2673
2674 fn visit_children_with_ast_path<'ast: 'r, 'r>(
2675 &'ast self,
2676 visitor: &mut V,
2677 __ast_path: &mut AstNodePath<'r>,
2678 ) {
2679 match self {
2680 CdataSection { span, data, raw } => {
2681 {
2682 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::CdataSection(
2683 self,
2684 self::fields::CdataSectionField::Span,
2685 ));
2686 <swc_common::Span as VisitWithAstPath<V>>::visit_with_ast_path(
2687 span,
2688 visitor,
2689 &mut *__ast_path,
2690 )
2691 };
2692 {
2693 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::CdataSection(
2694 self,
2695 self::fields::CdataSectionField::Data,
2696 ));
2697 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
2698 data,
2699 visitor,
2700 &mut *__ast_path,
2701 )
2702 };
2703 {
2704 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::CdataSection(
2705 self,
2706 self::fields::CdataSectionField::Raw,
2707 ));
2708 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
2709 raw,
2710 visitor,
2711 &mut *__ast_path,
2712 )
2713 };
2714 }
2715 }
2716 }
2717}
2718#[cfg(any(docsrs, feature = "path"))]
2719#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
2720impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for Child {
2721 #[doc = "Calls [VisitAstPath`::visit_child`] with `self`."]
2722 fn visit_with_ast_path<'ast: 'r, 'r>(
2723 &'ast self,
2724 visitor: &mut V,
2725 __ast_path: &mut AstNodePath<'r>,
2726 ) {
2727 <V as VisitAstPath>::visit_child(visitor, self, __ast_path)
2728 }
2729
2730 fn visit_children_with_ast_path<'ast: 'r, 'r>(
2731 &'ast self,
2732 visitor: &mut V,
2733 __ast_path: &mut AstNodePath<'r>,
2734 ) {
2735 match self {
2736 Child::DocumentType { 0: _field_0 } => {
2737 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Child(
2738 self,
2739 self::fields::ChildField::DocumentType,
2740 ));
2741 <DocumentType as VisitWithAstPath<V>>::visit_with_ast_path(
2742 _field_0,
2743 visitor,
2744 &mut *__ast_path,
2745 );
2746 }
2747 Child::Element { 0: _field_0 } => {
2748 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Child(
2749 self,
2750 self::fields::ChildField::Element,
2751 ));
2752 <Element as VisitWithAstPath<V>>::visit_with_ast_path(
2753 _field_0,
2754 visitor,
2755 &mut *__ast_path,
2756 );
2757 }
2758 Child::Text { 0: _field_0 } => {
2759 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Child(
2760 self,
2761 self::fields::ChildField::Text,
2762 ));
2763 <Text as VisitWithAstPath<V>>::visit_with_ast_path(
2764 _field_0,
2765 visitor,
2766 &mut *__ast_path,
2767 );
2768 }
2769 Child::CdataSection { 0: _field_0 } => {
2770 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Child(
2771 self,
2772 self::fields::ChildField::CdataSection,
2773 ));
2774 <CdataSection as VisitWithAstPath<V>>::visit_with_ast_path(
2775 _field_0,
2776 visitor,
2777 &mut *__ast_path,
2778 );
2779 }
2780 Child::Comment { 0: _field_0 } => {
2781 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Child(
2782 self,
2783 self::fields::ChildField::Comment,
2784 ));
2785 <Comment as VisitWithAstPath<V>>::visit_with_ast_path(
2786 _field_0,
2787 visitor,
2788 &mut *__ast_path,
2789 );
2790 }
2791 Child::ProcessingInstruction { 0: _field_0 } => {
2792 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Child(
2793 self,
2794 self::fields::ChildField::ProcessingInstruction,
2795 ));
2796 <ProcessingInstruction as VisitWithAstPath<V>>::visit_with_ast_path(
2797 _field_0,
2798 visitor,
2799 &mut *__ast_path,
2800 );
2801 }
2802 }
2803 }
2804}
2805#[cfg(any(docsrs, feature = "path"))]
2806#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
2807impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for Comment {
2808 #[doc = "Calls [VisitAstPath`::visit_comment`] with `self`."]
2809 fn visit_with_ast_path<'ast: 'r, 'r>(
2810 &'ast self,
2811 visitor: &mut V,
2812 __ast_path: &mut AstNodePath<'r>,
2813 ) {
2814 <V as VisitAstPath>::visit_comment(visitor, self, __ast_path)
2815 }
2816
2817 fn visit_children_with_ast_path<'ast: 'r, 'r>(
2818 &'ast self,
2819 visitor: &mut V,
2820 __ast_path: &mut AstNodePath<'r>,
2821 ) {
2822 match self {
2823 Comment { span, data, raw } => {
2824 {
2825 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Comment(
2826 self,
2827 self::fields::CommentField::Span,
2828 ));
2829 <swc_common::Span as VisitWithAstPath<V>>::visit_with_ast_path(
2830 span,
2831 visitor,
2832 &mut *__ast_path,
2833 )
2834 };
2835 {
2836 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Comment(
2837 self,
2838 self::fields::CommentField::Data,
2839 ));
2840 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
2841 data,
2842 visitor,
2843 &mut *__ast_path,
2844 )
2845 };
2846 {
2847 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Comment(
2848 self,
2849 self::fields::CommentField::Raw,
2850 ));
2851 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
2852 raw,
2853 visitor,
2854 &mut *__ast_path,
2855 )
2856 };
2857 }
2858 }
2859 }
2860}
2861#[cfg(any(docsrs, feature = "path"))]
2862#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
2863impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for Document {
2864 #[doc = "Calls [VisitAstPath`::visit_document`] with `self`."]
2865 fn visit_with_ast_path<'ast: 'r, 'r>(
2866 &'ast self,
2867 visitor: &mut V,
2868 __ast_path: &mut AstNodePath<'r>,
2869 ) {
2870 <V as VisitAstPath>::visit_document(visitor, self, __ast_path)
2871 }
2872
2873 fn visit_children_with_ast_path<'ast: 'r, 'r>(
2874 &'ast self,
2875 visitor: &mut V,
2876 __ast_path: &mut AstNodePath<'r>,
2877 ) {
2878 match self {
2879 Document { span, children } => {
2880 {
2881 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Document(
2882 self,
2883 self::fields::DocumentField::Span,
2884 ));
2885 <swc_common::Span as VisitWithAstPath<V>>::visit_with_ast_path(
2886 span,
2887 visitor,
2888 &mut *__ast_path,
2889 )
2890 };
2891 {
2892 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Document(
2893 self,
2894 self::fields::DocumentField::Children(usize::MAX),
2895 ));
2896 <Vec<Child> as VisitWithAstPath<V>>::visit_with_ast_path(
2897 children,
2898 visitor,
2899 &mut *__ast_path,
2900 )
2901 };
2902 }
2903 }
2904 }
2905}
2906#[cfg(any(docsrs, feature = "path"))]
2907#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
2908impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for DocumentMode {
2909 #[doc = "Calls [VisitAstPath`::visit_document_mode`] with `self`."]
2910 fn visit_with_ast_path<'ast: 'r, 'r>(
2911 &'ast self,
2912 visitor: &mut V,
2913 __ast_path: &mut AstNodePath<'r>,
2914 ) {
2915 <V as VisitAstPath>::visit_document_mode(visitor, self, __ast_path)
2916 }
2917
2918 fn visit_children_with_ast_path<'ast: 'r, 'r>(
2919 &'ast self,
2920 visitor: &mut V,
2921 __ast_path: &mut AstNodePath<'r>,
2922 ) {
2923 match self {
2924 DocumentMode::NoQuirks => {}
2925 DocumentMode::LimitedQuirks => {}
2926 DocumentMode::Quirks => {}
2927 }
2928 }
2929}
2930#[cfg(any(docsrs, feature = "path"))]
2931#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
2932impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for DocumentType {
2933 #[doc = "Calls [VisitAstPath`::visit_document_type`] with `self`."]
2934 fn visit_with_ast_path<'ast: 'r, 'r>(
2935 &'ast self,
2936 visitor: &mut V,
2937 __ast_path: &mut AstNodePath<'r>,
2938 ) {
2939 <V as VisitAstPath>::visit_document_type(visitor, self, __ast_path)
2940 }
2941
2942 fn visit_children_with_ast_path<'ast: 'r, 'r>(
2943 &'ast self,
2944 visitor: &mut V,
2945 __ast_path: &mut AstNodePath<'r>,
2946 ) {
2947 match self {
2948 DocumentType {
2949 span,
2950 name,
2951 public_id,
2952 system_id,
2953 raw,
2954 } => {
2955 {
2956 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::DocumentType(
2957 self,
2958 self::fields::DocumentTypeField::Span,
2959 ));
2960 <swc_common::Span as VisitWithAstPath<V>>::visit_with_ast_path(
2961 span,
2962 visitor,
2963 &mut *__ast_path,
2964 )
2965 };
2966 {
2967 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::DocumentType(
2968 self,
2969 self::fields::DocumentTypeField::Name,
2970 ));
2971 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
2972 name,
2973 visitor,
2974 &mut *__ast_path,
2975 )
2976 };
2977 {
2978 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::DocumentType(
2979 self,
2980 self::fields::DocumentTypeField::PublicId,
2981 ));
2982 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
2983 public_id,
2984 visitor,
2985 &mut *__ast_path,
2986 )
2987 };
2988 {
2989 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::DocumentType(
2990 self,
2991 self::fields::DocumentTypeField::SystemId,
2992 ));
2993 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
2994 system_id,
2995 visitor,
2996 &mut *__ast_path,
2997 )
2998 };
2999 {
3000 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::DocumentType(
3001 self,
3002 self::fields::DocumentTypeField::Raw,
3003 ));
3004 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
3005 raw,
3006 visitor,
3007 &mut *__ast_path,
3008 )
3009 };
3010 }
3011 }
3012 }
3013}
3014#[cfg(any(docsrs, feature = "path"))]
3015#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3016impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for Element {
3017 #[doc = "Calls [VisitAstPath`::visit_element`] with `self`."]
3018 fn visit_with_ast_path<'ast: 'r, 'r>(
3019 &'ast self,
3020 visitor: &mut V,
3021 __ast_path: &mut AstNodePath<'r>,
3022 ) {
3023 <V as VisitAstPath>::visit_element(visitor, self, __ast_path)
3024 }
3025
3026 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3027 &'ast self,
3028 visitor: &mut V,
3029 __ast_path: &mut AstNodePath<'r>,
3030 ) {
3031 match self {
3032 Element {
3033 span,
3034 tag_name,
3035 attributes,
3036 children,
3037 } => {
3038 {
3039 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Element(
3040 self,
3041 self::fields::ElementField::Span,
3042 ));
3043 <swc_common::Span as VisitWithAstPath<V>>::visit_with_ast_path(
3044 span,
3045 visitor,
3046 &mut *__ast_path,
3047 )
3048 };
3049 {
3050 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Element(
3051 self,
3052 self::fields::ElementField::TagName,
3053 ));
3054 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3055 tag_name,
3056 visitor,
3057 &mut *__ast_path,
3058 )
3059 };
3060 {
3061 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Element(
3062 self,
3063 self::fields::ElementField::Attributes(usize::MAX),
3064 ));
3065 <Vec<Attribute> as VisitWithAstPath<V>>::visit_with_ast_path(
3066 attributes,
3067 visitor,
3068 &mut *__ast_path,
3069 )
3070 };
3071 {
3072 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Element(
3073 self,
3074 self::fields::ElementField::Children(usize::MAX),
3075 ));
3076 <Vec<Child> as VisitWithAstPath<V>>::visit_with_ast_path(
3077 children,
3078 visitor,
3079 &mut *__ast_path,
3080 )
3081 };
3082 }
3083 }
3084 }
3085}
3086#[cfg(any(docsrs, feature = "path"))]
3087#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3088impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for Namespace {
3089 #[doc = "Calls [VisitAstPath`::visit_namespace`] with `self`."]
3090 fn visit_with_ast_path<'ast: 'r, 'r>(
3091 &'ast self,
3092 visitor: &mut V,
3093 __ast_path: &mut AstNodePath<'r>,
3094 ) {
3095 <V as VisitAstPath>::visit_namespace(visitor, self, __ast_path)
3096 }
3097
3098 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3099 &'ast self,
3100 visitor: &mut V,
3101 __ast_path: &mut AstNodePath<'r>,
3102 ) {
3103 match self {
3104 Namespace::HTML => {}
3105 Namespace::MATHML => {}
3106 Namespace::SVG => {}
3107 Namespace::XLINK => {}
3108 Namespace::XML => {}
3109 Namespace::XMLNS => {}
3110 }
3111 }
3112}
3113#[cfg(any(docsrs, feature = "path"))]
3114#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3115impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for ProcessingInstruction {
3116 #[doc = "Calls [VisitAstPath`::visit_processing_instruction`] with `self`."]
3117 fn visit_with_ast_path<'ast: 'r, 'r>(
3118 &'ast self,
3119 visitor: &mut V,
3120 __ast_path: &mut AstNodePath<'r>,
3121 ) {
3122 <V as VisitAstPath>::visit_processing_instruction(visitor, self, __ast_path)
3123 }
3124
3125 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3126 &'ast self,
3127 visitor: &mut V,
3128 __ast_path: &mut AstNodePath<'r>,
3129 ) {
3130 match self {
3131 ProcessingInstruction { span, target, data } => {
3132 {
3133 let mut __ast_path =
3134 __ast_path.with_guard(AstParentNodeRef::ProcessingInstruction(
3135 self,
3136 self::fields::ProcessingInstructionField::Span,
3137 ));
3138 <swc_common::Span as VisitWithAstPath<V>>::visit_with_ast_path(
3139 span,
3140 visitor,
3141 &mut *__ast_path,
3142 )
3143 };
3144 {
3145 let mut __ast_path =
3146 __ast_path.with_guard(AstParentNodeRef::ProcessingInstruction(
3147 self,
3148 self::fields::ProcessingInstructionField::Target,
3149 ));
3150 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3151 target,
3152 visitor,
3153 &mut *__ast_path,
3154 )
3155 };
3156 {
3157 let mut __ast_path =
3158 __ast_path.with_guard(AstParentNodeRef::ProcessingInstruction(
3159 self,
3160 self::fields::ProcessingInstructionField::Data,
3161 ));
3162 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3163 data,
3164 visitor,
3165 &mut *__ast_path,
3166 )
3167 };
3168 }
3169 }
3170 }
3171}
3172#[cfg(any(docsrs, feature = "path"))]
3173#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3174impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for Text {
3175 #[doc = "Calls [VisitAstPath`::visit_text`] with `self`."]
3176 fn visit_with_ast_path<'ast: 'r, 'r>(
3177 &'ast self,
3178 visitor: &mut V,
3179 __ast_path: &mut AstNodePath<'r>,
3180 ) {
3181 <V as VisitAstPath>::visit_text(visitor, self, __ast_path)
3182 }
3183
3184 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3185 &'ast self,
3186 visitor: &mut V,
3187 __ast_path: &mut AstNodePath<'r>,
3188 ) {
3189 match self {
3190 Text { span, data, raw } => {
3191 {
3192 let mut __ast_path = __ast_path
3193 .with_guard(AstParentNodeRef::Text(self, self::fields::TextField::Span));
3194 <swc_common::Span as VisitWithAstPath<V>>::visit_with_ast_path(
3195 span,
3196 visitor,
3197 &mut *__ast_path,
3198 )
3199 };
3200 {
3201 let mut __ast_path = __ast_path
3202 .with_guard(AstParentNodeRef::Text(self, self::fields::TextField::Data));
3203 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3204 data,
3205 visitor,
3206 &mut *__ast_path,
3207 )
3208 };
3209 {
3210 let mut __ast_path = __ast_path
3211 .with_guard(AstParentNodeRef::Text(self, self::fields::TextField::Raw));
3212 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
3213 raw,
3214 visitor,
3215 &mut *__ast_path,
3216 )
3217 };
3218 }
3219 }
3220 }
3221}
3222#[cfg(any(docsrs, feature = "path"))]
3223#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3224impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for Token {
3225 #[doc = "Calls [VisitAstPath`::visit_token`] with `self`."]
3226 fn visit_with_ast_path<'ast: 'r, 'r>(
3227 &'ast self,
3228 visitor: &mut V,
3229 __ast_path: &mut AstNodePath<'r>,
3230 ) {
3231 <V as VisitAstPath>::visit_token(visitor, self, __ast_path)
3232 }
3233
3234 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3235 &'ast self,
3236 visitor: &mut V,
3237 __ast_path: &mut AstNodePath<'r>,
3238 ) {
3239 match self {
3240 Token::Doctype {
3241 name,
3242 public_id,
3243 system_id,
3244 raw,
3245 } => {
3246 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3247 self,
3248 self::fields::TokenField::Doctype,
3249 ));
3250 {
3251 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3252 self,
3253 self::fields::TokenField::Name,
3254 ));
3255 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
3256 name,
3257 visitor,
3258 &mut *__ast_path,
3259 )
3260 };
3261 {
3262 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3263 self,
3264 self::fields::TokenField::PublicId,
3265 ));
3266 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
3267 public_id,
3268 visitor,
3269 &mut *__ast_path,
3270 )
3271 };
3272 {
3273 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3274 self,
3275 self::fields::TokenField::SystemId,
3276 ));
3277 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
3278 system_id,
3279 visitor,
3280 &mut *__ast_path,
3281 )
3282 };
3283 {
3284 let mut __ast_path = __ast_path
3285 .with_guard(AstParentNodeRef::Token(self, self::fields::TokenField::Raw));
3286 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
3287 raw,
3288 visitor,
3289 &mut *__ast_path,
3290 )
3291 };
3292 }
3293 Token::StartTag {
3294 tag_name,
3295 attributes,
3296 } => {
3297 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3298 self,
3299 self::fields::TokenField::StartTag,
3300 ));
3301 {
3302 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3303 self,
3304 self::fields::TokenField::TagName,
3305 ));
3306 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3307 tag_name,
3308 visitor,
3309 &mut *__ast_path,
3310 )
3311 };
3312 {
3313 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3314 self,
3315 self::fields::TokenField::Attributes(usize::MAX),
3316 ));
3317 <Vec<AttributeToken> as VisitWithAstPath<V>>::visit_with_ast_path(
3318 attributes,
3319 visitor,
3320 &mut *__ast_path,
3321 )
3322 };
3323 }
3324 Token::EndTag {
3325 tag_name,
3326 attributes,
3327 } => {
3328 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3329 self,
3330 self::fields::TokenField::EndTag,
3331 ));
3332 {
3333 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3334 self,
3335 self::fields::TokenField::TagName,
3336 ));
3337 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3338 tag_name,
3339 visitor,
3340 &mut *__ast_path,
3341 )
3342 };
3343 {
3344 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3345 self,
3346 self::fields::TokenField::Attributes(usize::MAX),
3347 ));
3348 <Vec<AttributeToken> as VisitWithAstPath<V>>::visit_with_ast_path(
3349 attributes,
3350 visitor,
3351 &mut *__ast_path,
3352 )
3353 };
3354 }
3355 Token::EmptyTag {
3356 tag_name,
3357 attributes,
3358 } => {
3359 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3360 self,
3361 self::fields::TokenField::EmptyTag,
3362 ));
3363 {
3364 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3365 self,
3366 self::fields::TokenField::TagName,
3367 ));
3368 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3369 tag_name,
3370 visitor,
3371 &mut *__ast_path,
3372 )
3373 };
3374 {
3375 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3376 self,
3377 self::fields::TokenField::Attributes(usize::MAX),
3378 ));
3379 <Vec<AttributeToken> as VisitWithAstPath<V>>::visit_with_ast_path(
3380 attributes,
3381 visitor,
3382 &mut *__ast_path,
3383 )
3384 };
3385 }
3386 Token::Comment { data, raw } => {
3387 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3388 self,
3389 self::fields::TokenField::Comment,
3390 ));
3391 {
3392 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3393 self,
3394 self::fields::TokenField::Data,
3395 ));
3396 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3397 data,
3398 visitor,
3399 &mut *__ast_path,
3400 )
3401 };
3402 {
3403 let mut __ast_path = __ast_path
3404 .with_guard(AstParentNodeRef::Token(self, self::fields::TokenField::Raw));
3405 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3406 raw,
3407 visitor,
3408 &mut *__ast_path,
3409 )
3410 };
3411 }
3412 Token::Character { value, raw } => {
3413 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3414 self,
3415 self::fields::TokenField::Character,
3416 ));
3417 {
3418 let mut __ast_path = __ast_path
3419 .with_guard(AstParentNodeRef::Token(self, self::fields::TokenField::Raw));
3420 <Option<swc_atoms::Atom> as VisitWithAstPath<V>>::visit_with_ast_path(
3421 raw,
3422 visitor,
3423 &mut *__ast_path,
3424 )
3425 };
3426 }
3427 Token::ProcessingInstruction { target, data } => {
3428 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3429 self,
3430 self::fields::TokenField::ProcessingInstruction,
3431 ));
3432 {
3433 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3434 self,
3435 self::fields::TokenField::Target,
3436 ));
3437 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3438 target,
3439 visitor,
3440 &mut *__ast_path,
3441 )
3442 };
3443 {
3444 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3445 self,
3446 self::fields::TokenField::Data,
3447 ));
3448 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3449 data,
3450 visitor,
3451 &mut *__ast_path,
3452 )
3453 };
3454 }
3455 Token::Cdata { data, raw } => {
3456 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3457 self,
3458 self::fields::TokenField::Cdata,
3459 ));
3460 {
3461 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::Token(
3462 self,
3463 self::fields::TokenField::Data,
3464 ));
3465 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3466 data,
3467 visitor,
3468 &mut *__ast_path,
3469 )
3470 };
3471 {
3472 let mut __ast_path = __ast_path
3473 .with_guard(AstParentNodeRef::Token(self, self::fields::TokenField::Raw));
3474 <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3475 raw,
3476 visitor,
3477 &mut *__ast_path,
3478 )
3479 };
3480 }
3481 Token::Eof => {}
3482 }
3483 }
3484}
3485#[cfg(any(docsrs, feature = "path"))]
3486#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3487impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for TokenAndSpan {
3488 #[doc = "Calls [VisitAstPath`::visit_token_and_span`] with `self`."]
3489 fn visit_with_ast_path<'ast: 'r, 'r>(
3490 &'ast self,
3491 visitor: &mut V,
3492 __ast_path: &mut AstNodePath<'r>,
3493 ) {
3494 <V as VisitAstPath>::visit_token_and_span(visitor, self, __ast_path)
3495 }
3496
3497 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3498 &'ast self,
3499 visitor: &mut V,
3500 __ast_path: &mut AstNodePath<'r>,
3501 ) {
3502 match self {
3503 TokenAndSpan { span, token } => {
3504 {
3505 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::TokenAndSpan(
3506 self,
3507 self::fields::TokenAndSpanField::Span,
3508 ));
3509 <swc_common::Span as VisitWithAstPath<V>>::visit_with_ast_path(
3510 span,
3511 visitor,
3512 &mut *__ast_path,
3513 )
3514 };
3515 {
3516 let mut __ast_path = __ast_path.with_guard(AstParentNodeRef::TokenAndSpan(
3517 self,
3518 self::fields::TokenAndSpanField::Token,
3519 ));
3520 <Token as VisitWithAstPath<V>>::visit_with_ast_path(
3521 token,
3522 visitor,
3523 &mut *__ast_path,
3524 )
3525 };
3526 }
3527 }
3528 }
3529}
3530#[cfg(any(docsrs, feature = "path"))]
3531#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3532impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for swc_atoms::Atom {
3533 #[doc = "Calls [VisitAstPath`::visit_atom`] with `self`. (Extra impl)"]
3534 #[inline]
3535 fn visit_with_ast_path<'ast: 'r, 'r>(
3536 &'ast self,
3537 visitor: &mut V,
3538 __ast_path: &mut AstNodePath<'r>,
3539 ) {
3540 <V as VisitAstPath>::visit_atom(visitor, self, __ast_path)
3541 }
3542
3543 #[inline]
3544 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3545 &'ast self,
3546 visitor: &mut V,
3547 __ast_path: &mut AstNodePath<'r>,
3548 ) {
3549 {}
3550 }
3551}
3552#[cfg(any(docsrs, feature = "path"))]
3553#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3554impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for [AttributeToken] {
3555 #[doc = "Calls [VisitAstPath`::visit_attribute_tokens`] with `self`. (Extra impl)"]
3556 #[inline]
3557 fn visit_with_ast_path<'ast: 'r, 'r>(
3558 &'ast self,
3559 visitor: &mut V,
3560 __ast_path: &mut AstNodePath<'r>,
3561 ) {
3562 <V as VisitAstPath>::visit_attribute_tokens(visitor, self, __ast_path)
3563 }
3564
3565 #[inline]
3566 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3567 &'ast self,
3568 visitor: &mut V,
3569 __ast_path: &mut AstNodePath<'r>,
3570 ) {
3571 self.iter().enumerate().for_each(|(__idx, item)| {
3572 let mut __ast_path = __ast_path.with_index_guard(__idx);
3573 <AttributeToken as VisitWithAstPath<V>>::visit_with_ast_path(
3574 item,
3575 visitor,
3576 &mut *__ast_path,
3577 )
3578 })
3579 }
3580}
3581#[cfg(any(docsrs, feature = "path"))]
3582#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3583impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for [Attribute] {
3584 #[doc = "Calls [VisitAstPath`::visit_attributes`] with `self`. (Extra impl)"]
3585 #[inline]
3586 fn visit_with_ast_path<'ast: 'r, 'r>(
3587 &'ast self,
3588 visitor: &mut V,
3589 __ast_path: &mut AstNodePath<'r>,
3590 ) {
3591 <V as VisitAstPath>::visit_attributes(visitor, self, __ast_path)
3592 }
3593
3594 #[inline]
3595 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3596 &'ast self,
3597 visitor: &mut V,
3598 __ast_path: &mut AstNodePath<'r>,
3599 ) {
3600 self.iter().enumerate().for_each(|(__idx, item)| {
3601 let mut __ast_path = __ast_path.with_index_guard(__idx);
3602 <Attribute as VisitWithAstPath<V>>::visit_with_ast_path(item, visitor, &mut *__ast_path)
3603 })
3604 }
3605}
3606#[cfg(any(docsrs, feature = "path"))]
3607#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3608impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for [Child] {
3609 #[doc = "Calls [VisitAstPath`::visit_childs`] with `self`. (Extra impl)"]
3610 #[inline]
3611 fn visit_with_ast_path<'ast: 'r, 'r>(
3612 &'ast self,
3613 visitor: &mut V,
3614 __ast_path: &mut AstNodePath<'r>,
3615 ) {
3616 <V as VisitAstPath>::visit_childs(visitor, self, __ast_path)
3617 }
3618
3619 #[inline]
3620 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3621 &'ast self,
3622 visitor: &mut V,
3623 __ast_path: &mut AstNodePath<'r>,
3624 ) {
3625 self.iter().enumerate().for_each(|(__idx, item)| {
3626 let mut __ast_path = __ast_path.with_index_guard(__idx);
3627 <Child as VisitWithAstPath<V>>::visit_with_ast_path(item, visitor, &mut *__ast_path)
3628 })
3629 }
3630}
3631#[cfg(any(docsrs, feature = "path"))]
3632#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3633impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for Option<swc_atoms::Atom> {
3634 #[doc = "Calls [VisitAstPath`::visit_opt_atom`] with `self`. (Extra impl)"]
3635 #[inline]
3636 fn visit_with_ast_path<'ast: 'r, 'r>(
3637 &'ast self,
3638 visitor: &mut V,
3639 __ast_path: &mut AstNodePath<'r>,
3640 ) {
3641 <V as VisitAstPath>::visit_opt_atom(visitor, self, __ast_path)
3642 }
3643
3644 #[inline]
3645 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3646 &'ast self,
3647 visitor: &mut V,
3648 __ast_path: &mut AstNodePath<'r>,
3649 ) {
3650 match self {
3651 Some(inner) => <swc_atoms::Atom as VisitWithAstPath<V>>::visit_with_ast_path(
3652 inner, visitor, __ast_path,
3653 ),
3654 None => {}
3655 }
3656 }
3657}
3658#[cfg(any(docsrs, feature = "path"))]
3659#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3660impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for Option<Namespace> {
3661 #[doc = "Calls [VisitAstPath`::visit_opt_namespace`] with `self`. (Extra impl)"]
3662 #[inline]
3663 fn visit_with_ast_path<'ast: 'r, 'r>(
3664 &'ast self,
3665 visitor: &mut V,
3666 __ast_path: &mut AstNodePath<'r>,
3667 ) {
3668 <V as VisitAstPath>::visit_opt_namespace(visitor, self, __ast_path)
3669 }
3670
3671 #[inline]
3672 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3673 &'ast self,
3674 visitor: &mut V,
3675 __ast_path: &mut AstNodePath<'r>,
3676 ) {
3677 match self {
3678 Some(inner) => {
3679 <Namespace as VisitWithAstPath<V>>::visit_with_ast_path(inner, visitor, __ast_path)
3680 }
3681 None => {}
3682 }
3683 }
3684}
3685#[cfg(any(docsrs, feature = "path"))]
3686#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3687impl<V: ?Sized + VisitAstPath> VisitWithAstPath<V> for swc_common::Span {
3688 #[doc = "Calls [VisitAstPath`::visit_span`] with `self`. (Extra impl)"]
3689 #[inline]
3690 fn visit_with_ast_path<'ast: 'r, 'r>(
3691 &'ast self,
3692 visitor: &mut V,
3693 __ast_path: &mut AstNodePath<'r>,
3694 ) {
3695 <V as VisitAstPath>::visit_span(visitor, self, __ast_path)
3696 }
3697
3698 #[inline]
3699 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3700 &'ast self,
3701 visitor: &mut V,
3702 __ast_path: &mut AstNodePath<'r>,
3703 ) {
3704 {}
3705 }
3706}
3707#[cfg(any(docsrs, feature = "path"))]
3708#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3709impl<V, T> VisitWithAstPath<V> for std::boxed::Box<T>
3710where
3711 V: ?Sized + VisitAstPath,
3712 T: VisitWithAstPath<V>,
3713{
3714 #[inline]
3715 fn visit_with_ast_path<'ast: 'r, 'r>(
3716 &'ast self,
3717 visitor: &mut V,
3718 __ast_path: &mut AstNodePath<'r>,
3719 ) {
3720 let v = <T as VisitWithAstPath<V>>::visit_with_ast_path(&**self, visitor, __ast_path);
3721 v
3722 }
3723
3724 #[inline]
3725 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3726 &'ast self,
3727 visitor: &mut V,
3728 __ast_path: &mut AstNodePath<'r>,
3729 ) {
3730 let v =
3731 <T as VisitWithAstPath<V>>::visit_children_with_ast_path(&**self, visitor, __ast_path);
3732 v
3733 }
3734}
3735#[cfg(any(docsrs, feature = "path"))]
3736#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
3737impl<V, T> VisitWithAstPath<V> for std::vec::Vec<T>
3738where
3739 V: ?Sized + VisitAstPath,
3740 [T]: VisitWithAstPath<V>,
3741{
3742 #[inline]
3743 fn visit_with_ast_path<'ast: 'r, 'r>(
3744 &'ast self,
3745 visitor: &mut V,
3746 __ast_path: &mut AstNodePath<'r>,
3747 ) {
3748 let v = <[T] as VisitWithAstPath<V>>::visit_with_ast_path(self, visitor, __ast_path);
3749 v
3750 }
3751
3752 #[inline]
3753 fn visit_children_with_ast_path<'ast: 'r, 'r>(
3754 &'ast self,
3755 visitor: &mut V,
3756 __ast_path: &mut AstNodePath<'r>,
3757 ) {
3758 let v =
3759 <[T] as VisitWithAstPath<V>>::visit_children_with_ast_path(self, visitor, __ast_path);
3760 v
3761 }
3762}
3763#[doc = r" A visitor trait for traversing the AST."]
3764pub trait VisitMut {
3765 #[doc = "Visit a node of type `swc_atoms :: Atom`.\n\nBy default, this method calls \
3766 [`swc_atoms :: Atom::visit_mut_children_with`]. If you want to recurse, you need to \
3767 call it manually."]
3768 #[inline]
3769 fn visit_mut_atom(&mut self, node: &mut swc_atoms::Atom) {
3770 <swc_atoms::Atom as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3771 }
3772 #[doc = "Visit a node of type `Attribute`.\n\nBy default, this method calls \
3773 [`Attribute::visit_mut_children_with`]. If you want to recurse, you need to call it \
3774 manually."]
3775 #[inline]
3776 fn visit_mut_attribute(&mut self, node: &mut Attribute) {
3777 <Attribute as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3778 }
3779 #[doc = "Visit a node of type `AttributeToken`.\n\nBy default, this method calls \
3780 [`AttributeToken::visit_mut_children_with`]. If you want to recurse, you need to call \
3781 it manually."]
3782 #[inline]
3783 fn visit_mut_attribute_token(&mut self, node: &mut AttributeToken) {
3784 <AttributeToken as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3785 }
3786 #[doc = "Visit a node of type `Vec < AttributeToken >`.\n\nBy default, this method calls [`Vec \
3787 < AttributeToken >::visit_mut_children_with`]. If you want to recurse, you need to \
3788 call it manually."]
3789 #[inline]
3790 fn visit_mut_attribute_tokens(&mut self, node: &mut Vec<AttributeToken>) {
3791 <Vec<AttributeToken> as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3792 }
3793 #[doc = "Visit a node of type `Vec < Attribute >`.\n\nBy default, this method calls [`Vec < \
3794 Attribute >::visit_mut_children_with`]. If you want to recurse, you need to call it \
3795 manually."]
3796 #[inline]
3797 fn visit_mut_attributes(&mut self, node: &mut Vec<Attribute>) {
3798 <Vec<Attribute> as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3799 }
3800 #[doc = "Visit a node of type `CdataSection`.\n\nBy default, this method calls \
3801 [`CdataSection::visit_mut_children_with`]. If you want to recurse, you need to call \
3802 it manually."]
3803 #[inline]
3804 fn visit_mut_cdata_section(&mut self, node: &mut CdataSection) {
3805 <CdataSection as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3806 }
3807 #[doc = "Visit a node of type `Child`.\n\nBy default, this method calls \
3808 [`Child::visit_mut_children_with`]. If you want to recurse, you need to call it \
3809 manually."]
3810 #[inline]
3811 fn visit_mut_child(&mut self, node: &mut Child) {
3812 <Child as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3813 }
3814 #[doc = "Visit a node of type `Vec < Child >`.\n\nBy default, this method calls [`Vec < Child \
3815 >::visit_mut_children_with`]. If you want to recurse, you need to call it manually."]
3816 #[inline]
3817 fn visit_mut_childs(&mut self, node: &mut Vec<Child>) {
3818 <Vec<Child> as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3819 }
3820 #[doc = "Visit a node of type `Comment`.\n\nBy default, this method calls \
3821 [`Comment::visit_mut_children_with`]. If you want to recurse, you need to call it \
3822 manually."]
3823 #[inline]
3824 fn visit_mut_comment(&mut self, node: &mut Comment) {
3825 <Comment as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3826 }
3827 #[doc = "Visit a node of type `Document`.\n\nBy default, this method calls \
3828 [`Document::visit_mut_children_with`]. If you want to recurse, you need to call it \
3829 manually."]
3830 #[inline]
3831 fn visit_mut_document(&mut self, node: &mut Document) {
3832 <Document as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3833 }
3834 #[doc = "Visit a node of type `DocumentMode`.\n\nBy default, this method calls \
3835 [`DocumentMode::visit_mut_children_with`]. If you want to recurse, you need to call \
3836 it manually."]
3837 #[inline]
3838 fn visit_mut_document_mode(&mut self, node: &mut DocumentMode) {
3839 <DocumentMode as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3840 }
3841 #[doc = "Visit a node of type `DocumentType`.\n\nBy default, this method calls \
3842 [`DocumentType::visit_mut_children_with`]. If you want to recurse, you need to call \
3843 it manually."]
3844 #[inline]
3845 fn visit_mut_document_type(&mut self, node: &mut DocumentType) {
3846 <DocumentType as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3847 }
3848 #[doc = "Visit a node of type `Element`.\n\nBy default, this method calls \
3849 [`Element::visit_mut_children_with`]. If you want to recurse, you need to call it \
3850 manually."]
3851 #[inline]
3852 fn visit_mut_element(&mut self, node: &mut Element) {
3853 <Element as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3854 }
3855 #[doc = "Visit a node of type `Namespace`.\n\nBy default, this method calls \
3856 [`Namespace::visit_mut_children_with`]. If you want to recurse, you need to call it \
3857 manually."]
3858 #[inline]
3859 fn visit_mut_namespace(&mut self, node: &mut Namespace) {
3860 <Namespace as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3861 }
3862 #[doc = "Visit a node of type `Option < swc_atoms :: Atom >`.\n\nBy default, this method calls \
3863 [`Option < swc_atoms :: Atom >::visit_mut_children_with`]. If you want to recurse, \
3864 you need to call it manually."]
3865 #[inline]
3866 fn visit_mut_opt_atom(&mut self, node: &mut Option<swc_atoms::Atom>) {
3867 <Option<swc_atoms::Atom> as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3868 }
3869 #[doc = "Visit a node of type `Option < Namespace >`.\n\nBy default, this method calls \
3870 [`Option < Namespace >::visit_mut_children_with`]. If you want to recurse, you need \
3871 to call it manually."]
3872 #[inline]
3873 fn visit_mut_opt_namespace(&mut self, node: &mut Option<Namespace>) {
3874 <Option<Namespace> as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3875 }
3876 #[doc = "Visit a node of type `ProcessingInstruction`.\n\nBy default, this method calls \
3877 [`ProcessingInstruction::visit_mut_children_with`]. If you want to recurse, you need \
3878 to call it manually."]
3879 #[inline]
3880 fn visit_mut_processing_instruction(&mut self, node: &mut ProcessingInstruction) {
3881 <ProcessingInstruction as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3882 }
3883 #[doc = "Visit a node of type `swc_common :: Span`.\n\nBy default, this method calls \
3884 [`swc_common :: Span::visit_mut_children_with`]. If you want to recurse, you need to \
3885 call it manually."]
3886 #[inline]
3887 fn visit_mut_span(&mut self, node: &mut swc_common::Span) {
3888 <swc_common::Span as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3889 }
3890 #[doc = "Visit a node of type `Text`.\n\nBy default, this method calls \
3891 [`Text::visit_mut_children_with`]. If you want to recurse, you need to call it \
3892 manually."]
3893 #[inline]
3894 fn visit_mut_text(&mut self, node: &mut Text) {
3895 <Text as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3896 }
3897 #[doc = "Visit a node of type `Token`.\n\nBy default, this method calls \
3898 [`Token::visit_mut_children_with`]. If you want to recurse, you need to call it \
3899 manually."]
3900 #[inline]
3901 fn visit_mut_token(&mut self, node: &mut Token) {
3902 <Token as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3903 }
3904 #[doc = "Visit a node of type `TokenAndSpan`.\n\nBy default, this method calls \
3905 [`TokenAndSpan::visit_mut_children_with`]. If you want to recurse, you need to call \
3906 it manually."]
3907 #[inline]
3908 fn visit_mut_token_and_span(&mut self, node: &mut TokenAndSpan) {
3909 <TokenAndSpan as VisitMutWith<Self>>::visit_mut_children_with(node, self)
3910 }
3911}
3912impl<V> VisitMut for &mut V
3913where
3914 V: ?Sized + VisitMut,
3915{
3916 #[inline]
3917 fn visit_mut_atom(&mut self, node: &mut swc_atoms::Atom) {
3918 <V as VisitMut>::visit_mut_atom(&mut **self, node)
3919 }
3920
3921 #[inline]
3922 fn visit_mut_attribute(&mut self, node: &mut Attribute) {
3923 <V as VisitMut>::visit_mut_attribute(&mut **self, node)
3924 }
3925
3926 #[inline]
3927 fn visit_mut_attribute_token(&mut self, node: &mut AttributeToken) {
3928 <V as VisitMut>::visit_mut_attribute_token(&mut **self, node)
3929 }
3930
3931 #[inline]
3932 fn visit_mut_attribute_tokens(&mut self, node: &mut Vec<AttributeToken>) {
3933 <V as VisitMut>::visit_mut_attribute_tokens(&mut **self, node)
3934 }
3935
3936 #[inline]
3937 fn visit_mut_attributes(&mut self, node: &mut Vec<Attribute>) {
3938 <V as VisitMut>::visit_mut_attributes(&mut **self, node)
3939 }
3940
3941 #[inline]
3942 fn visit_mut_cdata_section(&mut self, node: &mut CdataSection) {
3943 <V as VisitMut>::visit_mut_cdata_section(&mut **self, node)
3944 }
3945
3946 #[inline]
3947 fn visit_mut_child(&mut self, node: &mut Child) {
3948 <V as VisitMut>::visit_mut_child(&mut **self, node)
3949 }
3950
3951 #[inline]
3952 fn visit_mut_childs(&mut self, node: &mut Vec<Child>) {
3953 <V as VisitMut>::visit_mut_childs(&mut **self, node)
3954 }
3955
3956 #[inline]
3957 fn visit_mut_comment(&mut self, node: &mut Comment) {
3958 <V as VisitMut>::visit_mut_comment(&mut **self, node)
3959 }
3960
3961 #[inline]
3962 fn visit_mut_document(&mut self, node: &mut Document) {
3963 <V as VisitMut>::visit_mut_document(&mut **self, node)
3964 }
3965
3966 #[inline]
3967 fn visit_mut_document_mode(&mut self, node: &mut DocumentMode) {
3968 <V as VisitMut>::visit_mut_document_mode(&mut **self, node)
3969 }
3970
3971 #[inline]
3972 fn visit_mut_document_type(&mut self, node: &mut DocumentType) {
3973 <V as VisitMut>::visit_mut_document_type(&mut **self, node)
3974 }
3975
3976 #[inline]
3977 fn visit_mut_element(&mut self, node: &mut Element) {
3978 <V as VisitMut>::visit_mut_element(&mut **self, node)
3979 }
3980
3981 #[inline]
3982 fn visit_mut_namespace(&mut self, node: &mut Namespace) {
3983 <V as VisitMut>::visit_mut_namespace(&mut **self, node)
3984 }
3985
3986 #[inline]
3987 fn visit_mut_opt_atom(&mut self, node: &mut Option<swc_atoms::Atom>) {
3988 <V as VisitMut>::visit_mut_opt_atom(&mut **self, node)
3989 }
3990
3991 #[inline]
3992 fn visit_mut_opt_namespace(&mut self, node: &mut Option<Namespace>) {
3993 <V as VisitMut>::visit_mut_opt_namespace(&mut **self, node)
3994 }
3995
3996 #[inline]
3997 fn visit_mut_processing_instruction(&mut self, node: &mut ProcessingInstruction) {
3998 <V as VisitMut>::visit_mut_processing_instruction(&mut **self, node)
3999 }
4000
4001 #[inline]
4002 fn visit_mut_span(&mut self, node: &mut swc_common::Span) {
4003 <V as VisitMut>::visit_mut_span(&mut **self, node)
4004 }
4005
4006 #[inline]
4007 fn visit_mut_text(&mut self, node: &mut Text) {
4008 <V as VisitMut>::visit_mut_text(&mut **self, node)
4009 }
4010
4011 #[inline]
4012 fn visit_mut_token(&mut self, node: &mut Token) {
4013 <V as VisitMut>::visit_mut_token(&mut **self, node)
4014 }
4015
4016 #[inline]
4017 fn visit_mut_token_and_span(&mut self, node: &mut TokenAndSpan) {
4018 <V as VisitMut>::visit_mut_token_and_span(&mut **self, node)
4019 }
4020}
4021impl<V> VisitMut for Box<V>
4022where
4023 V: ?Sized + VisitMut,
4024{
4025 #[inline]
4026 fn visit_mut_atom(&mut self, node: &mut swc_atoms::Atom) {
4027 <V as VisitMut>::visit_mut_atom(&mut **self, node)
4028 }
4029
4030 #[inline]
4031 fn visit_mut_attribute(&mut self, node: &mut Attribute) {
4032 <V as VisitMut>::visit_mut_attribute(&mut **self, node)
4033 }
4034
4035 #[inline]
4036 fn visit_mut_attribute_token(&mut self, node: &mut AttributeToken) {
4037 <V as VisitMut>::visit_mut_attribute_token(&mut **self, node)
4038 }
4039
4040 #[inline]
4041 fn visit_mut_attribute_tokens(&mut self, node: &mut Vec<AttributeToken>) {
4042 <V as VisitMut>::visit_mut_attribute_tokens(&mut **self, node)
4043 }
4044
4045 #[inline]
4046 fn visit_mut_attributes(&mut self, node: &mut Vec<Attribute>) {
4047 <V as VisitMut>::visit_mut_attributes(&mut **self, node)
4048 }
4049
4050 #[inline]
4051 fn visit_mut_cdata_section(&mut self, node: &mut CdataSection) {
4052 <V as VisitMut>::visit_mut_cdata_section(&mut **self, node)
4053 }
4054
4055 #[inline]
4056 fn visit_mut_child(&mut self, node: &mut Child) {
4057 <V as VisitMut>::visit_mut_child(&mut **self, node)
4058 }
4059
4060 #[inline]
4061 fn visit_mut_childs(&mut self, node: &mut Vec<Child>) {
4062 <V as VisitMut>::visit_mut_childs(&mut **self, node)
4063 }
4064
4065 #[inline]
4066 fn visit_mut_comment(&mut self, node: &mut Comment) {
4067 <V as VisitMut>::visit_mut_comment(&mut **self, node)
4068 }
4069
4070 #[inline]
4071 fn visit_mut_document(&mut self, node: &mut Document) {
4072 <V as VisitMut>::visit_mut_document(&mut **self, node)
4073 }
4074
4075 #[inline]
4076 fn visit_mut_document_mode(&mut self, node: &mut DocumentMode) {
4077 <V as VisitMut>::visit_mut_document_mode(&mut **self, node)
4078 }
4079
4080 #[inline]
4081 fn visit_mut_document_type(&mut self, node: &mut DocumentType) {
4082 <V as VisitMut>::visit_mut_document_type(&mut **self, node)
4083 }
4084
4085 #[inline]
4086 fn visit_mut_element(&mut self, node: &mut Element) {
4087 <V as VisitMut>::visit_mut_element(&mut **self, node)
4088 }
4089
4090 #[inline]
4091 fn visit_mut_namespace(&mut self, node: &mut Namespace) {
4092 <V as VisitMut>::visit_mut_namespace(&mut **self, node)
4093 }
4094
4095 #[inline]
4096 fn visit_mut_opt_atom(&mut self, node: &mut Option<swc_atoms::Atom>) {
4097 <V as VisitMut>::visit_mut_opt_atom(&mut **self, node)
4098 }
4099
4100 #[inline]
4101 fn visit_mut_opt_namespace(&mut self, node: &mut Option<Namespace>) {
4102 <V as VisitMut>::visit_mut_opt_namespace(&mut **self, node)
4103 }
4104
4105 #[inline]
4106 fn visit_mut_processing_instruction(&mut self, node: &mut ProcessingInstruction) {
4107 <V as VisitMut>::visit_mut_processing_instruction(&mut **self, node)
4108 }
4109
4110 #[inline]
4111 fn visit_mut_span(&mut self, node: &mut swc_common::Span) {
4112 <V as VisitMut>::visit_mut_span(&mut **self, node)
4113 }
4114
4115 #[inline]
4116 fn visit_mut_text(&mut self, node: &mut Text) {
4117 <V as VisitMut>::visit_mut_text(&mut **self, node)
4118 }
4119
4120 #[inline]
4121 fn visit_mut_token(&mut self, node: &mut Token) {
4122 <V as VisitMut>::visit_mut_token(&mut **self, node)
4123 }
4124
4125 #[inline]
4126 fn visit_mut_token_and_span(&mut self, node: &mut TokenAndSpan) {
4127 <V as VisitMut>::visit_mut_token_and_span(&mut **self, node)
4128 }
4129}
4130impl<A, B> VisitMut for ::swc_visit::Either<A, B>
4131where
4132 A: VisitMut,
4133 B: VisitMut,
4134{
4135 #[inline]
4136 fn visit_mut_atom(&mut self, node: &mut swc_atoms::Atom) {
4137 match self {
4138 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_atom(visitor, node),
4139 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_atom(visitor, node),
4140 }
4141 }
4142
4143 #[inline]
4144 fn visit_mut_attribute(&mut self, node: &mut Attribute) {
4145 match self {
4146 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_attribute(visitor, node),
4147 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_attribute(visitor, node),
4148 }
4149 }
4150
4151 #[inline]
4152 fn visit_mut_attribute_token(&mut self, node: &mut AttributeToken) {
4153 match self {
4154 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_attribute_token(visitor, node),
4155 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_attribute_token(visitor, node),
4156 }
4157 }
4158
4159 #[inline]
4160 fn visit_mut_attribute_tokens(&mut self, node: &mut Vec<AttributeToken>) {
4161 match self {
4162 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_attribute_tokens(visitor, node),
4163 swc_visit::Either::Right(visitor) => {
4164 VisitMut::visit_mut_attribute_tokens(visitor, node)
4165 }
4166 }
4167 }
4168
4169 #[inline]
4170 fn visit_mut_attributes(&mut self, node: &mut Vec<Attribute>) {
4171 match self {
4172 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_attributes(visitor, node),
4173 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_attributes(visitor, node),
4174 }
4175 }
4176
4177 #[inline]
4178 fn visit_mut_cdata_section(&mut self, node: &mut CdataSection) {
4179 match self {
4180 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_cdata_section(visitor, node),
4181 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_cdata_section(visitor, node),
4182 }
4183 }
4184
4185 #[inline]
4186 fn visit_mut_child(&mut self, node: &mut Child) {
4187 match self {
4188 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_child(visitor, node),
4189 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_child(visitor, node),
4190 }
4191 }
4192
4193 #[inline]
4194 fn visit_mut_childs(&mut self, node: &mut Vec<Child>) {
4195 match self {
4196 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_childs(visitor, node),
4197 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_childs(visitor, node),
4198 }
4199 }
4200
4201 #[inline]
4202 fn visit_mut_comment(&mut self, node: &mut Comment) {
4203 match self {
4204 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_comment(visitor, node),
4205 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_comment(visitor, node),
4206 }
4207 }
4208
4209 #[inline]
4210 fn visit_mut_document(&mut self, node: &mut Document) {
4211 match self {
4212 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_document(visitor, node),
4213 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_document(visitor, node),
4214 }
4215 }
4216
4217 #[inline]
4218 fn visit_mut_document_mode(&mut self, node: &mut DocumentMode) {
4219 match self {
4220 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_document_mode(visitor, node),
4221 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_document_mode(visitor, node),
4222 }
4223 }
4224
4225 #[inline]
4226 fn visit_mut_document_type(&mut self, node: &mut DocumentType) {
4227 match self {
4228 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_document_type(visitor, node),
4229 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_document_type(visitor, node),
4230 }
4231 }
4232
4233 #[inline]
4234 fn visit_mut_element(&mut self, node: &mut Element) {
4235 match self {
4236 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_element(visitor, node),
4237 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_element(visitor, node),
4238 }
4239 }
4240
4241 #[inline]
4242 fn visit_mut_namespace(&mut self, node: &mut Namespace) {
4243 match self {
4244 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_namespace(visitor, node),
4245 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_namespace(visitor, node),
4246 }
4247 }
4248
4249 #[inline]
4250 fn visit_mut_opt_atom(&mut self, node: &mut Option<swc_atoms::Atom>) {
4251 match self {
4252 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_opt_atom(visitor, node),
4253 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_opt_atom(visitor, node),
4254 }
4255 }
4256
4257 #[inline]
4258 fn visit_mut_opt_namespace(&mut self, node: &mut Option<Namespace>) {
4259 match self {
4260 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_opt_namespace(visitor, node),
4261 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_opt_namespace(visitor, node),
4262 }
4263 }
4264
4265 #[inline]
4266 fn visit_mut_processing_instruction(&mut self, node: &mut ProcessingInstruction) {
4267 match self {
4268 swc_visit::Either::Left(visitor) => {
4269 VisitMut::visit_mut_processing_instruction(visitor, node)
4270 }
4271 swc_visit::Either::Right(visitor) => {
4272 VisitMut::visit_mut_processing_instruction(visitor, node)
4273 }
4274 }
4275 }
4276
4277 #[inline]
4278 fn visit_mut_span(&mut self, node: &mut swc_common::Span) {
4279 match self {
4280 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_span(visitor, node),
4281 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_span(visitor, node),
4282 }
4283 }
4284
4285 #[inline]
4286 fn visit_mut_text(&mut self, node: &mut Text) {
4287 match self {
4288 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_text(visitor, node),
4289 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_text(visitor, node),
4290 }
4291 }
4292
4293 #[inline]
4294 fn visit_mut_token(&mut self, node: &mut Token) {
4295 match self {
4296 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_token(visitor, node),
4297 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_token(visitor, node),
4298 }
4299 }
4300
4301 #[inline]
4302 fn visit_mut_token_and_span(&mut self, node: &mut TokenAndSpan) {
4303 match self {
4304 swc_visit::Either::Left(visitor) => VisitMut::visit_mut_token_and_span(visitor, node),
4305 swc_visit::Either::Right(visitor) => VisitMut::visit_mut_token_and_span(visitor, node),
4306 }
4307 }
4308}
4309impl<V> VisitMut for ::swc_visit::Optional<V>
4310where
4311 V: VisitMut,
4312{
4313 #[inline]
4314 fn visit_mut_atom(&mut self, node: &mut swc_atoms::Atom) {
4315 if self.enabled {
4316 <V as VisitMut>::visit_mut_atom(&mut self.visitor, node)
4317 } else {
4318 }
4319 }
4320
4321 #[inline]
4322 fn visit_mut_attribute(&mut self, node: &mut Attribute) {
4323 if self.enabled {
4324 <V as VisitMut>::visit_mut_attribute(&mut self.visitor, node)
4325 } else {
4326 }
4327 }
4328
4329 #[inline]
4330 fn visit_mut_attribute_token(&mut self, node: &mut AttributeToken) {
4331 if self.enabled {
4332 <V as VisitMut>::visit_mut_attribute_token(&mut self.visitor, node)
4333 } else {
4334 }
4335 }
4336
4337 #[inline]
4338 fn visit_mut_attribute_tokens(&mut self, node: &mut Vec<AttributeToken>) {
4339 if self.enabled {
4340 <V as VisitMut>::visit_mut_attribute_tokens(&mut self.visitor, node)
4341 } else {
4342 }
4343 }
4344
4345 #[inline]
4346 fn visit_mut_attributes(&mut self, node: &mut Vec<Attribute>) {
4347 if self.enabled {
4348 <V as VisitMut>::visit_mut_attributes(&mut self.visitor, node)
4349 } else {
4350 }
4351 }
4352
4353 #[inline]
4354 fn visit_mut_cdata_section(&mut self, node: &mut CdataSection) {
4355 if self.enabled {
4356 <V as VisitMut>::visit_mut_cdata_section(&mut self.visitor, node)
4357 } else {
4358 }
4359 }
4360
4361 #[inline]
4362 fn visit_mut_child(&mut self, node: &mut Child) {
4363 if self.enabled {
4364 <V as VisitMut>::visit_mut_child(&mut self.visitor, node)
4365 } else {
4366 }
4367 }
4368
4369 #[inline]
4370 fn visit_mut_childs(&mut self, node: &mut Vec<Child>) {
4371 if self.enabled {
4372 <V as VisitMut>::visit_mut_childs(&mut self.visitor, node)
4373 } else {
4374 }
4375 }
4376
4377 #[inline]
4378 fn visit_mut_comment(&mut self, node: &mut Comment) {
4379 if self.enabled {
4380 <V as VisitMut>::visit_mut_comment(&mut self.visitor, node)
4381 } else {
4382 }
4383 }
4384
4385 #[inline]
4386 fn visit_mut_document(&mut self, node: &mut Document) {
4387 if self.enabled {
4388 <V as VisitMut>::visit_mut_document(&mut self.visitor, node)
4389 } else {
4390 }
4391 }
4392
4393 #[inline]
4394 fn visit_mut_document_mode(&mut self, node: &mut DocumentMode) {
4395 if self.enabled {
4396 <V as VisitMut>::visit_mut_document_mode(&mut self.visitor, node)
4397 } else {
4398 }
4399 }
4400
4401 #[inline]
4402 fn visit_mut_document_type(&mut self, node: &mut DocumentType) {
4403 if self.enabled {
4404 <V as VisitMut>::visit_mut_document_type(&mut self.visitor, node)
4405 } else {
4406 }
4407 }
4408
4409 #[inline]
4410 fn visit_mut_element(&mut self, node: &mut Element) {
4411 if self.enabled {
4412 <V as VisitMut>::visit_mut_element(&mut self.visitor, node)
4413 } else {
4414 }
4415 }
4416
4417 #[inline]
4418 fn visit_mut_namespace(&mut self, node: &mut Namespace) {
4419 if self.enabled {
4420 <V as VisitMut>::visit_mut_namespace(&mut self.visitor, node)
4421 } else {
4422 }
4423 }
4424
4425 #[inline]
4426 fn visit_mut_opt_atom(&mut self, node: &mut Option<swc_atoms::Atom>) {
4427 if self.enabled {
4428 <V as VisitMut>::visit_mut_opt_atom(&mut self.visitor, node)
4429 } else {
4430 }
4431 }
4432
4433 #[inline]
4434 fn visit_mut_opt_namespace(&mut self, node: &mut Option<Namespace>) {
4435 if self.enabled {
4436 <V as VisitMut>::visit_mut_opt_namespace(&mut self.visitor, node)
4437 } else {
4438 }
4439 }
4440
4441 #[inline]
4442 fn visit_mut_processing_instruction(&mut self, node: &mut ProcessingInstruction) {
4443 if self.enabled {
4444 <V as VisitMut>::visit_mut_processing_instruction(&mut self.visitor, node)
4445 } else {
4446 }
4447 }
4448
4449 #[inline]
4450 fn visit_mut_span(&mut self, node: &mut swc_common::Span) {
4451 if self.enabled {
4452 <V as VisitMut>::visit_mut_span(&mut self.visitor, node)
4453 } else {
4454 }
4455 }
4456
4457 #[inline]
4458 fn visit_mut_text(&mut self, node: &mut Text) {
4459 if self.enabled {
4460 <V as VisitMut>::visit_mut_text(&mut self.visitor, node)
4461 } else {
4462 }
4463 }
4464
4465 #[inline]
4466 fn visit_mut_token(&mut self, node: &mut Token) {
4467 if self.enabled {
4468 <V as VisitMut>::visit_mut_token(&mut self.visitor, node)
4469 } else {
4470 }
4471 }
4472
4473 #[inline]
4474 fn visit_mut_token_and_span(&mut self, node: &mut TokenAndSpan) {
4475 if self.enabled {
4476 <V as VisitMut>::visit_mut_token_and_span(&mut self.visitor, node)
4477 } else {
4478 }
4479 }
4480}
4481#[doc = r" A trait implemented for types that can be visited using a visitor."]
4482pub trait VisitMutWith<V: ?Sized + VisitMut> {
4483 #[doc = r" Calls a visitor method (visitor.fold_xxx) with self."]
4484 fn visit_mut_with(&mut self, visitor: &mut V);
4485 #[doc = r" Visit children nodes of `self`` with `visitor`."]
4486 fn visit_mut_children_with(&mut self, visitor: &mut V);
4487}
4488impl<V: ?Sized + VisitMut> VisitMutWith<V> for Attribute {
4489 #[doc = "Calls [VisitMut`::visit_mut_attribute`] with `self`."]
4490 fn visit_mut_with(&mut self, visitor: &mut V) {
4491 <V as VisitMut>::visit_mut_attribute(visitor, self)
4492 }
4493
4494 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4495 match self {
4496 Attribute {
4497 span,
4498 namespace,
4499 prefix,
4500 name,
4501 raw_name,
4502 value,
4503 raw_value,
4504 } => {
4505 {
4506 <swc_common::Span as VisitMutWith<V>>::visit_mut_with(span, visitor)
4507 };
4508 {
4509 <Option<Namespace> as VisitMutWith<V>>::visit_mut_with(namespace, visitor)
4510 };
4511 {
4512 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(prefix, visitor)
4513 };
4514 {
4515 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(name, visitor)
4516 };
4517 {
4518 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(raw_name, visitor)
4519 };
4520 {
4521 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(value, visitor)
4522 };
4523 {
4524 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(raw_value, visitor)
4525 };
4526 }
4527 }
4528 }
4529}
4530impl<V: ?Sized + VisitMut> VisitMutWith<V> for AttributeToken {
4531 #[doc = "Calls [VisitMut`::visit_mut_attribute_token`] with `self`."]
4532 fn visit_mut_with(&mut self, visitor: &mut V) {
4533 <V as VisitMut>::visit_mut_attribute_token(visitor, self)
4534 }
4535
4536 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4537 match self {
4538 AttributeToken {
4539 span,
4540 name,
4541 raw_name,
4542 value,
4543 raw_value,
4544 } => {
4545 {
4546 <swc_common::Span as VisitMutWith<V>>::visit_mut_with(span, visitor)
4547 };
4548 {
4549 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(name, visitor)
4550 };
4551 {
4552 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(raw_name, visitor)
4553 };
4554 {
4555 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(value, visitor)
4556 };
4557 {
4558 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(raw_value, visitor)
4559 };
4560 }
4561 }
4562 }
4563}
4564impl<V: ?Sized + VisitMut> VisitMutWith<V> for CdataSection {
4565 #[doc = "Calls [VisitMut`::visit_mut_cdata_section`] with `self`."]
4566 fn visit_mut_with(&mut self, visitor: &mut V) {
4567 <V as VisitMut>::visit_mut_cdata_section(visitor, self)
4568 }
4569
4570 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4571 match self {
4572 CdataSection { span, data, raw } => {
4573 {
4574 <swc_common::Span as VisitMutWith<V>>::visit_mut_with(span, visitor)
4575 };
4576 {
4577 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(data, visitor)
4578 };
4579 {
4580 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(raw, visitor)
4581 };
4582 }
4583 }
4584 }
4585}
4586impl<V: ?Sized + VisitMut> VisitMutWith<V> for Child {
4587 #[doc = "Calls [VisitMut`::visit_mut_child`] with `self`."]
4588 fn visit_mut_with(&mut self, visitor: &mut V) {
4589 <V as VisitMut>::visit_mut_child(visitor, self)
4590 }
4591
4592 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4593 match self {
4594 Child::DocumentType { 0: _field_0 } => {
4595 <DocumentType as VisitMutWith<V>>::visit_mut_with(_field_0, visitor);
4596 }
4597 Child::Element { 0: _field_0 } => {
4598 <Element as VisitMutWith<V>>::visit_mut_with(_field_0, visitor);
4599 }
4600 Child::Text { 0: _field_0 } => {
4601 <Text as VisitMutWith<V>>::visit_mut_with(_field_0, visitor);
4602 }
4603 Child::CdataSection { 0: _field_0 } => {
4604 <CdataSection as VisitMutWith<V>>::visit_mut_with(_field_0, visitor);
4605 }
4606 Child::Comment { 0: _field_0 } => {
4607 <Comment as VisitMutWith<V>>::visit_mut_with(_field_0, visitor);
4608 }
4609 Child::ProcessingInstruction { 0: _field_0 } => {
4610 <ProcessingInstruction as VisitMutWith<V>>::visit_mut_with(_field_0, visitor);
4611 }
4612 }
4613 }
4614}
4615impl<V: ?Sized + VisitMut> VisitMutWith<V> for Comment {
4616 #[doc = "Calls [VisitMut`::visit_mut_comment`] with `self`."]
4617 fn visit_mut_with(&mut self, visitor: &mut V) {
4618 <V as VisitMut>::visit_mut_comment(visitor, self)
4619 }
4620
4621 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4622 match self {
4623 Comment { span, data, raw } => {
4624 {
4625 <swc_common::Span as VisitMutWith<V>>::visit_mut_with(span, visitor)
4626 };
4627 {
4628 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(data, visitor)
4629 };
4630 {
4631 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(raw, visitor)
4632 };
4633 }
4634 }
4635 }
4636}
4637impl<V: ?Sized + VisitMut> VisitMutWith<V> for Document {
4638 #[doc = "Calls [VisitMut`::visit_mut_document`] with `self`."]
4639 fn visit_mut_with(&mut self, visitor: &mut V) {
4640 <V as VisitMut>::visit_mut_document(visitor, self)
4641 }
4642
4643 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4644 match self {
4645 Document { span, children } => {
4646 {
4647 <swc_common::Span as VisitMutWith<V>>::visit_mut_with(span, visitor)
4648 };
4649 {
4650 <Vec<Child> as VisitMutWith<V>>::visit_mut_with(children, visitor)
4651 };
4652 }
4653 }
4654 }
4655}
4656impl<V: ?Sized + VisitMut> VisitMutWith<V> for DocumentMode {
4657 #[doc = "Calls [VisitMut`::visit_mut_document_mode`] with `self`."]
4658 fn visit_mut_with(&mut self, visitor: &mut V) {
4659 <V as VisitMut>::visit_mut_document_mode(visitor, self)
4660 }
4661
4662 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4663 match self {
4664 DocumentMode::NoQuirks => {}
4665 DocumentMode::LimitedQuirks => {}
4666 DocumentMode::Quirks => {}
4667 }
4668 }
4669}
4670impl<V: ?Sized + VisitMut> VisitMutWith<V> for DocumentType {
4671 #[doc = "Calls [VisitMut`::visit_mut_document_type`] with `self`."]
4672 fn visit_mut_with(&mut self, visitor: &mut V) {
4673 <V as VisitMut>::visit_mut_document_type(visitor, self)
4674 }
4675
4676 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4677 match self {
4678 DocumentType {
4679 span,
4680 name,
4681 public_id,
4682 system_id,
4683 raw,
4684 } => {
4685 {
4686 <swc_common::Span as VisitMutWith<V>>::visit_mut_with(span, visitor)
4687 };
4688 {
4689 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(name, visitor)
4690 };
4691 {
4692 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(public_id, visitor)
4693 };
4694 {
4695 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(system_id, visitor)
4696 };
4697 {
4698 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(raw, visitor)
4699 };
4700 }
4701 }
4702 }
4703}
4704impl<V: ?Sized + VisitMut> VisitMutWith<V> for Element {
4705 #[doc = "Calls [VisitMut`::visit_mut_element`] with `self`."]
4706 fn visit_mut_with(&mut self, visitor: &mut V) {
4707 <V as VisitMut>::visit_mut_element(visitor, self)
4708 }
4709
4710 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4711 match self {
4712 Element {
4713 span,
4714 tag_name,
4715 attributes,
4716 children,
4717 } => {
4718 {
4719 <swc_common::Span as VisitMutWith<V>>::visit_mut_with(span, visitor)
4720 };
4721 {
4722 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(tag_name, visitor)
4723 };
4724 {
4725 <Vec<Attribute> as VisitMutWith<V>>::visit_mut_with(attributes, visitor)
4726 };
4727 {
4728 <Vec<Child> as VisitMutWith<V>>::visit_mut_with(children, visitor)
4729 };
4730 }
4731 }
4732 }
4733}
4734impl<V: ?Sized + VisitMut> VisitMutWith<V> for Namespace {
4735 #[doc = "Calls [VisitMut`::visit_mut_namespace`] with `self`."]
4736 fn visit_mut_with(&mut self, visitor: &mut V) {
4737 <V as VisitMut>::visit_mut_namespace(visitor, self)
4738 }
4739
4740 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4741 match self {
4742 Namespace::HTML => {}
4743 Namespace::MATHML => {}
4744 Namespace::SVG => {}
4745 Namespace::XLINK => {}
4746 Namespace::XML => {}
4747 Namespace::XMLNS => {}
4748 }
4749 }
4750}
4751impl<V: ?Sized + VisitMut> VisitMutWith<V> for ProcessingInstruction {
4752 #[doc = "Calls [VisitMut`::visit_mut_processing_instruction`] with `self`."]
4753 fn visit_mut_with(&mut self, visitor: &mut V) {
4754 <V as VisitMut>::visit_mut_processing_instruction(visitor, self)
4755 }
4756
4757 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4758 match self {
4759 ProcessingInstruction { span, target, data } => {
4760 {
4761 <swc_common::Span as VisitMutWith<V>>::visit_mut_with(span, visitor)
4762 };
4763 {
4764 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(target, visitor)
4765 };
4766 {
4767 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(data, visitor)
4768 };
4769 }
4770 }
4771 }
4772}
4773impl<V: ?Sized + VisitMut> VisitMutWith<V> for Text {
4774 #[doc = "Calls [VisitMut`::visit_mut_text`] with `self`."]
4775 fn visit_mut_with(&mut self, visitor: &mut V) {
4776 <V as VisitMut>::visit_mut_text(visitor, self)
4777 }
4778
4779 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4780 match self {
4781 Text { span, data, raw } => {
4782 {
4783 <swc_common::Span as VisitMutWith<V>>::visit_mut_with(span, visitor)
4784 };
4785 {
4786 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(data, visitor)
4787 };
4788 {
4789 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(raw, visitor)
4790 };
4791 }
4792 }
4793 }
4794}
4795impl<V: ?Sized + VisitMut> VisitMutWith<V> for Token {
4796 #[doc = "Calls [VisitMut`::visit_mut_token`] with `self`."]
4797 fn visit_mut_with(&mut self, visitor: &mut V) {
4798 <V as VisitMut>::visit_mut_token(visitor, self)
4799 }
4800
4801 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4802 match self {
4803 Token::Doctype {
4804 name,
4805 public_id,
4806 system_id,
4807 raw,
4808 } => {
4809 {
4810 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(name, visitor)
4811 };
4812 {
4813 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(public_id, visitor)
4814 };
4815 {
4816 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(system_id, visitor)
4817 };
4818 {
4819 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(raw, visitor)
4820 };
4821 }
4822 Token::StartTag {
4823 tag_name,
4824 attributes,
4825 } => {
4826 {
4827 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(tag_name, visitor)
4828 };
4829 {
4830 <Vec<AttributeToken> as VisitMutWith<V>>::visit_mut_with(attributes, visitor)
4831 };
4832 }
4833 Token::EndTag {
4834 tag_name,
4835 attributes,
4836 } => {
4837 {
4838 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(tag_name, visitor)
4839 };
4840 {
4841 <Vec<AttributeToken> as VisitMutWith<V>>::visit_mut_with(attributes, visitor)
4842 };
4843 }
4844 Token::EmptyTag {
4845 tag_name,
4846 attributes,
4847 } => {
4848 {
4849 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(tag_name, visitor)
4850 };
4851 {
4852 <Vec<AttributeToken> as VisitMutWith<V>>::visit_mut_with(attributes, visitor)
4853 };
4854 }
4855 Token::Comment { data, raw } => {
4856 {
4857 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(data, visitor)
4858 };
4859 {
4860 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(raw, visitor)
4861 };
4862 }
4863 Token::Character { value, raw } => {
4864 {
4865 <Option<swc_atoms::Atom> as VisitMutWith<V>>::visit_mut_with(raw, visitor)
4866 };
4867 }
4868 Token::ProcessingInstruction { target, data } => {
4869 {
4870 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(target, visitor)
4871 };
4872 {
4873 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(data, visitor)
4874 };
4875 }
4876 Token::Cdata { data, raw } => {
4877 {
4878 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(data, visitor)
4879 };
4880 {
4881 <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(raw, visitor)
4882 };
4883 }
4884 Token::Eof => {}
4885 }
4886 }
4887}
4888impl<V: ?Sized + VisitMut> VisitMutWith<V> for TokenAndSpan {
4889 #[doc = "Calls [VisitMut`::visit_mut_token_and_span`] with `self`."]
4890 fn visit_mut_with(&mut self, visitor: &mut V) {
4891 <V as VisitMut>::visit_mut_token_and_span(visitor, self)
4892 }
4893
4894 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4895 match self {
4896 TokenAndSpan { span, token } => {
4897 {
4898 <swc_common::Span as VisitMutWith<V>>::visit_mut_with(span, visitor)
4899 };
4900 {
4901 <Token as VisitMutWith<V>>::visit_mut_with(token, visitor)
4902 };
4903 }
4904 }
4905 }
4906}
4907impl<V: ?Sized + VisitMut> VisitMutWith<V> for swc_atoms::Atom {
4908 #[doc = "Calls [VisitMut`::visit_mut_atom`] with `self`. (Extra impl)"]
4909 #[inline]
4910 fn visit_mut_with(&mut self, visitor: &mut V) {
4911 <V as VisitMut>::visit_mut_atom(visitor, self)
4912 }
4913
4914 #[inline]
4915 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4916 {}
4917 }
4918}
4919impl<V: ?Sized + VisitMut> VisitMutWith<V> for Vec<AttributeToken> {
4920 #[doc = "Calls [VisitMut`::visit_mut_attribute_tokens`] with `self`. (Extra impl)"]
4921 #[inline]
4922 fn visit_mut_with(&mut self, visitor: &mut V) {
4923 <V as VisitMut>::visit_mut_attribute_tokens(visitor, self)
4924 }
4925
4926 #[inline]
4927 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4928 self.iter_mut()
4929 .for_each(|item| <AttributeToken as VisitMutWith<V>>::visit_mut_with(item, visitor))
4930 }
4931}
4932impl<V: ?Sized + VisitMut> VisitMutWith<V> for Vec<Attribute> {
4933 #[doc = "Calls [VisitMut`::visit_mut_attributes`] with `self`. (Extra impl)"]
4934 #[inline]
4935 fn visit_mut_with(&mut self, visitor: &mut V) {
4936 <V as VisitMut>::visit_mut_attributes(visitor, self)
4937 }
4938
4939 #[inline]
4940 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4941 self.iter_mut()
4942 .for_each(|item| <Attribute as VisitMutWith<V>>::visit_mut_with(item, visitor))
4943 }
4944}
4945impl<V: ?Sized + VisitMut> VisitMutWith<V> for Vec<Child> {
4946 #[doc = "Calls [VisitMut`::visit_mut_childs`] with `self`. (Extra impl)"]
4947 #[inline]
4948 fn visit_mut_with(&mut self, visitor: &mut V) {
4949 <V as VisitMut>::visit_mut_childs(visitor, self)
4950 }
4951
4952 #[inline]
4953 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4954 self.iter_mut()
4955 .for_each(|item| <Child as VisitMutWith<V>>::visit_mut_with(item, visitor))
4956 }
4957}
4958impl<V: ?Sized + VisitMut> VisitMutWith<V> for Option<swc_atoms::Atom> {
4959 #[doc = "Calls [VisitMut`::visit_mut_opt_atom`] with `self`. (Extra impl)"]
4960 #[inline]
4961 fn visit_mut_with(&mut self, visitor: &mut V) {
4962 <V as VisitMut>::visit_mut_opt_atom(visitor, self)
4963 }
4964
4965 #[inline]
4966 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4967 match self {
4968 Some(inner) => <swc_atoms::Atom as VisitMutWith<V>>::visit_mut_with(inner, visitor),
4969 None => {}
4970 }
4971 }
4972}
4973impl<V: ?Sized + VisitMut> VisitMutWith<V> for Option<Namespace> {
4974 #[doc = "Calls [VisitMut`::visit_mut_opt_namespace`] with `self`. (Extra impl)"]
4975 #[inline]
4976 fn visit_mut_with(&mut self, visitor: &mut V) {
4977 <V as VisitMut>::visit_mut_opt_namespace(visitor, self)
4978 }
4979
4980 #[inline]
4981 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4982 match self {
4983 Some(inner) => <Namespace as VisitMutWith<V>>::visit_mut_with(inner, visitor),
4984 None => {}
4985 }
4986 }
4987}
4988impl<V: ?Sized + VisitMut> VisitMutWith<V> for swc_common::Span {
4989 #[doc = "Calls [VisitMut`::visit_mut_span`] with `self`. (Extra impl)"]
4990 #[inline]
4991 fn visit_mut_with(&mut self, visitor: &mut V) {
4992 <V as VisitMut>::visit_mut_span(visitor, self)
4993 }
4994
4995 #[inline]
4996 fn visit_mut_children_with(&mut self, visitor: &mut V) {
4997 {}
4998 }
4999}
5000impl<V, T> VisitMutWith<V> for std::boxed::Box<T>
5001where
5002 V: ?Sized + VisitMut,
5003 T: VisitMutWith<V>,
5004{
5005 #[inline]
5006 fn visit_mut_with(&mut self, visitor: &mut V) {
5007 let v = <T as VisitMutWith<V>>::visit_mut_with(&mut **self, visitor);
5008 v
5009 }
5010
5011 #[inline]
5012 fn visit_mut_children_with(&mut self, visitor: &mut V) {
5013 let v = <T as VisitMutWith<V>>::visit_mut_children_with(&mut **self, visitor);
5014 v
5015 }
5016}
5017#[doc = r" A visitor trait for traversing the AST."]
5018#[cfg(any(docsrs, feature = "path"))]
5019#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
5020pub trait VisitMutAstPath {
5021 #[doc = "Visit a node of type `swc_atoms :: Atom`.\n\nBy default, this method calls \
5022 [`swc_atoms :: Atom::visit_mut_children_with_ast_path`]. If you want to recurse, you \
5023 need to call it manually."]
5024 #[inline]
5025 fn visit_mut_atom(&mut self, node: &mut swc_atoms::Atom, __ast_path: &mut AstKindPath) {
5026 <swc_atoms::Atom as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5027 node, self, __ast_path,
5028 )
5029 }
5030 #[doc = "Visit a node of type `Attribute`.\n\nBy default, this method calls \
5031 [`Attribute::visit_mut_children_with_ast_path`]. If you want to recurse, you need to \
5032 call it manually."]
5033 #[inline]
5034 fn visit_mut_attribute(&mut self, node: &mut Attribute, __ast_path: &mut AstKindPath) {
5035 <Attribute as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5036 node, self, __ast_path,
5037 )
5038 }
5039 #[doc = "Visit a node of type `AttributeToken`.\n\nBy default, this method calls \
5040 [`AttributeToken::visit_mut_children_with_ast_path`]. If you want to recurse, you \
5041 need to call it manually."]
5042 #[inline]
5043 fn visit_mut_attribute_token(
5044 &mut self,
5045 node: &mut AttributeToken,
5046 __ast_path: &mut AstKindPath,
5047 ) {
5048 <AttributeToken as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5049 node, self, __ast_path,
5050 )
5051 }
5052 #[doc = "Visit a node of type `Vec < AttributeToken >`.\n\nBy default, this method calls [`Vec \
5053 < AttributeToken >::visit_mut_children_with_ast_path`]. If you want to recurse, you \
5054 need to call it manually."]
5055 #[inline]
5056 fn visit_mut_attribute_tokens(
5057 &mut self,
5058 node: &mut Vec<AttributeToken>,
5059 __ast_path: &mut AstKindPath,
5060 ) {
5061 <Vec<AttributeToken> as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5062 node, self, __ast_path,
5063 )
5064 }
5065 #[doc = "Visit a node of type `Vec < Attribute >`.\n\nBy default, this method calls [`Vec < \
5066 Attribute >::visit_mut_children_with_ast_path`]. If you want to recurse, you need to \
5067 call it manually."]
5068 #[inline]
5069 fn visit_mut_attributes(&mut self, node: &mut Vec<Attribute>, __ast_path: &mut AstKindPath) {
5070 <Vec<Attribute> as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5071 node, self, __ast_path,
5072 )
5073 }
5074 #[doc = "Visit a node of type `CdataSection`.\n\nBy default, this method calls \
5075 [`CdataSection::visit_mut_children_with_ast_path`]. If you want to recurse, you need \
5076 to call it manually."]
5077 #[inline]
5078 fn visit_mut_cdata_section(&mut self, node: &mut CdataSection, __ast_path: &mut AstKindPath) {
5079 <CdataSection as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5080 node, self, __ast_path,
5081 )
5082 }
5083 #[doc = "Visit a node of type `Child`.\n\nBy default, this method calls \
5084 [`Child::visit_mut_children_with_ast_path`]. If you want to recurse, you need to call \
5085 it manually."]
5086 #[inline]
5087 fn visit_mut_child(&mut self, node: &mut Child, __ast_path: &mut AstKindPath) {
5088 <Child as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5089 node, self, __ast_path,
5090 )
5091 }
5092 #[doc = "Visit a node of type `Vec < Child >`.\n\nBy default, this method calls [`Vec < Child \
5093 >::visit_mut_children_with_ast_path`]. If you want to recurse, you need to call it \
5094 manually."]
5095 #[inline]
5096 fn visit_mut_childs(&mut self, node: &mut Vec<Child>, __ast_path: &mut AstKindPath) {
5097 <Vec<Child> as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5098 node, self, __ast_path,
5099 )
5100 }
5101 #[doc = "Visit a node of type `Comment`.\n\nBy default, this method calls \
5102 [`Comment::visit_mut_children_with_ast_path`]. If you want to recurse, you need to \
5103 call it manually."]
5104 #[inline]
5105 fn visit_mut_comment(&mut self, node: &mut Comment, __ast_path: &mut AstKindPath) {
5106 <Comment as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5107 node, self, __ast_path,
5108 )
5109 }
5110 #[doc = "Visit a node of type `Document`.\n\nBy default, this method calls \
5111 [`Document::visit_mut_children_with_ast_path`]. If you want to recurse, you need to \
5112 call it manually."]
5113 #[inline]
5114 fn visit_mut_document(&mut self, node: &mut Document, __ast_path: &mut AstKindPath) {
5115 <Document as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5116 node, self, __ast_path,
5117 )
5118 }
5119 #[doc = "Visit a node of type `DocumentMode`.\n\nBy default, this method calls \
5120 [`DocumentMode::visit_mut_children_with_ast_path`]. If you want to recurse, you need \
5121 to call it manually."]
5122 #[inline]
5123 fn visit_mut_document_mode(&mut self, node: &mut DocumentMode, __ast_path: &mut AstKindPath) {
5124 <DocumentMode as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5125 node, self, __ast_path,
5126 )
5127 }
5128 #[doc = "Visit a node of type `DocumentType`.\n\nBy default, this method calls \
5129 [`DocumentType::visit_mut_children_with_ast_path`]. If you want to recurse, you need \
5130 to call it manually."]
5131 #[inline]
5132 fn visit_mut_document_type(&mut self, node: &mut DocumentType, __ast_path: &mut AstKindPath) {
5133 <DocumentType as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5134 node, self, __ast_path,
5135 )
5136 }
5137 #[doc = "Visit a node of type `Element`.\n\nBy default, this method calls \
5138 [`Element::visit_mut_children_with_ast_path`]. If you want to recurse, you need to \
5139 call it manually."]
5140 #[inline]
5141 fn visit_mut_element(&mut self, node: &mut Element, __ast_path: &mut AstKindPath) {
5142 <Element as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5143 node, self, __ast_path,
5144 )
5145 }
5146 #[doc = "Visit a node of type `Namespace`.\n\nBy default, this method calls \
5147 [`Namespace::visit_mut_children_with_ast_path`]. If you want to recurse, you need to \
5148 call it manually."]
5149 #[inline]
5150 fn visit_mut_namespace(&mut self, node: &mut Namespace, __ast_path: &mut AstKindPath) {
5151 <Namespace as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5152 node, self, __ast_path,
5153 )
5154 }
5155 #[doc = "Visit a node of type `Option < swc_atoms :: Atom >`.\n\nBy default, this method calls \
5156 [`Option < swc_atoms :: Atom >::visit_mut_children_with_ast_path`]. If you want to \
5157 recurse, you need to call it manually."]
5158 #[inline]
5159 fn visit_mut_opt_atom(
5160 &mut self,
5161 node: &mut Option<swc_atoms::Atom>,
5162 __ast_path: &mut AstKindPath,
5163 ) {
5164 <Option<swc_atoms::Atom> as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5165 node, self, __ast_path,
5166 )
5167 }
5168 #[doc = "Visit a node of type `Option < Namespace >`.\n\nBy default, this method calls \
5169 [`Option < Namespace >::visit_mut_children_with_ast_path`]. If you want to recurse, \
5170 you need to call it manually."]
5171 #[inline]
5172 fn visit_mut_opt_namespace(
5173 &mut self,
5174 node: &mut Option<Namespace>,
5175 __ast_path: &mut AstKindPath,
5176 ) {
5177 <Option<Namespace> as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5178 node, self, __ast_path,
5179 )
5180 }
5181 #[doc = "Visit a node of type `ProcessingInstruction`.\n\nBy default, this method calls \
5182 [`ProcessingInstruction::visit_mut_children_with_ast_path`]. If you want to recurse, \
5183 you need to call it manually."]
5184 #[inline]
5185 fn visit_mut_processing_instruction(
5186 &mut self,
5187 node: &mut ProcessingInstruction,
5188 __ast_path: &mut AstKindPath,
5189 ) {
5190 <ProcessingInstruction as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5191 node, self, __ast_path,
5192 )
5193 }
5194 #[doc = "Visit a node of type `swc_common :: Span`.\n\nBy default, this method calls \
5195 [`swc_common :: Span::visit_mut_children_with_ast_path`]. If you want to recurse, you \
5196 need to call it manually."]
5197 #[inline]
5198 fn visit_mut_span(&mut self, node: &mut swc_common::Span, __ast_path: &mut AstKindPath) {
5199 <swc_common::Span as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5200 node, self, __ast_path,
5201 )
5202 }
5203 #[doc = "Visit a node of type `Text`.\n\nBy default, this method calls \
5204 [`Text::visit_mut_children_with_ast_path`]. If you want to recurse, you need to call \
5205 it manually."]
5206 #[inline]
5207 fn visit_mut_text(&mut self, node: &mut Text, __ast_path: &mut AstKindPath) {
5208 <Text as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5209 node, self, __ast_path,
5210 )
5211 }
5212 #[doc = "Visit a node of type `Token`.\n\nBy default, this method calls \
5213 [`Token::visit_mut_children_with_ast_path`]. If you want to recurse, you need to call \
5214 it manually."]
5215 #[inline]
5216 fn visit_mut_token(&mut self, node: &mut Token, __ast_path: &mut AstKindPath) {
5217 <Token as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5218 node, self, __ast_path,
5219 )
5220 }
5221 #[doc = "Visit a node of type `TokenAndSpan`.\n\nBy default, this method calls \
5222 [`TokenAndSpan::visit_mut_children_with_ast_path`]. If you want to recurse, you need \
5223 to call it manually."]
5224 #[inline]
5225 fn visit_mut_token_and_span(&mut self, node: &mut TokenAndSpan, __ast_path: &mut AstKindPath) {
5226 <TokenAndSpan as VisitMutWithAstPath<Self>>::visit_mut_children_with_ast_path(
5227 node, self, __ast_path,
5228 )
5229 }
5230}
5231#[cfg(any(docsrs, feature = "path"))]
5232#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
5233impl<V> VisitMutAstPath for &mut V
5234where
5235 V: ?Sized + VisitMutAstPath,
5236{
5237 #[inline]
5238 fn visit_mut_atom(&mut self, node: &mut swc_atoms::Atom, __ast_path: &mut AstKindPath) {
5239 <V as VisitMutAstPath>::visit_mut_atom(&mut **self, node, __ast_path)
5240 }
5241
5242 #[inline]
5243 fn visit_mut_attribute(&mut self, node: &mut Attribute, __ast_path: &mut AstKindPath) {
5244 <V as VisitMutAstPath>::visit_mut_attribute(&mut **self, node, __ast_path)
5245 }
5246
5247 #[inline]
5248 fn visit_mut_attribute_token(
5249 &mut self,
5250 node: &mut AttributeToken,
5251 __ast_path: &mut AstKindPath,
5252 ) {
5253 <V as VisitMutAstPath>::visit_mut_attribute_token(&mut **self, node, __ast_path)
5254 }
5255
5256 #[inline]
5257 fn visit_mut_attribute_tokens(
5258 &mut self,
5259 node: &mut Vec<AttributeToken>,
5260 __ast_path: &mut AstKindPath,
5261 ) {
5262 <V as VisitMutAstPath>::visit_mut_attribute_tokens(&mut **self, node, __ast_path)
5263 }
5264
5265 #[inline]
5266 fn visit_mut_attributes(&mut self, node: &mut Vec<Attribute>, __ast_path: &mut AstKindPath) {
5267 <V as VisitMutAstPath>::visit_mut_attributes(&mut **self, node, __ast_path)
5268 }
5269
5270 #[inline]
5271 fn visit_mut_cdata_section(&mut self, node: &mut CdataSection, __ast_path: &mut AstKindPath) {
5272 <V as VisitMutAstPath>::visit_mut_cdata_section(&mut **self, node, __ast_path)
5273 }
5274
5275 #[inline]
5276 fn visit_mut_child(&mut self, node: &mut Child, __ast_path: &mut AstKindPath) {
5277 <V as VisitMutAstPath>::visit_mut_child(&mut **self, node, __ast_path)
5278 }
5279
5280 #[inline]
5281 fn visit_mut_childs(&mut self, node: &mut Vec<Child>, __ast_path: &mut AstKindPath) {
5282 <V as VisitMutAstPath>::visit_mut_childs(&mut **self, node, __ast_path)
5283 }
5284
5285 #[inline]
5286 fn visit_mut_comment(&mut self, node: &mut Comment, __ast_path: &mut AstKindPath) {
5287 <V as VisitMutAstPath>::visit_mut_comment(&mut **self, node, __ast_path)
5288 }
5289
5290 #[inline]
5291 fn visit_mut_document(&mut self, node: &mut Document, __ast_path: &mut AstKindPath) {
5292 <V as VisitMutAstPath>::visit_mut_document(&mut **self, node, __ast_path)
5293 }
5294
5295 #[inline]
5296 fn visit_mut_document_mode(&mut self, node: &mut DocumentMode, __ast_path: &mut AstKindPath) {
5297 <V as VisitMutAstPath>::visit_mut_document_mode(&mut **self, node, __ast_path)
5298 }
5299
5300 #[inline]
5301 fn visit_mut_document_type(&mut self, node: &mut DocumentType, __ast_path: &mut AstKindPath) {
5302 <V as VisitMutAstPath>::visit_mut_document_type(&mut **self, node, __ast_path)
5303 }
5304
5305 #[inline]
5306 fn visit_mut_element(&mut self, node: &mut Element, __ast_path: &mut AstKindPath) {
5307 <V as VisitMutAstPath>::visit_mut_element(&mut **self, node, __ast_path)
5308 }
5309
5310 #[inline]
5311 fn visit_mut_namespace(&mut self, node: &mut Namespace, __ast_path: &mut AstKindPath) {
5312 <V as VisitMutAstPath>::visit_mut_namespace(&mut **self, node, __ast_path)
5313 }
5314
5315 #[inline]
5316 fn visit_mut_opt_atom(
5317 &mut self,
5318 node: &mut Option<swc_atoms::Atom>,
5319 __ast_path: &mut AstKindPath,
5320 ) {
5321 <V as VisitMutAstPath>::visit_mut_opt_atom(&mut **self, node, __ast_path)
5322 }
5323
5324 #[inline]
5325 fn visit_mut_opt_namespace(
5326 &mut self,
5327 node: &mut Option<Namespace>,
5328 __ast_path: &mut AstKindPath,
5329 ) {
5330 <V as VisitMutAstPath>::visit_mut_opt_namespace(&mut **self, node, __ast_path)
5331 }
5332
5333 #[inline]
5334 fn visit_mut_processing_instruction(
5335 &mut self,
5336 node: &mut ProcessingInstruction,
5337 __ast_path: &mut AstKindPath,
5338 ) {
5339 <V as VisitMutAstPath>::visit_mut_processing_instruction(&mut **self, node, __ast_path)
5340 }
5341
5342 #[inline]
5343 fn visit_mut_span(&mut self, node: &mut swc_common::Span, __ast_path: &mut AstKindPath) {
5344 <V as VisitMutAstPath>::visit_mut_span(&mut **self, node, __ast_path)
5345 }
5346
5347 #[inline]
5348 fn visit_mut_text(&mut self, node: &mut Text, __ast_path: &mut AstKindPath) {
5349 <V as VisitMutAstPath>::visit_mut_text(&mut **self, node, __ast_path)
5350 }
5351
5352 #[inline]
5353 fn visit_mut_token(&mut self, node: &mut Token, __ast_path: &mut AstKindPath) {
5354 <V as VisitMutAstPath>::visit_mut_token(&mut **self, node, __ast_path)
5355 }
5356
5357 #[inline]
5358 fn visit_mut_token_and_span(&mut self, node: &mut TokenAndSpan, __ast_path: &mut AstKindPath) {
5359 <V as VisitMutAstPath>::visit_mut_token_and_span(&mut **self, node, __ast_path)
5360 }
5361}
5362#[cfg(any(docsrs, feature = "path"))]
5363#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
5364impl<V> VisitMutAstPath for Box<V>
5365where
5366 V: ?Sized + VisitMutAstPath,
5367{
5368 #[inline]
5369 fn visit_mut_atom(&mut self, node: &mut swc_atoms::Atom, __ast_path: &mut AstKindPath) {
5370 <V as VisitMutAstPath>::visit_mut_atom(&mut **self, node, __ast_path)
5371 }
5372
5373 #[inline]
5374 fn visit_mut_attribute(&mut self, node: &mut Attribute, __ast_path: &mut AstKindPath) {
5375 <V as VisitMutAstPath>::visit_mut_attribute(&mut **self, node, __ast_path)
5376 }
5377
5378 #[inline]
5379 fn visit_mut_attribute_token(
5380 &mut self,
5381 node: &mut AttributeToken,
5382 __ast_path: &mut AstKindPath,
5383 ) {
5384 <V as VisitMutAstPath>::visit_mut_attribute_token(&mut **self, node, __ast_path)
5385 }
5386
5387 #[inline]
5388 fn visit_mut_attribute_tokens(
5389 &mut self,
5390 node: &mut Vec<AttributeToken>,
5391 __ast_path: &mut AstKindPath,
5392 ) {
5393 <V as VisitMutAstPath>::visit_mut_attribute_tokens(&mut **self, node, __ast_path)
5394 }
5395
5396 #[inline]
5397 fn visit_mut_attributes(&mut self, node: &mut Vec<Attribute>, __ast_path: &mut AstKindPath) {
5398 <V as VisitMutAstPath>::visit_mut_attributes(&mut **self, node, __ast_path)
5399 }
5400
5401 #[inline]
5402 fn visit_mut_cdata_section(&mut self, node: &mut CdataSection, __ast_path: &mut AstKindPath) {
5403 <V as VisitMutAstPath>::visit_mut_cdata_section(&mut **self, node, __ast_path)
5404 }
5405
5406 #[inline]
5407 fn visit_mut_child(&mut self, node: &mut Child, __ast_path: &mut AstKindPath) {
5408 <V as VisitMutAstPath>::visit_mut_child(&mut **self, node, __ast_path)
5409 }
5410
5411 #[inline]
5412 fn visit_mut_childs(&mut self, node: &mut Vec<Child>, __ast_path: &mut AstKindPath) {
5413 <V as VisitMutAstPath>::visit_mut_childs(&mut **self, node, __ast_path)
5414 }
5415
5416 #[inline]
5417 fn visit_mut_comment(&mut self, node: &mut Comment, __ast_path: &mut AstKindPath) {
5418 <V as VisitMutAstPath>::visit_mut_comment(&mut **self, node, __ast_path)
5419 }
5420
5421 #[inline]
5422 fn visit_mut_document(&mut self, node: &mut Document, __ast_path: &mut AstKindPath) {
5423 <V as VisitMutAstPath>::visit_mut_document(&mut **self, node, __ast_path)
5424 }
5425
5426 #[inline]
5427 fn visit_mut_document_mode(&mut self, node: &mut DocumentMode, __ast_path: &mut AstKindPath) {
5428 <V as VisitMutAstPath>::visit_mut_document_mode(&mut **self, node, __ast_path)
5429 }
5430
5431 #[inline]
5432 fn visit_mut_document_type(&mut self, node: &mut DocumentType, __ast_path: &mut AstKindPath) {
5433 <V as VisitMutAstPath>::visit_mut_document_type(&mut **self, node, __ast_path)
5434 }
5435
5436 #[inline]
5437 fn visit_mut_element(&mut self, node: &mut Element, __ast_path: &mut AstKindPath) {
5438 <V as VisitMutAstPath>::visit_mut_element(&mut **self, node, __ast_path)
5439 }
5440
5441 #[inline]
5442 fn visit_mut_namespace(&mut self, node: &mut Namespace, __ast_path: &mut AstKindPath) {
5443 <V as VisitMutAstPath>::visit_mut_namespace(&mut **self, node, __ast_path)
5444 }
5445
5446 #[inline]
5447 fn visit_mut_opt_atom(
5448 &mut self,
5449 node: &mut Option<swc_atoms::Atom>,
5450 __ast_path: &mut AstKindPath,
5451 ) {
5452 <V as VisitMutAstPath>::visit_mut_opt_atom(&mut **self, node, __ast_path)
5453 }
5454
5455 #[inline]
5456 fn visit_mut_opt_namespace(
5457 &mut self,
5458 node: &mut Option<Namespace>,
5459 __ast_path: &mut AstKindPath,
5460 ) {
5461 <V as VisitMutAstPath>::visit_mut_opt_namespace(&mut **self, node, __ast_path)
5462 }
5463
5464 #[inline]
5465 fn visit_mut_processing_instruction(
5466 &mut self,
5467 node: &mut ProcessingInstruction,
5468 __ast_path: &mut AstKindPath,
5469 ) {
5470 <V as VisitMutAstPath>::visit_mut_processing_instruction(&mut **self, node, __ast_path)
5471 }
5472
5473 #[inline]
5474 fn visit_mut_span(&mut self, node: &mut swc_common::Span, __ast_path: &mut AstKindPath) {
5475 <V as VisitMutAstPath>::visit_mut_span(&mut **self, node, __ast_path)
5476 }
5477
5478 #[inline]
5479 fn visit_mut_text(&mut self, node: &mut Text, __ast_path: &mut AstKindPath) {
5480 <V as VisitMutAstPath>::visit_mut_text(&mut **self, node, __ast_path)
5481 }
5482
5483 #[inline]
5484 fn visit_mut_token(&mut self, node: &mut Token, __ast_path: &mut AstKindPath) {
5485 <V as VisitMutAstPath>::visit_mut_token(&mut **self, node, __ast_path)
5486 }
5487
5488 #[inline]
5489 fn visit_mut_token_and_span(&mut self, node: &mut TokenAndSpan, __ast_path: &mut AstKindPath) {
5490 <V as VisitMutAstPath>::visit_mut_token_and_span(&mut **self, node, __ast_path)
5491 }
5492}
5493#[cfg(any(docsrs, feature = "path"))]
5494#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
5495impl<A, B> VisitMutAstPath for ::swc_visit::Either<A, B>
5496where
5497 A: VisitMutAstPath,
5498 B: VisitMutAstPath,
5499{
5500 #[inline]
5501 fn visit_mut_atom(&mut self, node: &mut swc_atoms::Atom, __ast_path: &mut AstKindPath) {
5502 match self {
5503 swc_visit::Either::Left(visitor) => {
5504 VisitMutAstPath::visit_mut_atom(visitor, node, __ast_path)
5505 }
5506 swc_visit::Either::Right(visitor) => {
5507 VisitMutAstPath::visit_mut_atom(visitor, node, __ast_path)
5508 }
5509 }
5510 }
5511
5512 #[inline]
5513 fn visit_mut_attribute(&mut self, node: &mut Attribute, __ast_path: &mut AstKindPath) {
5514 match self {
5515 swc_visit::Either::Left(visitor) => {
5516 VisitMutAstPath::visit_mut_attribute(visitor, node, __ast_path)
5517 }
5518 swc_visit::Either::Right(visitor) => {
5519 VisitMutAstPath::visit_mut_attribute(visitor, node, __ast_path)
5520 }
5521 }
5522 }
5523
5524 #[inline]
5525 fn visit_mut_attribute_token(
5526 &mut self,
5527 node: &mut AttributeToken,
5528 __ast_path: &mut AstKindPath,
5529 ) {
5530 match self {
5531 swc_visit::Either::Left(visitor) => {
5532 VisitMutAstPath::visit_mut_attribute_token(visitor, node, __ast_path)
5533 }
5534 swc_visit::Either::Right(visitor) => {
5535 VisitMutAstPath::visit_mut_attribute_token(visitor, node, __ast_path)
5536 }
5537 }
5538 }
5539
5540 #[inline]
5541 fn visit_mut_attribute_tokens(
5542 &mut self,
5543 node: &mut Vec<AttributeToken>,
5544 __ast_path: &mut AstKindPath,
5545 ) {
5546 match self {
5547 swc_visit::Either::Left(visitor) => {
5548 VisitMutAstPath::visit_mut_attribute_tokens(visitor, node, __ast_path)
5549 }
5550 swc_visit::Either::Right(visitor) => {
5551 VisitMutAstPath::visit_mut_attribute_tokens(visitor, node, __ast_path)
5552 }
5553 }
5554 }
5555
5556 #[inline]
5557 fn visit_mut_attributes(&mut self, node: &mut Vec<Attribute>, __ast_path: &mut AstKindPath) {
5558 match self {
5559 swc_visit::Either::Left(visitor) => {
5560 VisitMutAstPath::visit_mut_attributes(visitor, node, __ast_path)
5561 }
5562 swc_visit::Either::Right(visitor) => {
5563 VisitMutAstPath::visit_mut_attributes(visitor, node, __ast_path)
5564 }
5565 }
5566 }
5567
5568 #[inline]
5569 fn visit_mut_cdata_section(&mut self, node: &mut CdataSection, __ast_path: &mut AstKindPath) {
5570 match self {
5571 swc_visit::Either::Left(visitor) => {
5572 VisitMutAstPath::visit_mut_cdata_section(visitor, node, __ast_path)
5573 }
5574 swc_visit::Either::Right(visitor) => {
5575 VisitMutAstPath::visit_mut_cdata_section(visitor, node, __ast_path)
5576 }
5577 }
5578 }
5579
5580 #[inline]
5581 fn visit_mut_child(&mut self, node: &mut Child, __ast_path: &mut AstKindPath) {
5582 match self {
5583 swc_visit::Either::Left(visitor) => {
5584 VisitMutAstPath::visit_mut_child(visitor, node, __ast_path)
5585 }
5586 swc_visit::Either::Right(visitor) => {
5587 VisitMutAstPath::visit_mut_child(visitor, node, __ast_path)
5588 }
5589 }
5590 }
5591
5592 #[inline]
5593 fn visit_mut_childs(&mut self, node: &mut Vec<Child>, __ast_path: &mut AstKindPath) {
5594 match self {
5595 swc_visit::Either::Left(visitor) => {
5596 VisitMutAstPath::visit_mut_childs(visitor, node, __ast_path)
5597 }
5598 swc_visit::Either::Right(visitor) => {
5599 VisitMutAstPath::visit_mut_childs(visitor, node, __ast_path)
5600 }
5601 }
5602 }
5603
5604 #[inline]
5605 fn visit_mut_comment(&mut self, node: &mut Comment, __ast_path: &mut AstKindPath) {
5606 match self {
5607 swc_visit::Either::Left(visitor) => {
5608 VisitMutAstPath::visit_mut_comment(visitor, node, __ast_path)
5609 }
5610 swc_visit::Either::Right(visitor) => {
5611 VisitMutAstPath::visit_mut_comment(visitor, node, __ast_path)
5612 }
5613 }
5614 }
5615
5616 #[inline]
5617 fn visit_mut_document(&mut self, node: &mut Document, __ast_path: &mut AstKindPath) {
5618 match self {
5619 swc_visit::Either::Left(visitor) => {
5620 VisitMutAstPath::visit_mut_document(visitor, node, __ast_path)
5621 }
5622 swc_visit::Either::Right(visitor) => {
5623 VisitMutAstPath::visit_mut_document(visitor, node, __ast_path)
5624 }
5625 }
5626 }
5627
5628 #[inline]
5629 fn visit_mut_document_mode(&mut self, node: &mut DocumentMode, __ast_path: &mut AstKindPath) {
5630 match self {
5631 swc_visit::Either::Left(visitor) => {
5632 VisitMutAstPath::visit_mut_document_mode(visitor, node, __ast_path)
5633 }
5634 swc_visit::Either::Right(visitor) => {
5635 VisitMutAstPath::visit_mut_document_mode(visitor, node, __ast_path)
5636 }
5637 }
5638 }
5639
5640 #[inline]
5641 fn visit_mut_document_type(&mut self, node: &mut DocumentType, __ast_path: &mut AstKindPath) {
5642 match self {
5643 swc_visit::Either::Left(visitor) => {
5644 VisitMutAstPath::visit_mut_document_type(visitor, node, __ast_path)
5645 }
5646 swc_visit::Either::Right(visitor) => {
5647 VisitMutAstPath::visit_mut_document_type(visitor, node, __ast_path)
5648 }
5649 }
5650 }
5651
5652 #[inline]
5653 fn visit_mut_element(&mut self, node: &mut Element, __ast_path: &mut AstKindPath) {
5654 match self {
5655 swc_visit::Either::Left(visitor) => {
5656 VisitMutAstPath::visit_mut_element(visitor, node, __ast_path)
5657 }
5658 swc_visit::Either::Right(visitor) => {
5659 VisitMutAstPath::visit_mut_element(visitor, node, __ast_path)
5660 }
5661 }
5662 }
5663
5664 #[inline]
5665 fn visit_mut_namespace(&mut self, node: &mut Namespace, __ast_path: &mut AstKindPath) {
5666 match self {
5667 swc_visit::Either::Left(visitor) => {
5668 VisitMutAstPath::visit_mut_namespace(visitor, node, __ast_path)
5669 }
5670 swc_visit::Either::Right(visitor) => {
5671 VisitMutAstPath::visit_mut_namespace(visitor, node, __ast_path)
5672 }
5673 }
5674 }
5675
5676 #[inline]
5677 fn visit_mut_opt_atom(
5678 &mut self,
5679 node: &mut Option<swc_atoms::Atom>,
5680 __ast_path: &mut AstKindPath,
5681 ) {
5682 match self {
5683 swc_visit::Either::Left(visitor) => {
5684 VisitMutAstPath::visit_mut_opt_atom(visitor, node, __ast_path)
5685 }
5686 swc_visit::Either::Right(visitor) => {
5687 VisitMutAstPath::visit_mut_opt_atom(visitor, node, __ast_path)
5688 }
5689 }
5690 }
5691
5692 #[inline]
5693 fn visit_mut_opt_namespace(
5694 &mut self,
5695 node: &mut Option<Namespace>,
5696 __ast_path: &mut AstKindPath,
5697 ) {
5698 match self {
5699 swc_visit::Either::Left(visitor) => {
5700 VisitMutAstPath::visit_mut_opt_namespace(visitor, node, __ast_path)
5701 }
5702 swc_visit::Either::Right(visitor) => {
5703 VisitMutAstPath::visit_mut_opt_namespace(visitor, node, __ast_path)
5704 }
5705 }
5706 }
5707
5708 #[inline]
5709 fn visit_mut_processing_instruction(
5710 &mut self,
5711 node: &mut ProcessingInstruction,
5712 __ast_path: &mut AstKindPath,
5713 ) {
5714 match self {
5715 swc_visit::Either::Left(visitor) => {
5716 VisitMutAstPath::visit_mut_processing_instruction(visitor, node, __ast_path)
5717 }
5718 swc_visit::Either::Right(visitor) => {
5719 VisitMutAstPath::visit_mut_processing_instruction(visitor, node, __ast_path)
5720 }
5721 }
5722 }
5723
5724 #[inline]
5725 fn visit_mut_span(&mut self, node: &mut swc_common::Span, __ast_path: &mut AstKindPath) {
5726 match self {
5727 swc_visit::Either::Left(visitor) => {
5728 VisitMutAstPath::visit_mut_span(visitor, node, __ast_path)
5729 }
5730 swc_visit::Either::Right(visitor) => {
5731 VisitMutAstPath::visit_mut_span(visitor, node, __ast_path)
5732 }
5733 }
5734 }
5735
5736 #[inline]
5737 fn visit_mut_text(&mut self, node: &mut Text, __ast_path: &mut AstKindPath) {
5738 match self {
5739 swc_visit::Either::Left(visitor) => {
5740 VisitMutAstPath::visit_mut_text(visitor, node, __ast_path)
5741 }
5742 swc_visit::Either::Right(visitor) => {
5743 VisitMutAstPath::visit_mut_text(visitor, node, __ast_path)
5744 }
5745 }
5746 }
5747
5748 #[inline]
5749 fn visit_mut_token(&mut self, node: &mut Token, __ast_path: &mut AstKindPath) {
5750 match self {
5751 swc_visit::Either::Left(visitor) => {
5752 VisitMutAstPath::visit_mut_token(visitor, node, __ast_path)
5753 }
5754 swc_visit::Either::Right(visitor) => {
5755 VisitMutAstPath::visit_mut_token(visitor, node, __ast_path)
5756 }
5757 }
5758 }
5759
5760 #[inline]
5761 fn visit_mut_token_and_span(&mut self, node: &mut TokenAndSpan, __ast_path: &mut AstKindPath) {
5762 match self {
5763 swc_visit::Either::Left(visitor) => {
5764 VisitMutAstPath::visit_mut_token_and_span(visitor, node, __ast_path)
5765 }
5766 swc_visit::Either::Right(visitor) => {
5767 VisitMutAstPath::visit_mut_token_and_span(visitor, node, __ast_path)
5768 }
5769 }
5770 }
5771}
5772#[cfg(any(docsrs, feature = "path"))]
5773#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
5774impl<V> VisitMutAstPath for ::swc_visit::Optional<V>
5775where
5776 V: VisitMutAstPath,
5777{
5778 #[inline]
5779 fn visit_mut_atom(&mut self, node: &mut swc_atoms::Atom, __ast_path: &mut AstKindPath) {
5780 if self.enabled {
5781 <V as VisitMutAstPath>::visit_mut_atom(&mut self.visitor, node, __ast_path)
5782 } else {
5783 }
5784 }
5785
5786 #[inline]
5787 fn visit_mut_attribute(&mut self, node: &mut Attribute, __ast_path: &mut AstKindPath) {
5788 if self.enabled {
5789 <V as VisitMutAstPath>::visit_mut_attribute(&mut self.visitor, node, __ast_path)
5790 } else {
5791 }
5792 }
5793
5794 #[inline]
5795 fn visit_mut_attribute_token(
5796 &mut self,
5797 node: &mut AttributeToken,
5798 __ast_path: &mut AstKindPath,
5799 ) {
5800 if self.enabled {
5801 <V as VisitMutAstPath>::visit_mut_attribute_token(&mut self.visitor, node, __ast_path)
5802 } else {
5803 }
5804 }
5805
5806 #[inline]
5807 fn visit_mut_attribute_tokens(
5808 &mut self,
5809 node: &mut Vec<AttributeToken>,
5810 __ast_path: &mut AstKindPath,
5811 ) {
5812 if self.enabled {
5813 <V as VisitMutAstPath>::visit_mut_attribute_tokens(&mut self.visitor, node, __ast_path)
5814 } else {
5815 }
5816 }
5817
5818 #[inline]
5819 fn visit_mut_attributes(&mut self, node: &mut Vec<Attribute>, __ast_path: &mut AstKindPath) {
5820 if self.enabled {
5821 <V as VisitMutAstPath>::visit_mut_attributes(&mut self.visitor, node, __ast_path)
5822 } else {
5823 }
5824 }
5825
5826 #[inline]
5827 fn visit_mut_cdata_section(&mut self, node: &mut CdataSection, __ast_path: &mut AstKindPath) {
5828 if self.enabled {
5829 <V as VisitMutAstPath>::visit_mut_cdata_section(&mut self.visitor, node, __ast_path)
5830 } else {
5831 }
5832 }
5833
5834 #[inline]
5835 fn visit_mut_child(&mut self, node: &mut Child, __ast_path: &mut AstKindPath) {
5836 if self.enabled {
5837 <V as VisitMutAstPath>::visit_mut_child(&mut self.visitor, node, __ast_path)
5838 } else {
5839 }
5840 }
5841
5842 #[inline]
5843 fn visit_mut_childs(&mut self, node: &mut Vec<Child>, __ast_path: &mut AstKindPath) {
5844 if self.enabled {
5845 <V as VisitMutAstPath>::visit_mut_childs(&mut self.visitor, node, __ast_path)
5846 } else {
5847 }
5848 }
5849
5850 #[inline]
5851 fn visit_mut_comment(&mut self, node: &mut Comment, __ast_path: &mut AstKindPath) {
5852 if self.enabled {
5853 <V as VisitMutAstPath>::visit_mut_comment(&mut self.visitor, node, __ast_path)
5854 } else {
5855 }
5856 }
5857
5858 #[inline]
5859 fn visit_mut_document(&mut self, node: &mut Document, __ast_path: &mut AstKindPath) {
5860 if self.enabled {
5861 <V as VisitMutAstPath>::visit_mut_document(&mut self.visitor, node, __ast_path)
5862 } else {
5863 }
5864 }
5865
5866 #[inline]
5867 fn visit_mut_document_mode(&mut self, node: &mut DocumentMode, __ast_path: &mut AstKindPath) {
5868 if self.enabled {
5869 <V as VisitMutAstPath>::visit_mut_document_mode(&mut self.visitor, node, __ast_path)
5870 } else {
5871 }
5872 }
5873
5874 #[inline]
5875 fn visit_mut_document_type(&mut self, node: &mut DocumentType, __ast_path: &mut AstKindPath) {
5876 if self.enabled {
5877 <V as VisitMutAstPath>::visit_mut_document_type(&mut self.visitor, node, __ast_path)
5878 } else {
5879 }
5880 }
5881
5882 #[inline]
5883 fn visit_mut_element(&mut self, node: &mut Element, __ast_path: &mut AstKindPath) {
5884 if self.enabled {
5885 <V as VisitMutAstPath>::visit_mut_element(&mut self.visitor, node, __ast_path)
5886 } else {
5887 }
5888 }
5889
5890 #[inline]
5891 fn visit_mut_namespace(&mut self, node: &mut Namespace, __ast_path: &mut AstKindPath) {
5892 if self.enabled {
5893 <V as VisitMutAstPath>::visit_mut_namespace(&mut self.visitor, node, __ast_path)
5894 } else {
5895 }
5896 }
5897
5898 #[inline]
5899 fn visit_mut_opt_atom(
5900 &mut self,
5901 node: &mut Option<swc_atoms::Atom>,
5902 __ast_path: &mut AstKindPath,
5903 ) {
5904 if self.enabled {
5905 <V as VisitMutAstPath>::visit_mut_opt_atom(&mut self.visitor, node, __ast_path)
5906 } else {
5907 }
5908 }
5909
5910 #[inline]
5911 fn visit_mut_opt_namespace(
5912 &mut self,
5913 node: &mut Option<Namespace>,
5914 __ast_path: &mut AstKindPath,
5915 ) {
5916 if self.enabled {
5917 <V as VisitMutAstPath>::visit_mut_opt_namespace(&mut self.visitor, node, __ast_path)
5918 } else {
5919 }
5920 }
5921
5922 #[inline]
5923 fn visit_mut_processing_instruction(
5924 &mut self,
5925 node: &mut ProcessingInstruction,
5926 __ast_path: &mut AstKindPath,
5927 ) {
5928 if self.enabled {
5929 <V as VisitMutAstPath>::visit_mut_processing_instruction(
5930 &mut self.visitor,
5931 node,
5932 __ast_path,
5933 )
5934 } else {
5935 }
5936 }
5937
5938 #[inline]
5939 fn visit_mut_span(&mut self, node: &mut swc_common::Span, __ast_path: &mut AstKindPath) {
5940 if self.enabled {
5941 <V as VisitMutAstPath>::visit_mut_span(&mut self.visitor, node, __ast_path)
5942 } else {
5943 }
5944 }
5945
5946 #[inline]
5947 fn visit_mut_text(&mut self, node: &mut Text, __ast_path: &mut AstKindPath) {
5948 if self.enabled {
5949 <V as VisitMutAstPath>::visit_mut_text(&mut self.visitor, node, __ast_path)
5950 } else {
5951 }
5952 }
5953
5954 #[inline]
5955 fn visit_mut_token(&mut self, node: &mut Token, __ast_path: &mut AstKindPath) {
5956 if self.enabled {
5957 <V as VisitMutAstPath>::visit_mut_token(&mut self.visitor, node, __ast_path)
5958 } else {
5959 }
5960 }
5961
5962 #[inline]
5963 fn visit_mut_token_and_span(&mut self, node: &mut TokenAndSpan, __ast_path: &mut AstKindPath) {
5964 if self.enabled {
5965 <V as VisitMutAstPath>::visit_mut_token_and_span(&mut self.visitor, node, __ast_path)
5966 } else {
5967 }
5968 }
5969}
5970#[doc = r" A trait implemented for types that can be visited using a visitor."]
5971#[cfg(any(docsrs, feature = "path"))]
5972#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
5973pub trait VisitMutWithAstPath<V: ?Sized + VisitMutAstPath> {
5974 #[doc = r" Calls a visitor method (visitor.fold_xxx) with self."]
5975 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath);
5976 #[doc = r" Visit children nodes of `self`` with `visitor`."]
5977 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath);
5978}
5979#[cfg(any(docsrs, feature = "path"))]
5980#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
5981impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for Attribute {
5982 #[doc = "Calls [VisitMutAstPath`::visit_mut_attribute`] with `self`."]
5983 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
5984 <V as VisitMutAstPath>::visit_mut_attribute(visitor, self, __ast_path)
5985 }
5986
5987 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
5988 match self {
5989 Attribute {
5990 span,
5991 namespace,
5992 prefix,
5993 name,
5994 raw_name,
5995 value,
5996 raw_value,
5997 } => {
5998 {
5999 let mut __ast_path = __ast_path
6000 .with_guard(AstParentKind::Attribute(self::fields::AttributeField::Span));
6001 <swc_common::Span as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6002 span,
6003 visitor,
6004 &mut *__ast_path,
6005 )
6006 };
6007 {
6008 let mut __ast_path = __ast_path.with_guard(AstParentKind::Attribute(
6009 self::fields::AttributeField::Namespace,
6010 ));
6011 <Option<Namespace> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6012 namespace,
6013 visitor,
6014 &mut *__ast_path,
6015 )
6016 };
6017 {
6018 let mut __ast_path = __ast_path.with_guard(AstParentKind::Attribute(
6019 self::fields::AttributeField::Prefix,
6020 ));
6021 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6022 prefix,
6023 visitor,
6024 &mut *__ast_path,
6025 )
6026 };
6027 {
6028 let mut __ast_path = __ast_path
6029 .with_guard(AstParentKind::Attribute(self::fields::AttributeField::Name));
6030 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6031 name,
6032 visitor,
6033 &mut *__ast_path,
6034 )
6035 };
6036 {
6037 let mut __ast_path = __ast_path.with_guard(AstParentKind::Attribute(
6038 self::fields::AttributeField::RawName,
6039 ));
6040 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6041 raw_name,
6042 visitor,
6043 &mut *__ast_path,
6044 )
6045 };
6046 {
6047 let mut __ast_path = __ast_path.with_guard(AstParentKind::Attribute(
6048 self::fields::AttributeField::Value,
6049 ));
6050 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6051 value,
6052 visitor,
6053 &mut *__ast_path,
6054 )
6055 };
6056 {
6057 let mut __ast_path = __ast_path.with_guard(AstParentKind::Attribute(
6058 self::fields::AttributeField::RawValue,
6059 ));
6060 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6061 raw_value,
6062 visitor,
6063 &mut *__ast_path,
6064 )
6065 };
6066 }
6067 }
6068 }
6069}
6070#[cfg(any(docsrs, feature = "path"))]
6071#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6072impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for AttributeToken {
6073 #[doc = "Calls [VisitMutAstPath`::visit_mut_attribute_token`] with `self`."]
6074 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6075 <V as VisitMutAstPath>::visit_mut_attribute_token(visitor, self, __ast_path)
6076 }
6077
6078 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6079 match self {
6080 AttributeToken {
6081 span,
6082 name,
6083 raw_name,
6084 value,
6085 raw_value,
6086 } => {
6087 {
6088 let mut __ast_path = __ast_path.with_guard(AstParentKind::AttributeToken(
6089 self::fields::AttributeTokenField::Span,
6090 ));
6091 <swc_common::Span as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6092 span,
6093 visitor,
6094 &mut *__ast_path,
6095 )
6096 };
6097 {
6098 let mut __ast_path = __ast_path.with_guard(AstParentKind::AttributeToken(
6099 self::fields::AttributeTokenField::Name,
6100 ));
6101 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6102 name,
6103 visitor,
6104 &mut *__ast_path,
6105 )
6106 };
6107 {
6108 let mut __ast_path = __ast_path.with_guard(AstParentKind::AttributeToken(
6109 self::fields::AttributeTokenField::RawName,
6110 ));
6111 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6112 raw_name,
6113 visitor,
6114 &mut *__ast_path,
6115 )
6116 };
6117 {
6118 let mut __ast_path = __ast_path.with_guard(AstParentKind::AttributeToken(
6119 self::fields::AttributeTokenField::Value,
6120 ));
6121 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6122 value,
6123 visitor,
6124 &mut *__ast_path,
6125 )
6126 };
6127 {
6128 let mut __ast_path = __ast_path.with_guard(AstParentKind::AttributeToken(
6129 self::fields::AttributeTokenField::RawValue,
6130 ));
6131 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6132 raw_value,
6133 visitor,
6134 &mut *__ast_path,
6135 )
6136 };
6137 }
6138 }
6139 }
6140}
6141#[cfg(any(docsrs, feature = "path"))]
6142#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6143impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for CdataSection {
6144 #[doc = "Calls [VisitMutAstPath`::visit_mut_cdata_section`] with `self`."]
6145 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6146 <V as VisitMutAstPath>::visit_mut_cdata_section(visitor, self, __ast_path)
6147 }
6148
6149 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6150 match self {
6151 CdataSection { span, data, raw } => {
6152 {
6153 let mut __ast_path = __ast_path.with_guard(AstParentKind::CdataSection(
6154 self::fields::CdataSectionField::Span,
6155 ));
6156 <swc_common::Span as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6157 span,
6158 visitor,
6159 &mut *__ast_path,
6160 )
6161 };
6162 {
6163 let mut __ast_path = __ast_path.with_guard(AstParentKind::CdataSection(
6164 self::fields::CdataSectionField::Data,
6165 ));
6166 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6167 data,
6168 visitor,
6169 &mut *__ast_path,
6170 )
6171 };
6172 {
6173 let mut __ast_path = __ast_path.with_guard(AstParentKind::CdataSection(
6174 self::fields::CdataSectionField::Raw,
6175 ));
6176 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6177 raw,
6178 visitor,
6179 &mut *__ast_path,
6180 )
6181 };
6182 }
6183 }
6184 }
6185}
6186#[cfg(any(docsrs, feature = "path"))]
6187#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6188impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for Child {
6189 #[doc = "Calls [VisitMutAstPath`::visit_mut_child`] with `self`."]
6190 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6191 <V as VisitMutAstPath>::visit_mut_child(visitor, self, __ast_path)
6192 }
6193
6194 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6195 match self {
6196 Child::DocumentType { 0: _field_0 } => {
6197 let mut __ast_path = __ast_path
6198 .with_guard(AstParentKind::Child(self::fields::ChildField::DocumentType));
6199 <DocumentType as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6200 _field_0,
6201 visitor,
6202 &mut *__ast_path,
6203 );
6204 }
6205 Child::Element { 0: _field_0 } => {
6206 let mut __ast_path =
6207 __ast_path.with_guard(AstParentKind::Child(self::fields::ChildField::Element));
6208 <Element as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6209 _field_0,
6210 visitor,
6211 &mut *__ast_path,
6212 );
6213 }
6214 Child::Text { 0: _field_0 } => {
6215 let mut __ast_path =
6216 __ast_path.with_guard(AstParentKind::Child(self::fields::ChildField::Text));
6217 <Text as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6218 _field_0,
6219 visitor,
6220 &mut *__ast_path,
6221 );
6222 }
6223 Child::CdataSection { 0: _field_0 } => {
6224 let mut __ast_path = __ast_path
6225 .with_guard(AstParentKind::Child(self::fields::ChildField::CdataSection));
6226 <CdataSection as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6227 _field_0,
6228 visitor,
6229 &mut *__ast_path,
6230 );
6231 }
6232 Child::Comment { 0: _field_0 } => {
6233 let mut __ast_path =
6234 __ast_path.with_guard(AstParentKind::Child(self::fields::ChildField::Comment));
6235 <Comment as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6236 _field_0,
6237 visitor,
6238 &mut *__ast_path,
6239 );
6240 }
6241 Child::ProcessingInstruction { 0: _field_0 } => {
6242 let mut __ast_path = __ast_path.with_guard(AstParentKind::Child(
6243 self::fields::ChildField::ProcessingInstruction,
6244 ));
6245 <ProcessingInstruction as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6246 _field_0,
6247 visitor,
6248 &mut *__ast_path,
6249 );
6250 }
6251 }
6252 }
6253}
6254#[cfg(any(docsrs, feature = "path"))]
6255#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6256impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for Comment {
6257 #[doc = "Calls [VisitMutAstPath`::visit_mut_comment`] with `self`."]
6258 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6259 <V as VisitMutAstPath>::visit_mut_comment(visitor, self, __ast_path)
6260 }
6261
6262 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6263 match self {
6264 Comment { span, data, raw } => {
6265 {
6266 let mut __ast_path = __ast_path
6267 .with_guard(AstParentKind::Comment(self::fields::CommentField::Span));
6268 <swc_common::Span as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6269 span,
6270 visitor,
6271 &mut *__ast_path,
6272 )
6273 };
6274 {
6275 let mut __ast_path = __ast_path
6276 .with_guard(AstParentKind::Comment(self::fields::CommentField::Data));
6277 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6278 data,
6279 visitor,
6280 &mut *__ast_path,
6281 )
6282 };
6283 {
6284 let mut __ast_path = __ast_path
6285 .with_guard(AstParentKind::Comment(self::fields::CommentField::Raw));
6286 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6287 raw,
6288 visitor,
6289 &mut *__ast_path,
6290 )
6291 };
6292 }
6293 }
6294 }
6295}
6296#[cfg(any(docsrs, feature = "path"))]
6297#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6298impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for Document {
6299 #[doc = "Calls [VisitMutAstPath`::visit_mut_document`] with `self`."]
6300 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6301 <V as VisitMutAstPath>::visit_mut_document(visitor, self, __ast_path)
6302 }
6303
6304 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6305 match self {
6306 Document { span, children } => {
6307 {
6308 let mut __ast_path = __ast_path
6309 .with_guard(AstParentKind::Document(self::fields::DocumentField::Span));
6310 <swc_common::Span as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6311 span,
6312 visitor,
6313 &mut *__ast_path,
6314 )
6315 };
6316 {
6317 let mut __ast_path = __ast_path.with_guard(AstParentKind::Document(
6318 self::fields::DocumentField::Children(usize::MAX),
6319 ));
6320 <Vec<Child> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6321 children,
6322 visitor,
6323 &mut *__ast_path,
6324 )
6325 };
6326 }
6327 }
6328 }
6329}
6330#[cfg(any(docsrs, feature = "path"))]
6331#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6332impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for DocumentMode {
6333 #[doc = "Calls [VisitMutAstPath`::visit_mut_document_mode`] with `self`."]
6334 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6335 <V as VisitMutAstPath>::visit_mut_document_mode(visitor, self, __ast_path)
6336 }
6337
6338 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6339 match self {
6340 DocumentMode::NoQuirks => {}
6341 DocumentMode::LimitedQuirks => {}
6342 DocumentMode::Quirks => {}
6343 }
6344 }
6345}
6346#[cfg(any(docsrs, feature = "path"))]
6347#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6348impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for DocumentType {
6349 #[doc = "Calls [VisitMutAstPath`::visit_mut_document_type`] with `self`."]
6350 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6351 <V as VisitMutAstPath>::visit_mut_document_type(visitor, self, __ast_path)
6352 }
6353
6354 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6355 match self {
6356 DocumentType {
6357 span,
6358 name,
6359 public_id,
6360 system_id,
6361 raw,
6362 } => {
6363 {
6364 let mut __ast_path = __ast_path.with_guard(AstParentKind::DocumentType(
6365 self::fields::DocumentTypeField::Span,
6366 ));
6367 <swc_common::Span as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6368 span,
6369 visitor,
6370 &mut *__ast_path,
6371 )
6372 };
6373 {
6374 let mut __ast_path = __ast_path.with_guard(AstParentKind::DocumentType(
6375 self::fields::DocumentTypeField::Name,
6376 ));
6377 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6378 name,
6379 visitor,
6380 &mut *__ast_path,
6381 )
6382 };
6383 {
6384 let mut __ast_path = __ast_path.with_guard(AstParentKind::DocumentType(
6385 self::fields::DocumentTypeField::PublicId,
6386 ));
6387 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6388 public_id,
6389 visitor,
6390 &mut *__ast_path,
6391 )
6392 };
6393 {
6394 let mut __ast_path = __ast_path.with_guard(AstParentKind::DocumentType(
6395 self::fields::DocumentTypeField::SystemId,
6396 ));
6397 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6398 system_id,
6399 visitor,
6400 &mut *__ast_path,
6401 )
6402 };
6403 {
6404 let mut __ast_path = __ast_path.with_guard(AstParentKind::DocumentType(
6405 self::fields::DocumentTypeField::Raw,
6406 ));
6407 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6408 raw,
6409 visitor,
6410 &mut *__ast_path,
6411 )
6412 };
6413 }
6414 }
6415 }
6416}
6417#[cfg(any(docsrs, feature = "path"))]
6418#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6419impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for Element {
6420 #[doc = "Calls [VisitMutAstPath`::visit_mut_element`] with `self`."]
6421 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6422 <V as VisitMutAstPath>::visit_mut_element(visitor, self, __ast_path)
6423 }
6424
6425 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6426 match self {
6427 Element {
6428 span,
6429 tag_name,
6430 attributes,
6431 children,
6432 } => {
6433 {
6434 let mut __ast_path = __ast_path
6435 .with_guard(AstParentKind::Element(self::fields::ElementField::Span));
6436 <swc_common::Span as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6437 span,
6438 visitor,
6439 &mut *__ast_path,
6440 )
6441 };
6442 {
6443 let mut __ast_path = __ast_path
6444 .with_guard(AstParentKind::Element(self::fields::ElementField::TagName));
6445 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6446 tag_name,
6447 visitor,
6448 &mut *__ast_path,
6449 )
6450 };
6451 {
6452 let mut __ast_path = __ast_path.with_guard(AstParentKind::Element(
6453 self::fields::ElementField::Attributes(usize::MAX),
6454 ));
6455 <Vec<Attribute> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6456 attributes,
6457 visitor,
6458 &mut *__ast_path,
6459 )
6460 };
6461 {
6462 let mut __ast_path = __ast_path.with_guard(AstParentKind::Element(
6463 self::fields::ElementField::Children(usize::MAX),
6464 ));
6465 <Vec<Child> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6466 children,
6467 visitor,
6468 &mut *__ast_path,
6469 )
6470 };
6471 }
6472 }
6473 }
6474}
6475#[cfg(any(docsrs, feature = "path"))]
6476#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6477impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for Namespace {
6478 #[doc = "Calls [VisitMutAstPath`::visit_mut_namespace`] with `self`."]
6479 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6480 <V as VisitMutAstPath>::visit_mut_namespace(visitor, self, __ast_path)
6481 }
6482
6483 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6484 match self {
6485 Namespace::HTML => {}
6486 Namespace::MATHML => {}
6487 Namespace::SVG => {}
6488 Namespace::XLINK => {}
6489 Namespace::XML => {}
6490 Namespace::XMLNS => {}
6491 }
6492 }
6493}
6494#[cfg(any(docsrs, feature = "path"))]
6495#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6496impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for ProcessingInstruction {
6497 #[doc = "Calls [VisitMutAstPath`::visit_mut_processing_instruction`] with `self`."]
6498 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6499 <V as VisitMutAstPath>::visit_mut_processing_instruction(visitor, self, __ast_path)
6500 }
6501
6502 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6503 match self {
6504 ProcessingInstruction { span, target, data } => {
6505 {
6506 let mut __ast_path =
6507 __ast_path.with_guard(AstParentKind::ProcessingInstruction(
6508 self::fields::ProcessingInstructionField::Span,
6509 ));
6510 <swc_common::Span as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6511 span,
6512 visitor,
6513 &mut *__ast_path,
6514 )
6515 };
6516 {
6517 let mut __ast_path =
6518 __ast_path.with_guard(AstParentKind::ProcessingInstruction(
6519 self::fields::ProcessingInstructionField::Target,
6520 ));
6521 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6522 target,
6523 visitor,
6524 &mut *__ast_path,
6525 )
6526 };
6527 {
6528 let mut __ast_path =
6529 __ast_path.with_guard(AstParentKind::ProcessingInstruction(
6530 self::fields::ProcessingInstructionField::Data,
6531 ));
6532 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6533 data,
6534 visitor,
6535 &mut *__ast_path,
6536 )
6537 };
6538 }
6539 }
6540 }
6541}
6542#[cfg(any(docsrs, feature = "path"))]
6543#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6544impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for Text {
6545 #[doc = "Calls [VisitMutAstPath`::visit_mut_text`] with `self`."]
6546 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6547 <V as VisitMutAstPath>::visit_mut_text(visitor, self, __ast_path)
6548 }
6549
6550 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6551 match self {
6552 Text { span, data, raw } => {
6553 {
6554 let mut __ast_path =
6555 __ast_path.with_guard(AstParentKind::Text(self::fields::TextField::Span));
6556 <swc_common::Span as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6557 span,
6558 visitor,
6559 &mut *__ast_path,
6560 )
6561 };
6562 {
6563 let mut __ast_path =
6564 __ast_path.with_guard(AstParentKind::Text(self::fields::TextField::Data));
6565 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6566 data,
6567 visitor,
6568 &mut *__ast_path,
6569 )
6570 };
6571 {
6572 let mut __ast_path =
6573 __ast_path.with_guard(AstParentKind::Text(self::fields::TextField::Raw));
6574 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6575 raw,
6576 visitor,
6577 &mut *__ast_path,
6578 )
6579 };
6580 }
6581 }
6582 }
6583}
6584#[cfg(any(docsrs, feature = "path"))]
6585#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6586impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for Token {
6587 #[doc = "Calls [VisitMutAstPath`::visit_mut_token`] with `self`."]
6588 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6589 <V as VisitMutAstPath>::visit_mut_token(visitor, self, __ast_path)
6590 }
6591
6592 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6593 match self {
6594 Token::Doctype {
6595 name,
6596 public_id,
6597 system_id,
6598 raw,
6599 } => {
6600 let mut __ast_path =
6601 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Doctype));
6602 {
6603 let mut __ast_path =
6604 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Name));
6605 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6606 name,
6607 visitor,
6608 &mut *__ast_path,
6609 )
6610 };
6611 {
6612 let mut __ast_path = __ast_path
6613 .with_guard(AstParentKind::Token(self::fields::TokenField::PublicId));
6614 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6615 public_id,
6616 visitor,
6617 &mut *__ast_path,
6618 )
6619 };
6620 {
6621 let mut __ast_path = __ast_path
6622 .with_guard(AstParentKind::Token(self::fields::TokenField::SystemId));
6623 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6624 system_id,
6625 visitor,
6626 &mut *__ast_path,
6627 )
6628 };
6629 {
6630 let mut __ast_path =
6631 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Raw));
6632 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6633 raw,
6634 visitor,
6635 &mut *__ast_path,
6636 )
6637 };
6638 }
6639 Token::StartTag {
6640 tag_name,
6641 attributes,
6642 } => {
6643 let mut __ast_path =
6644 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::StartTag));
6645 {
6646 let mut __ast_path = __ast_path
6647 .with_guard(AstParentKind::Token(self::fields::TokenField::TagName));
6648 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6649 tag_name,
6650 visitor,
6651 &mut *__ast_path,
6652 )
6653 };
6654 {
6655 let mut __ast_path = __ast_path.with_guard(AstParentKind::Token(
6656 self::fields::TokenField::Attributes(usize::MAX),
6657 ));
6658 <Vec<AttributeToken> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6659 attributes,
6660 visitor,
6661 &mut *__ast_path,
6662 )
6663 };
6664 }
6665 Token::EndTag {
6666 tag_name,
6667 attributes,
6668 } => {
6669 let mut __ast_path =
6670 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::EndTag));
6671 {
6672 let mut __ast_path = __ast_path
6673 .with_guard(AstParentKind::Token(self::fields::TokenField::TagName));
6674 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6675 tag_name,
6676 visitor,
6677 &mut *__ast_path,
6678 )
6679 };
6680 {
6681 let mut __ast_path = __ast_path.with_guard(AstParentKind::Token(
6682 self::fields::TokenField::Attributes(usize::MAX),
6683 ));
6684 <Vec<AttributeToken> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6685 attributes,
6686 visitor,
6687 &mut *__ast_path,
6688 )
6689 };
6690 }
6691 Token::EmptyTag {
6692 tag_name,
6693 attributes,
6694 } => {
6695 let mut __ast_path =
6696 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::EmptyTag));
6697 {
6698 let mut __ast_path = __ast_path
6699 .with_guard(AstParentKind::Token(self::fields::TokenField::TagName));
6700 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6701 tag_name,
6702 visitor,
6703 &mut *__ast_path,
6704 )
6705 };
6706 {
6707 let mut __ast_path = __ast_path.with_guard(AstParentKind::Token(
6708 self::fields::TokenField::Attributes(usize::MAX),
6709 ));
6710 <Vec<AttributeToken> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6711 attributes,
6712 visitor,
6713 &mut *__ast_path,
6714 )
6715 };
6716 }
6717 Token::Comment { data, raw } => {
6718 let mut __ast_path =
6719 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Comment));
6720 {
6721 let mut __ast_path =
6722 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Data));
6723 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6724 data,
6725 visitor,
6726 &mut *__ast_path,
6727 )
6728 };
6729 {
6730 let mut __ast_path =
6731 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Raw));
6732 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6733 raw,
6734 visitor,
6735 &mut *__ast_path,
6736 )
6737 };
6738 }
6739 Token::Character { value, raw } => {
6740 let mut __ast_path = __ast_path
6741 .with_guard(AstParentKind::Token(self::fields::TokenField::Character));
6742 {
6743 let mut __ast_path =
6744 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Raw));
6745 <Option<swc_atoms::Atom> as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6746 raw,
6747 visitor,
6748 &mut *__ast_path,
6749 )
6750 };
6751 }
6752 Token::ProcessingInstruction { target, data } => {
6753 let mut __ast_path = __ast_path.with_guard(AstParentKind::Token(
6754 self::fields::TokenField::ProcessingInstruction,
6755 ));
6756 {
6757 let mut __ast_path = __ast_path
6758 .with_guard(AstParentKind::Token(self::fields::TokenField::Target));
6759 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6760 target,
6761 visitor,
6762 &mut *__ast_path,
6763 )
6764 };
6765 {
6766 let mut __ast_path =
6767 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Data));
6768 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6769 data,
6770 visitor,
6771 &mut *__ast_path,
6772 )
6773 };
6774 }
6775 Token::Cdata { data, raw } => {
6776 let mut __ast_path =
6777 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Cdata));
6778 {
6779 let mut __ast_path =
6780 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Data));
6781 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6782 data,
6783 visitor,
6784 &mut *__ast_path,
6785 )
6786 };
6787 {
6788 let mut __ast_path =
6789 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Raw));
6790 <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6791 raw,
6792 visitor,
6793 &mut *__ast_path,
6794 )
6795 };
6796 }
6797 Token::Eof => {}
6798 }
6799 }
6800}
6801#[cfg(any(docsrs, feature = "path"))]
6802#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6803impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for TokenAndSpan {
6804 #[doc = "Calls [VisitMutAstPath`::visit_mut_token_and_span`] with `self`."]
6805 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6806 <V as VisitMutAstPath>::visit_mut_token_and_span(visitor, self, __ast_path)
6807 }
6808
6809 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6810 match self {
6811 TokenAndSpan { span, token } => {
6812 {
6813 let mut __ast_path = __ast_path.with_guard(AstParentKind::TokenAndSpan(
6814 self::fields::TokenAndSpanField::Span,
6815 ));
6816 <swc_common::Span as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6817 span,
6818 visitor,
6819 &mut *__ast_path,
6820 )
6821 };
6822 {
6823 let mut __ast_path = __ast_path.with_guard(AstParentKind::TokenAndSpan(
6824 self::fields::TokenAndSpanField::Token,
6825 ));
6826 <Token as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6827 token,
6828 visitor,
6829 &mut *__ast_path,
6830 )
6831 };
6832 }
6833 }
6834 }
6835}
6836#[cfg(any(docsrs, feature = "path"))]
6837#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6838impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for swc_atoms::Atom {
6839 #[doc = "Calls [VisitMutAstPath`::visit_mut_atom`] with `self`. (Extra impl)"]
6840 #[inline]
6841 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6842 <V as VisitMutAstPath>::visit_mut_atom(visitor, self, __ast_path)
6843 }
6844
6845 #[inline]
6846 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6847 {}
6848 }
6849}
6850#[cfg(any(docsrs, feature = "path"))]
6851#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6852impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for Vec<AttributeToken> {
6853 #[doc = "Calls [VisitMutAstPath`::visit_mut_attribute_tokens`] with `self`. (Extra impl)"]
6854 #[inline]
6855 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6856 <V as VisitMutAstPath>::visit_mut_attribute_tokens(visitor, self, __ast_path)
6857 }
6858
6859 #[inline]
6860 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6861 self.iter_mut().enumerate().for_each(|(__idx, item)| {
6862 let mut __ast_path = __ast_path.with_index_guard(__idx);
6863 <AttributeToken as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6864 item,
6865 visitor,
6866 &mut *__ast_path,
6867 )
6868 })
6869 }
6870}
6871#[cfg(any(docsrs, feature = "path"))]
6872#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6873impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for Vec<Attribute> {
6874 #[doc = "Calls [VisitMutAstPath`::visit_mut_attributes`] with `self`. (Extra impl)"]
6875 #[inline]
6876 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6877 <V as VisitMutAstPath>::visit_mut_attributes(visitor, self, __ast_path)
6878 }
6879
6880 #[inline]
6881 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6882 self.iter_mut().enumerate().for_each(|(__idx, item)| {
6883 let mut __ast_path = __ast_path.with_index_guard(__idx);
6884 <Attribute as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6885 item,
6886 visitor,
6887 &mut *__ast_path,
6888 )
6889 })
6890 }
6891}
6892#[cfg(any(docsrs, feature = "path"))]
6893#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6894impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for Vec<Child> {
6895 #[doc = "Calls [VisitMutAstPath`::visit_mut_childs`] with `self`. (Extra impl)"]
6896 #[inline]
6897 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6898 <V as VisitMutAstPath>::visit_mut_childs(visitor, self, __ast_path)
6899 }
6900
6901 #[inline]
6902 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6903 self.iter_mut().enumerate().for_each(|(__idx, item)| {
6904 let mut __ast_path = __ast_path.with_index_guard(__idx);
6905 <Child as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6906 item,
6907 visitor,
6908 &mut *__ast_path,
6909 )
6910 })
6911 }
6912}
6913#[cfg(any(docsrs, feature = "path"))]
6914#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6915impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for Option<swc_atoms::Atom> {
6916 #[doc = "Calls [VisitMutAstPath`::visit_mut_opt_atom`] with `self`. (Extra impl)"]
6917 #[inline]
6918 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6919 <V as VisitMutAstPath>::visit_mut_opt_atom(visitor, self, __ast_path)
6920 }
6921
6922 #[inline]
6923 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6924 match self {
6925 Some(inner) => <swc_atoms::Atom as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6926 inner, visitor, __ast_path,
6927 ),
6928 None => {}
6929 }
6930 }
6931}
6932#[cfg(any(docsrs, feature = "path"))]
6933#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6934impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for Option<Namespace> {
6935 #[doc = "Calls [VisitMutAstPath`::visit_mut_opt_namespace`] with `self`. (Extra impl)"]
6936 #[inline]
6937 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6938 <V as VisitMutAstPath>::visit_mut_opt_namespace(visitor, self, __ast_path)
6939 }
6940
6941 #[inline]
6942 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6943 match self {
6944 Some(inner) => <Namespace as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6945 inner, visitor, __ast_path,
6946 ),
6947 None => {}
6948 }
6949 }
6950}
6951#[cfg(any(docsrs, feature = "path"))]
6952#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6953impl<V: ?Sized + VisitMutAstPath> VisitMutWithAstPath<V> for swc_common::Span {
6954 #[doc = "Calls [VisitMutAstPath`::visit_mut_span`] with `self`. (Extra impl)"]
6955 #[inline]
6956 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6957 <V as VisitMutAstPath>::visit_mut_span(visitor, self, __ast_path)
6958 }
6959
6960 #[inline]
6961 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6962 {}
6963 }
6964}
6965#[cfg(any(docsrs, feature = "path"))]
6966#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
6967impl<V, T> VisitMutWithAstPath<V> for std::boxed::Box<T>
6968where
6969 V: ?Sized + VisitMutAstPath,
6970 T: VisitMutWithAstPath<V>,
6971{
6972 #[inline]
6973 fn visit_mut_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6974 let v = <T as VisitMutWithAstPath<V>>::visit_mut_with_ast_path(
6975 &mut **self,
6976 visitor,
6977 __ast_path,
6978 );
6979 v
6980 }
6981
6982 #[inline]
6983 fn visit_mut_children_with_ast_path(&mut self, visitor: &mut V, __ast_path: &mut AstKindPath) {
6984 let v = <T as VisitMutWithAstPath<V>>::visit_mut_children_with_ast_path(
6985 &mut **self,
6986 visitor,
6987 __ast_path,
6988 );
6989 v
6990 }
6991}
6992#[doc = r" A visitor trait for traversing the AST."]
6993pub trait Fold {
6994 #[doc = "Visit a node of type `swc_atoms :: Atom`.\n\nBy default, this method calls \
6995 [`swc_atoms :: Atom::fold_children_with`]. If you want to recurse, you need to call \
6996 it manually."]
6997 #[inline]
6998 fn fold_atom(&mut self, node: swc_atoms::Atom) -> swc_atoms::Atom {
6999 <swc_atoms::Atom as FoldWith<Self>>::fold_children_with(node, self)
7000 }
7001 #[doc = "Visit a node of type `Attribute`.\n\nBy default, this method calls \
7002 [`Attribute::fold_children_with`]. If you want to recurse, you need to call it \
7003 manually."]
7004 #[inline]
7005 fn fold_attribute(&mut self, node: Attribute) -> Attribute {
7006 <Attribute as FoldWith<Self>>::fold_children_with(node, self)
7007 }
7008 #[doc = "Visit a node of type `AttributeToken`.\n\nBy default, this method calls \
7009 [`AttributeToken::fold_children_with`]. If you want to recurse, you need to call it \
7010 manually."]
7011 #[inline]
7012 fn fold_attribute_token(&mut self, node: AttributeToken) -> AttributeToken {
7013 <AttributeToken as FoldWith<Self>>::fold_children_with(node, self)
7014 }
7015 #[doc = "Visit a node of type `Vec < AttributeToken >`.\n\nBy default, this method calls [`Vec \
7016 < AttributeToken >::fold_children_with`]. If you want to recurse, you need to call it \
7017 manually."]
7018 #[inline]
7019 fn fold_attribute_tokens(&mut self, node: Vec<AttributeToken>) -> Vec<AttributeToken> {
7020 <Vec<AttributeToken> as FoldWith<Self>>::fold_children_with(node, self)
7021 }
7022 #[doc = "Visit a node of type `Vec < Attribute >`.\n\nBy default, this method calls [`Vec < \
7023 Attribute >::fold_children_with`]. If you want to recurse, you need to call it \
7024 manually."]
7025 #[inline]
7026 fn fold_attributes(&mut self, node: Vec<Attribute>) -> Vec<Attribute> {
7027 <Vec<Attribute> as FoldWith<Self>>::fold_children_with(node, self)
7028 }
7029 #[doc = "Visit a node of type `CdataSection`.\n\nBy default, this method calls \
7030 [`CdataSection::fold_children_with`]. If you want to recurse, you need to call it \
7031 manually."]
7032 #[inline]
7033 fn fold_cdata_section(&mut self, node: CdataSection) -> CdataSection {
7034 <CdataSection as FoldWith<Self>>::fold_children_with(node, self)
7035 }
7036 #[doc = "Visit a node of type `Child`.\n\nBy default, this method calls \
7037 [`Child::fold_children_with`]. If you want to recurse, you need to call it manually."]
7038 #[inline]
7039 fn fold_child(&mut self, node: Child) -> Child {
7040 <Child as FoldWith<Self>>::fold_children_with(node, self)
7041 }
7042 #[doc = "Visit a node of type `Vec < Child >`.\n\nBy default, this method calls [`Vec < Child \
7043 >::fold_children_with`]. If you want to recurse, you need to call it manually."]
7044 #[inline]
7045 fn fold_childs(&mut self, node: Vec<Child>) -> Vec<Child> {
7046 <Vec<Child> as FoldWith<Self>>::fold_children_with(node, self)
7047 }
7048 #[doc = "Visit a node of type `Comment`.\n\nBy default, this method calls \
7049 [`Comment::fold_children_with`]. If you want to recurse, you need to call it manually."]
7050 #[inline]
7051 fn fold_comment(&mut self, node: Comment) -> Comment {
7052 <Comment as FoldWith<Self>>::fold_children_with(node, self)
7053 }
7054 #[doc = "Visit a node of type `Document`.\n\nBy default, this method calls \
7055 [`Document::fold_children_with`]. If you want to recurse, you need to call it \
7056 manually."]
7057 #[inline]
7058 fn fold_document(&mut self, node: Document) -> Document {
7059 <Document as FoldWith<Self>>::fold_children_with(node, self)
7060 }
7061 #[doc = "Visit a node of type `DocumentMode`.\n\nBy default, this method calls \
7062 [`DocumentMode::fold_children_with`]. If you want to recurse, you need to call it \
7063 manually."]
7064 #[inline]
7065 fn fold_document_mode(&mut self, node: DocumentMode) -> DocumentMode {
7066 <DocumentMode as FoldWith<Self>>::fold_children_with(node, self)
7067 }
7068 #[doc = "Visit a node of type `DocumentType`.\n\nBy default, this method calls \
7069 [`DocumentType::fold_children_with`]. If you want to recurse, you need to call it \
7070 manually."]
7071 #[inline]
7072 fn fold_document_type(&mut self, node: DocumentType) -> DocumentType {
7073 <DocumentType as FoldWith<Self>>::fold_children_with(node, self)
7074 }
7075 #[doc = "Visit a node of type `Element`.\n\nBy default, this method calls \
7076 [`Element::fold_children_with`]. If you want to recurse, you need to call it manually."]
7077 #[inline]
7078 fn fold_element(&mut self, node: Element) -> Element {
7079 <Element as FoldWith<Self>>::fold_children_with(node, self)
7080 }
7081 #[doc = "Visit a node of type `Namespace`.\n\nBy default, this method calls \
7082 [`Namespace::fold_children_with`]. If you want to recurse, you need to call it \
7083 manually."]
7084 #[inline]
7085 fn fold_namespace(&mut self, node: Namespace) -> Namespace {
7086 <Namespace as FoldWith<Self>>::fold_children_with(node, self)
7087 }
7088 #[doc = "Visit a node of type `Option < swc_atoms :: Atom >`.\n\nBy default, this method calls \
7089 [`Option < swc_atoms :: Atom >::fold_children_with`]. If you want to recurse, you \
7090 need to call it manually."]
7091 #[inline]
7092 fn fold_opt_atom(&mut self, node: Option<swc_atoms::Atom>) -> Option<swc_atoms::Atom> {
7093 <Option<swc_atoms::Atom> as FoldWith<Self>>::fold_children_with(node, self)
7094 }
7095 #[doc = "Visit a node of type `Option < Namespace >`.\n\nBy default, this method calls \
7096 [`Option < Namespace >::fold_children_with`]. If you want to recurse, you need to \
7097 call it manually."]
7098 #[inline]
7099 fn fold_opt_namespace(&mut self, node: Option<Namespace>) -> Option<Namespace> {
7100 <Option<Namespace> as FoldWith<Self>>::fold_children_with(node, self)
7101 }
7102 #[doc = "Visit a node of type `ProcessingInstruction`.\n\nBy default, this method calls \
7103 [`ProcessingInstruction::fold_children_with`]. If you want to recurse, you need to \
7104 call it manually."]
7105 #[inline]
7106 fn fold_processing_instruction(
7107 &mut self,
7108 node: ProcessingInstruction,
7109 ) -> ProcessingInstruction {
7110 <ProcessingInstruction as FoldWith<Self>>::fold_children_with(node, self)
7111 }
7112 #[doc = "Visit a node of type `swc_common :: Span`.\n\nBy default, this method calls \
7113 [`swc_common :: Span::fold_children_with`]. If you want to recurse, you need to call \
7114 it manually."]
7115 #[inline]
7116 fn fold_span(&mut self, node: swc_common::Span) -> swc_common::Span {
7117 <swc_common::Span as FoldWith<Self>>::fold_children_with(node, self)
7118 }
7119 #[doc = "Visit a node of type `Text`.\n\nBy default, this method calls \
7120 [`Text::fold_children_with`]. If you want to recurse, you need to call it manually."]
7121 #[inline]
7122 fn fold_text(&mut self, node: Text) -> Text {
7123 <Text as FoldWith<Self>>::fold_children_with(node, self)
7124 }
7125 #[doc = "Visit a node of type `Token`.\n\nBy default, this method calls \
7126 [`Token::fold_children_with`]. If you want to recurse, you need to call it manually."]
7127 #[inline]
7128 fn fold_token(&mut self, node: Token) -> Token {
7129 <Token as FoldWith<Self>>::fold_children_with(node, self)
7130 }
7131 #[doc = "Visit a node of type `TokenAndSpan`.\n\nBy default, this method calls \
7132 [`TokenAndSpan::fold_children_with`]. If you want to recurse, you need to call it \
7133 manually."]
7134 #[inline]
7135 fn fold_token_and_span(&mut self, node: TokenAndSpan) -> TokenAndSpan {
7136 <TokenAndSpan as FoldWith<Self>>::fold_children_with(node, self)
7137 }
7138}
7139impl<V> Fold for &mut V
7140where
7141 V: ?Sized + Fold,
7142{
7143 #[inline]
7144 fn fold_atom(&mut self, node: swc_atoms::Atom) -> swc_atoms::Atom {
7145 <V as Fold>::fold_atom(&mut **self, node)
7146 }
7147
7148 #[inline]
7149 fn fold_attribute(&mut self, node: Attribute) -> Attribute {
7150 <V as Fold>::fold_attribute(&mut **self, node)
7151 }
7152
7153 #[inline]
7154 fn fold_attribute_token(&mut self, node: AttributeToken) -> AttributeToken {
7155 <V as Fold>::fold_attribute_token(&mut **self, node)
7156 }
7157
7158 #[inline]
7159 fn fold_attribute_tokens(&mut self, node: Vec<AttributeToken>) -> Vec<AttributeToken> {
7160 <V as Fold>::fold_attribute_tokens(&mut **self, node)
7161 }
7162
7163 #[inline]
7164 fn fold_attributes(&mut self, node: Vec<Attribute>) -> Vec<Attribute> {
7165 <V as Fold>::fold_attributes(&mut **self, node)
7166 }
7167
7168 #[inline]
7169 fn fold_cdata_section(&mut self, node: CdataSection) -> CdataSection {
7170 <V as Fold>::fold_cdata_section(&mut **self, node)
7171 }
7172
7173 #[inline]
7174 fn fold_child(&mut self, node: Child) -> Child {
7175 <V as Fold>::fold_child(&mut **self, node)
7176 }
7177
7178 #[inline]
7179 fn fold_childs(&mut self, node: Vec<Child>) -> Vec<Child> {
7180 <V as Fold>::fold_childs(&mut **self, node)
7181 }
7182
7183 #[inline]
7184 fn fold_comment(&mut self, node: Comment) -> Comment {
7185 <V as Fold>::fold_comment(&mut **self, node)
7186 }
7187
7188 #[inline]
7189 fn fold_document(&mut self, node: Document) -> Document {
7190 <V as Fold>::fold_document(&mut **self, node)
7191 }
7192
7193 #[inline]
7194 fn fold_document_mode(&mut self, node: DocumentMode) -> DocumentMode {
7195 <V as Fold>::fold_document_mode(&mut **self, node)
7196 }
7197
7198 #[inline]
7199 fn fold_document_type(&mut self, node: DocumentType) -> DocumentType {
7200 <V as Fold>::fold_document_type(&mut **self, node)
7201 }
7202
7203 #[inline]
7204 fn fold_element(&mut self, node: Element) -> Element {
7205 <V as Fold>::fold_element(&mut **self, node)
7206 }
7207
7208 #[inline]
7209 fn fold_namespace(&mut self, node: Namespace) -> Namespace {
7210 <V as Fold>::fold_namespace(&mut **self, node)
7211 }
7212
7213 #[inline]
7214 fn fold_opt_atom(&mut self, node: Option<swc_atoms::Atom>) -> Option<swc_atoms::Atom> {
7215 <V as Fold>::fold_opt_atom(&mut **self, node)
7216 }
7217
7218 #[inline]
7219 fn fold_opt_namespace(&mut self, node: Option<Namespace>) -> Option<Namespace> {
7220 <V as Fold>::fold_opt_namespace(&mut **self, node)
7221 }
7222
7223 #[inline]
7224 fn fold_processing_instruction(
7225 &mut self,
7226 node: ProcessingInstruction,
7227 ) -> ProcessingInstruction {
7228 <V as Fold>::fold_processing_instruction(&mut **self, node)
7229 }
7230
7231 #[inline]
7232 fn fold_span(&mut self, node: swc_common::Span) -> swc_common::Span {
7233 <V as Fold>::fold_span(&mut **self, node)
7234 }
7235
7236 #[inline]
7237 fn fold_text(&mut self, node: Text) -> Text {
7238 <V as Fold>::fold_text(&mut **self, node)
7239 }
7240
7241 #[inline]
7242 fn fold_token(&mut self, node: Token) -> Token {
7243 <V as Fold>::fold_token(&mut **self, node)
7244 }
7245
7246 #[inline]
7247 fn fold_token_and_span(&mut self, node: TokenAndSpan) -> TokenAndSpan {
7248 <V as Fold>::fold_token_and_span(&mut **self, node)
7249 }
7250}
7251impl<V> Fold for Box<V>
7252where
7253 V: ?Sized + Fold,
7254{
7255 #[inline]
7256 fn fold_atom(&mut self, node: swc_atoms::Atom) -> swc_atoms::Atom {
7257 <V as Fold>::fold_atom(&mut **self, node)
7258 }
7259
7260 #[inline]
7261 fn fold_attribute(&mut self, node: Attribute) -> Attribute {
7262 <V as Fold>::fold_attribute(&mut **self, node)
7263 }
7264
7265 #[inline]
7266 fn fold_attribute_token(&mut self, node: AttributeToken) -> AttributeToken {
7267 <V as Fold>::fold_attribute_token(&mut **self, node)
7268 }
7269
7270 #[inline]
7271 fn fold_attribute_tokens(&mut self, node: Vec<AttributeToken>) -> Vec<AttributeToken> {
7272 <V as Fold>::fold_attribute_tokens(&mut **self, node)
7273 }
7274
7275 #[inline]
7276 fn fold_attributes(&mut self, node: Vec<Attribute>) -> Vec<Attribute> {
7277 <V as Fold>::fold_attributes(&mut **self, node)
7278 }
7279
7280 #[inline]
7281 fn fold_cdata_section(&mut self, node: CdataSection) -> CdataSection {
7282 <V as Fold>::fold_cdata_section(&mut **self, node)
7283 }
7284
7285 #[inline]
7286 fn fold_child(&mut self, node: Child) -> Child {
7287 <V as Fold>::fold_child(&mut **self, node)
7288 }
7289
7290 #[inline]
7291 fn fold_childs(&mut self, node: Vec<Child>) -> Vec<Child> {
7292 <V as Fold>::fold_childs(&mut **self, node)
7293 }
7294
7295 #[inline]
7296 fn fold_comment(&mut self, node: Comment) -> Comment {
7297 <V as Fold>::fold_comment(&mut **self, node)
7298 }
7299
7300 #[inline]
7301 fn fold_document(&mut self, node: Document) -> Document {
7302 <V as Fold>::fold_document(&mut **self, node)
7303 }
7304
7305 #[inline]
7306 fn fold_document_mode(&mut self, node: DocumentMode) -> DocumentMode {
7307 <V as Fold>::fold_document_mode(&mut **self, node)
7308 }
7309
7310 #[inline]
7311 fn fold_document_type(&mut self, node: DocumentType) -> DocumentType {
7312 <V as Fold>::fold_document_type(&mut **self, node)
7313 }
7314
7315 #[inline]
7316 fn fold_element(&mut self, node: Element) -> Element {
7317 <V as Fold>::fold_element(&mut **self, node)
7318 }
7319
7320 #[inline]
7321 fn fold_namespace(&mut self, node: Namespace) -> Namespace {
7322 <V as Fold>::fold_namespace(&mut **self, node)
7323 }
7324
7325 #[inline]
7326 fn fold_opt_atom(&mut self, node: Option<swc_atoms::Atom>) -> Option<swc_atoms::Atom> {
7327 <V as Fold>::fold_opt_atom(&mut **self, node)
7328 }
7329
7330 #[inline]
7331 fn fold_opt_namespace(&mut self, node: Option<Namespace>) -> Option<Namespace> {
7332 <V as Fold>::fold_opt_namespace(&mut **self, node)
7333 }
7334
7335 #[inline]
7336 fn fold_processing_instruction(
7337 &mut self,
7338 node: ProcessingInstruction,
7339 ) -> ProcessingInstruction {
7340 <V as Fold>::fold_processing_instruction(&mut **self, node)
7341 }
7342
7343 #[inline]
7344 fn fold_span(&mut self, node: swc_common::Span) -> swc_common::Span {
7345 <V as Fold>::fold_span(&mut **self, node)
7346 }
7347
7348 #[inline]
7349 fn fold_text(&mut self, node: Text) -> Text {
7350 <V as Fold>::fold_text(&mut **self, node)
7351 }
7352
7353 #[inline]
7354 fn fold_token(&mut self, node: Token) -> Token {
7355 <V as Fold>::fold_token(&mut **self, node)
7356 }
7357
7358 #[inline]
7359 fn fold_token_and_span(&mut self, node: TokenAndSpan) -> TokenAndSpan {
7360 <V as Fold>::fold_token_and_span(&mut **self, node)
7361 }
7362}
7363impl<A, B> Fold for ::swc_visit::Either<A, B>
7364where
7365 A: Fold,
7366 B: Fold,
7367{
7368 #[inline]
7369 fn fold_atom(&mut self, node: swc_atoms::Atom) -> swc_atoms::Atom {
7370 match self {
7371 swc_visit::Either::Left(visitor) => Fold::fold_atom(visitor, node),
7372 swc_visit::Either::Right(visitor) => Fold::fold_atom(visitor, node),
7373 }
7374 }
7375
7376 #[inline]
7377 fn fold_attribute(&mut self, node: Attribute) -> Attribute {
7378 match self {
7379 swc_visit::Either::Left(visitor) => Fold::fold_attribute(visitor, node),
7380 swc_visit::Either::Right(visitor) => Fold::fold_attribute(visitor, node),
7381 }
7382 }
7383
7384 #[inline]
7385 fn fold_attribute_token(&mut self, node: AttributeToken) -> AttributeToken {
7386 match self {
7387 swc_visit::Either::Left(visitor) => Fold::fold_attribute_token(visitor, node),
7388 swc_visit::Either::Right(visitor) => Fold::fold_attribute_token(visitor, node),
7389 }
7390 }
7391
7392 #[inline]
7393 fn fold_attribute_tokens(&mut self, node: Vec<AttributeToken>) -> Vec<AttributeToken> {
7394 match self {
7395 swc_visit::Either::Left(visitor) => Fold::fold_attribute_tokens(visitor, node),
7396 swc_visit::Either::Right(visitor) => Fold::fold_attribute_tokens(visitor, node),
7397 }
7398 }
7399
7400 #[inline]
7401 fn fold_attributes(&mut self, node: Vec<Attribute>) -> Vec<Attribute> {
7402 match self {
7403 swc_visit::Either::Left(visitor) => Fold::fold_attributes(visitor, node),
7404 swc_visit::Either::Right(visitor) => Fold::fold_attributes(visitor, node),
7405 }
7406 }
7407
7408 #[inline]
7409 fn fold_cdata_section(&mut self, node: CdataSection) -> CdataSection {
7410 match self {
7411 swc_visit::Either::Left(visitor) => Fold::fold_cdata_section(visitor, node),
7412 swc_visit::Either::Right(visitor) => Fold::fold_cdata_section(visitor, node),
7413 }
7414 }
7415
7416 #[inline]
7417 fn fold_child(&mut self, node: Child) -> Child {
7418 match self {
7419 swc_visit::Either::Left(visitor) => Fold::fold_child(visitor, node),
7420 swc_visit::Either::Right(visitor) => Fold::fold_child(visitor, node),
7421 }
7422 }
7423
7424 #[inline]
7425 fn fold_childs(&mut self, node: Vec<Child>) -> Vec<Child> {
7426 match self {
7427 swc_visit::Either::Left(visitor) => Fold::fold_childs(visitor, node),
7428 swc_visit::Either::Right(visitor) => Fold::fold_childs(visitor, node),
7429 }
7430 }
7431
7432 #[inline]
7433 fn fold_comment(&mut self, node: Comment) -> Comment {
7434 match self {
7435 swc_visit::Either::Left(visitor) => Fold::fold_comment(visitor, node),
7436 swc_visit::Either::Right(visitor) => Fold::fold_comment(visitor, node),
7437 }
7438 }
7439
7440 #[inline]
7441 fn fold_document(&mut self, node: Document) -> Document {
7442 match self {
7443 swc_visit::Either::Left(visitor) => Fold::fold_document(visitor, node),
7444 swc_visit::Either::Right(visitor) => Fold::fold_document(visitor, node),
7445 }
7446 }
7447
7448 #[inline]
7449 fn fold_document_mode(&mut self, node: DocumentMode) -> DocumentMode {
7450 match self {
7451 swc_visit::Either::Left(visitor) => Fold::fold_document_mode(visitor, node),
7452 swc_visit::Either::Right(visitor) => Fold::fold_document_mode(visitor, node),
7453 }
7454 }
7455
7456 #[inline]
7457 fn fold_document_type(&mut self, node: DocumentType) -> DocumentType {
7458 match self {
7459 swc_visit::Either::Left(visitor) => Fold::fold_document_type(visitor, node),
7460 swc_visit::Either::Right(visitor) => Fold::fold_document_type(visitor, node),
7461 }
7462 }
7463
7464 #[inline]
7465 fn fold_element(&mut self, node: Element) -> Element {
7466 match self {
7467 swc_visit::Either::Left(visitor) => Fold::fold_element(visitor, node),
7468 swc_visit::Either::Right(visitor) => Fold::fold_element(visitor, node),
7469 }
7470 }
7471
7472 #[inline]
7473 fn fold_namespace(&mut self, node: Namespace) -> Namespace {
7474 match self {
7475 swc_visit::Either::Left(visitor) => Fold::fold_namespace(visitor, node),
7476 swc_visit::Either::Right(visitor) => Fold::fold_namespace(visitor, node),
7477 }
7478 }
7479
7480 #[inline]
7481 fn fold_opt_atom(&mut self, node: Option<swc_atoms::Atom>) -> Option<swc_atoms::Atom> {
7482 match self {
7483 swc_visit::Either::Left(visitor) => Fold::fold_opt_atom(visitor, node),
7484 swc_visit::Either::Right(visitor) => Fold::fold_opt_atom(visitor, node),
7485 }
7486 }
7487
7488 #[inline]
7489 fn fold_opt_namespace(&mut self, node: Option<Namespace>) -> Option<Namespace> {
7490 match self {
7491 swc_visit::Either::Left(visitor) => Fold::fold_opt_namespace(visitor, node),
7492 swc_visit::Either::Right(visitor) => Fold::fold_opt_namespace(visitor, node),
7493 }
7494 }
7495
7496 #[inline]
7497 fn fold_processing_instruction(
7498 &mut self,
7499 node: ProcessingInstruction,
7500 ) -> ProcessingInstruction {
7501 match self {
7502 swc_visit::Either::Left(visitor) => Fold::fold_processing_instruction(visitor, node),
7503 swc_visit::Either::Right(visitor) => Fold::fold_processing_instruction(visitor, node),
7504 }
7505 }
7506
7507 #[inline]
7508 fn fold_span(&mut self, node: swc_common::Span) -> swc_common::Span {
7509 match self {
7510 swc_visit::Either::Left(visitor) => Fold::fold_span(visitor, node),
7511 swc_visit::Either::Right(visitor) => Fold::fold_span(visitor, node),
7512 }
7513 }
7514
7515 #[inline]
7516 fn fold_text(&mut self, node: Text) -> Text {
7517 match self {
7518 swc_visit::Either::Left(visitor) => Fold::fold_text(visitor, node),
7519 swc_visit::Either::Right(visitor) => Fold::fold_text(visitor, node),
7520 }
7521 }
7522
7523 #[inline]
7524 fn fold_token(&mut self, node: Token) -> Token {
7525 match self {
7526 swc_visit::Either::Left(visitor) => Fold::fold_token(visitor, node),
7527 swc_visit::Either::Right(visitor) => Fold::fold_token(visitor, node),
7528 }
7529 }
7530
7531 #[inline]
7532 fn fold_token_and_span(&mut self, node: TokenAndSpan) -> TokenAndSpan {
7533 match self {
7534 swc_visit::Either::Left(visitor) => Fold::fold_token_and_span(visitor, node),
7535 swc_visit::Either::Right(visitor) => Fold::fold_token_and_span(visitor, node),
7536 }
7537 }
7538}
7539impl<V> Fold for ::swc_visit::Optional<V>
7540where
7541 V: Fold,
7542{
7543 #[inline]
7544 fn fold_atom(&mut self, node: swc_atoms::Atom) -> swc_atoms::Atom {
7545 if self.enabled {
7546 <V as Fold>::fold_atom(&mut self.visitor, node)
7547 } else {
7548 node
7549 }
7550 }
7551
7552 #[inline]
7553 fn fold_attribute(&mut self, node: Attribute) -> Attribute {
7554 if self.enabled {
7555 <V as Fold>::fold_attribute(&mut self.visitor, node)
7556 } else {
7557 node
7558 }
7559 }
7560
7561 #[inline]
7562 fn fold_attribute_token(&mut self, node: AttributeToken) -> AttributeToken {
7563 if self.enabled {
7564 <V as Fold>::fold_attribute_token(&mut self.visitor, node)
7565 } else {
7566 node
7567 }
7568 }
7569
7570 #[inline]
7571 fn fold_attribute_tokens(&mut self, node: Vec<AttributeToken>) -> Vec<AttributeToken> {
7572 if self.enabled {
7573 <V as Fold>::fold_attribute_tokens(&mut self.visitor, node)
7574 } else {
7575 node
7576 }
7577 }
7578
7579 #[inline]
7580 fn fold_attributes(&mut self, node: Vec<Attribute>) -> Vec<Attribute> {
7581 if self.enabled {
7582 <V as Fold>::fold_attributes(&mut self.visitor, node)
7583 } else {
7584 node
7585 }
7586 }
7587
7588 #[inline]
7589 fn fold_cdata_section(&mut self, node: CdataSection) -> CdataSection {
7590 if self.enabled {
7591 <V as Fold>::fold_cdata_section(&mut self.visitor, node)
7592 } else {
7593 node
7594 }
7595 }
7596
7597 #[inline]
7598 fn fold_child(&mut self, node: Child) -> Child {
7599 if self.enabled {
7600 <V as Fold>::fold_child(&mut self.visitor, node)
7601 } else {
7602 node
7603 }
7604 }
7605
7606 #[inline]
7607 fn fold_childs(&mut self, node: Vec<Child>) -> Vec<Child> {
7608 if self.enabled {
7609 <V as Fold>::fold_childs(&mut self.visitor, node)
7610 } else {
7611 node
7612 }
7613 }
7614
7615 #[inline]
7616 fn fold_comment(&mut self, node: Comment) -> Comment {
7617 if self.enabled {
7618 <V as Fold>::fold_comment(&mut self.visitor, node)
7619 } else {
7620 node
7621 }
7622 }
7623
7624 #[inline]
7625 fn fold_document(&mut self, node: Document) -> Document {
7626 if self.enabled {
7627 <V as Fold>::fold_document(&mut self.visitor, node)
7628 } else {
7629 node
7630 }
7631 }
7632
7633 #[inline]
7634 fn fold_document_mode(&mut self, node: DocumentMode) -> DocumentMode {
7635 if self.enabled {
7636 <V as Fold>::fold_document_mode(&mut self.visitor, node)
7637 } else {
7638 node
7639 }
7640 }
7641
7642 #[inline]
7643 fn fold_document_type(&mut self, node: DocumentType) -> DocumentType {
7644 if self.enabled {
7645 <V as Fold>::fold_document_type(&mut self.visitor, node)
7646 } else {
7647 node
7648 }
7649 }
7650
7651 #[inline]
7652 fn fold_element(&mut self, node: Element) -> Element {
7653 if self.enabled {
7654 <V as Fold>::fold_element(&mut self.visitor, node)
7655 } else {
7656 node
7657 }
7658 }
7659
7660 #[inline]
7661 fn fold_namespace(&mut self, node: Namespace) -> Namespace {
7662 if self.enabled {
7663 <V as Fold>::fold_namespace(&mut self.visitor, node)
7664 } else {
7665 node
7666 }
7667 }
7668
7669 #[inline]
7670 fn fold_opt_atom(&mut self, node: Option<swc_atoms::Atom>) -> Option<swc_atoms::Atom> {
7671 if self.enabled {
7672 <V as Fold>::fold_opt_atom(&mut self.visitor, node)
7673 } else {
7674 node
7675 }
7676 }
7677
7678 #[inline]
7679 fn fold_opt_namespace(&mut self, node: Option<Namespace>) -> Option<Namespace> {
7680 if self.enabled {
7681 <V as Fold>::fold_opt_namespace(&mut self.visitor, node)
7682 } else {
7683 node
7684 }
7685 }
7686
7687 #[inline]
7688 fn fold_processing_instruction(
7689 &mut self,
7690 node: ProcessingInstruction,
7691 ) -> ProcessingInstruction {
7692 if self.enabled {
7693 <V as Fold>::fold_processing_instruction(&mut self.visitor, node)
7694 } else {
7695 node
7696 }
7697 }
7698
7699 #[inline]
7700 fn fold_span(&mut self, node: swc_common::Span) -> swc_common::Span {
7701 if self.enabled {
7702 <V as Fold>::fold_span(&mut self.visitor, node)
7703 } else {
7704 node
7705 }
7706 }
7707
7708 #[inline]
7709 fn fold_text(&mut self, node: Text) -> Text {
7710 if self.enabled {
7711 <V as Fold>::fold_text(&mut self.visitor, node)
7712 } else {
7713 node
7714 }
7715 }
7716
7717 #[inline]
7718 fn fold_token(&mut self, node: Token) -> Token {
7719 if self.enabled {
7720 <V as Fold>::fold_token(&mut self.visitor, node)
7721 } else {
7722 node
7723 }
7724 }
7725
7726 #[inline]
7727 fn fold_token_and_span(&mut self, node: TokenAndSpan) -> TokenAndSpan {
7728 if self.enabled {
7729 <V as Fold>::fold_token_and_span(&mut self.visitor, node)
7730 } else {
7731 node
7732 }
7733 }
7734}
7735#[doc = r" A trait implemented for types that can be visited using a visitor."]
7736pub trait FoldWith<V: ?Sized + Fold> {
7737 #[doc = r" Calls a visitor method (visitor.fold_xxx) with self."]
7738 fn fold_with(self, visitor: &mut V) -> Self;
7739 #[doc = r" Visit children nodes of `self`` with `visitor`."]
7740 fn fold_children_with(self, visitor: &mut V) -> Self;
7741}
7742impl<V: ?Sized + Fold> FoldWith<V> for Attribute {
7743 #[doc = "Calls [Fold`::fold_attribute`] with `self`."]
7744 fn fold_with(self, visitor: &mut V) -> Self {
7745 <V as Fold>::fold_attribute(visitor, self)
7746 }
7747
7748 fn fold_children_with(self, visitor: &mut V) -> Self {
7749 match self {
7750 Attribute {
7751 span,
7752 namespace,
7753 prefix,
7754 name,
7755 raw_name,
7756 value,
7757 raw_value,
7758 } => {
7759 let span = { <swc_common::Span as FoldWith<V>>::fold_with(span, visitor) };
7760 let namespace =
7761 { <Option<Namespace> as FoldWith<V>>::fold_with(namespace, visitor) };
7762 let prefix =
7763 { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(prefix, visitor) };
7764 let name = { <swc_atoms::Atom as FoldWith<V>>::fold_with(name, visitor) };
7765 let raw_name =
7766 { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(raw_name, visitor) };
7767 let value = { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(value, visitor) };
7768 let raw_value =
7769 { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(raw_value, visitor) };
7770 Attribute {
7771 span,
7772 namespace,
7773 prefix,
7774 name,
7775 raw_name,
7776 value,
7777 raw_value,
7778 }
7779 }
7780 }
7781 }
7782}
7783impl<V: ?Sized + Fold> FoldWith<V> for AttributeToken {
7784 #[doc = "Calls [Fold`::fold_attribute_token`] with `self`."]
7785 fn fold_with(self, visitor: &mut V) -> Self {
7786 <V as Fold>::fold_attribute_token(visitor, self)
7787 }
7788
7789 fn fold_children_with(self, visitor: &mut V) -> Self {
7790 match self {
7791 AttributeToken {
7792 span,
7793 name,
7794 raw_name,
7795 value,
7796 raw_value,
7797 } => {
7798 let span = { <swc_common::Span as FoldWith<V>>::fold_with(span, visitor) };
7799 let name = { <swc_atoms::Atom as FoldWith<V>>::fold_with(name, visitor) };
7800 let raw_name =
7801 { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(raw_name, visitor) };
7802 let value = { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(value, visitor) };
7803 let raw_value =
7804 { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(raw_value, visitor) };
7805 AttributeToken {
7806 span,
7807 name,
7808 raw_name,
7809 value,
7810 raw_value,
7811 }
7812 }
7813 }
7814 }
7815}
7816impl<V: ?Sized + Fold> FoldWith<V> for CdataSection {
7817 #[doc = "Calls [Fold`::fold_cdata_section`] with `self`."]
7818 fn fold_with(self, visitor: &mut V) -> Self {
7819 <V as Fold>::fold_cdata_section(visitor, self)
7820 }
7821
7822 fn fold_children_with(self, visitor: &mut V) -> Self {
7823 match self {
7824 CdataSection { span, data, raw } => {
7825 let span = { <swc_common::Span as FoldWith<V>>::fold_with(span, visitor) };
7826 let data = { <swc_atoms::Atom as FoldWith<V>>::fold_with(data, visitor) };
7827 let raw = { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(raw, visitor) };
7828 CdataSection { span, data, raw }
7829 }
7830 }
7831 }
7832}
7833impl<V: ?Sized + Fold> FoldWith<V> for Child {
7834 #[doc = "Calls [Fold`::fold_child`] with `self`."]
7835 fn fold_with(self, visitor: &mut V) -> Self {
7836 <V as Fold>::fold_child(visitor, self)
7837 }
7838
7839 fn fold_children_with(self, visitor: &mut V) -> Self {
7840 match self {
7841 Child::DocumentType { 0: _field_0 } => {
7842 let _field_0 = <DocumentType as FoldWith<V>>::fold_with(_field_0, visitor);
7843 Child::DocumentType { 0: _field_0 }
7844 }
7845 Child::Element { 0: _field_0 } => {
7846 let _field_0 = <Element as FoldWith<V>>::fold_with(_field_0, visitor);
7847 Child::Element { 0: _field_0 }
7848 }
7849 Child::Text { 0: _field_0 } => {
7850 let _field_0 = <Text as FoldWith<V>>::fold_with(_field_0, visitor);
7851 Child::Text { 0: _field_0 }
7852 }
7853 Child::CdataSection { 0: _field_0 } => {
7854 let _field_0 = <CdataSection as FoldWith<V>>::fold_with(_field_0, visitor);
7855 Child::CdataSection { 0: _field_0 }
7856 }
7857 Child::Comment { 0: _field_0 } => {
7858 let _field_0 = <Comment as FoldWith<V>>::fold_with(_field_0, visitor);
7859 Child::Comment { 0: _field_0 }
7860 }
7861 Child::ProcessingInstruction { 0: _field_0 } => {
7862 let _field_0 = <ProcessingInstruction as FoldWith<V>>::fold_with(_field_0, visitor);
7863 Child::ProcessingInstruction { 0: _field_0 }
7864 }
7865 }
7866 }
7867}
7868impl<V: ?Sized + Fold> FoldWith<V> for Comment {
7869 #[doc = "Calls [Fold`::fold_comment`] with `self`."]
7870 fn fold_with(self, visitor: &mut V) -> Self {
7871 <V as Fold>::fold_comment(visitor, self)
7872 }
7873
7874 fn fold_children_with(self, visitor: &mut V) -> Self {
7875 match self {
7876 Comment { span, data, raw } => {
7877 let span = { <swc_common::Span as FoldWith<V>>::fold_with(span, visitor) };
7878 let data = { <swc_atoms::Atom as FoldWith<V>>::fold_with(data, visitor) };
7879 let raw = { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(raw, visitor) };
7880 Comment { span, data, raw }
7881 }
7882 }
7883 }
7884}
7885impl<V: ?Sized + Fold> FoldWith<V> for Document {
7886 #[doc = "Calls [Fold`::fold_document`] with `self`."]
7887 fn fold_with(self, visitor: &mut V) -> Self {
7888 <V as Fold>::fold_document(visitor, self)
7889 }
7890
7891 fn fold_children_with(self, visitor: &mut V) -> Self {
7892 match self {
7893 Document { span, children } => {
7894 let span = { <swc_common::Span as FoldWith<V>>::fold_with(span, visitor) };
7895 let children = { <Vec<Child> as FoldWith<V>>::fold_with(children, visitor) };
7896 Document { span, children }
7897 }
7898 }
7899 }
7900}
7901impl<V: ?Sized + Fold> FoldWith<V> for DocumentMode {
7902 #[doc = "Calls [Fold`::fold_document_mode`] with `self`."]
7903 fn fold_with(self, visitor: &mut V) -> Self {
7904 <V as Fold>::fold_document_mode(visitor, self)
7905 }
7906
7907 fn fold_children_with(self, visitor: &mut V) -> Self {
7908 match self {
7909 DocumentMode::NoQuirks => DocumentMode::NoQuirks,
7910 DocumentMode::LimitedQuirks => DocumentMode::LimitedQuirks,
7911 DocumentMode::Quirks => DocumentMode::Quirks,
7912 }
7913 }
7914}
7915impl<V: ?Sized + Fold> FoldWith<V> for DocumentType {
7916 #[doc = "Calls [Fold`::fold_document_type`] with `self`."]
7917 fn fold_with(self, visitor: &mut V) -> Self {
7918 <V as Fold>::fold_document_type(visitor, self)
7919 }
7920
7921 fn fold_children_with(self, visitor: &mut V) -> Self {
7922 match self {
7923 DocumentType {
7924 span,
7925 name,
7926 public_id,
7927 system_id,
7928 raw,
7929 } => {
7930 let span = { <swc_common::Span as FoldWith<V>>::fold_with(span, visitor) };
7931 let name = { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(name, visitor) };
7932 let public_id =
7933 { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(public_id, visitor) };
7934 let system_id =
7935 { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(system_id, visitor) };
7936 let raw = { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(raw, visitor) };
7937 DocumentType {
7938 span,
7939 name,
7940 public_id,
7941 system_id,
7942 raw,
7943 }
7944 }
7945 }
7946 }
7947}
7948impl<V: ?Sized + Fold> FoldWith<V> for Element {
7949 #[doc = "Calls [Fold`::fold_element`] with `self`."]
7950 fn fold_with(self, visitor: &mut V) -> Self {
7951 <V as Fold>::fold_element(visitor, self)
7952 }
7953
7954 fn fold_children_with(self, visitor: &mut V) -> Self {
7955 match self {
7956 Element {
7957 span,
7958 tag_name,
7959 attributes,
7960 children,
7961 } => {
7962 let span = { <swc_common::Span as FoldWith<V>>::fold_with(span, visitor) };
7963 let tag_name = { <swc_atoms::Atom as FoldWith<V>>::fold_with(tag_name, visitor) };
7964 let attributes =
7965 { <Vec<Attribute> as FoldWith<V>>::fold_with(attributes, visitor) };
7966 let children = { <Vec<Child> as FoldWith<V>>::fold_with(children, visitor) };
7967 Element {
7968 span,
7969 tag_name,
7970 attributes,
7971 children,
7972 }
7973 }
7974 }
7975 }
7976}
7977impl<V: ?Sized + Fold> FoldWith<V> for Namespace {
7978 #[doc = "Calls [Fold`::fold_namespace`] with `self`."]
7979 fn fold_with(self, visitor: &mut V) -> Self {
7980 <V as Fold>::fold_namespace(visitor, self)
7981 }
7982
7983 fn fold_children_with(self, visitor: &mut V) -> Self {
7984 match self {
7985 Namespace::HTML => Namespace::HTML,
7986 Namespace::MATHML => Namespace::MATHML,
7987 Namespace::SVG => Namespace::SVG,
7988 Namespace::XLINK => Namespace::XLINK,
7989 Namespace::XML => Namespace::XML,
7990 Namespace::XMLNS => Namespace::XMLNS,
7991 }
7992 }
7993}
7994impl<V: ?Sized + Fold> FoldWith<V> for ProcessingInstruction {
7995 #[doc = "Calls [Fold`::fold_processing_instruction`] with `self`."]
7996 fn fold_with(self, visitor: &mut V) -> Self {
7997 <V as Fold>::fold_processing_instruction(visitor, self)
7998 }
7999
8000 fn fold_children_with(self, visitor: &mut V) -> Self {
8001 match self {
8002 ProcessingInstruction { span, target, data } => {
8003 let span = { <swc_common::Span as FoldWith<V>>::fold_with(span, visitor) };
8004 let target = { <swc_atoms::Atom as FoldWith<V>>::fold_with(target, visitor) };
8005 let data = { <swc_atoms::Atom as FoldWith<V>>::fold_with(data, visitor) };
8006 ProcessingInstruction { span, target, data }
8007 }
8008 }
8009 }
8010}
8011impl<V: ?Sized + Fold> FoldWith<V> for Text {
8012 #[doc = "Calls [Fold`::fold_text`] with `self`."]
8013 fn fold_with(self, visitor: &mut V) -> Self {
8014 <V as Fold>::fold_text(visitor, self)
8015 }
8016
8017 fn fold_children_with(self, visitor: &mut V) -> Self {
8018 match self {
8019 Text { span, data, raw } => {
8020 let span = { <swc_common::Span as FoldWith<V>>::fold_with(span, visitor) };
8021 let data = { <swc_atoms::Atom as FoldWith<V>>::fold_with(data, visitor) };
8022 let raw = { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(raw, visitor) };
8023 Text { span, data, raw }
8024 }
8025 }
8026 }
8027}
8028impl<V: ?Sized + Fold> FoldWith<V> for Token {
8029 #[doc = "Calls [Fold`::fold_token`] with `self`."]
8030 fn fold_with(self, visitor: &mut V) -> Self {
8031 <V as Fold>::fold_token(visitor, self)
8032 }
8033
8034 fn fold_children_with(self, visitor: &mut V) -> Self {
8035 match self {
8036 Token::Doctype {
8037 name,
8038 public_id,
8039 system_id,
8040 raw,
8041 } => {
8042 let name = { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(name, visitor) };
8043 let public_id =
8044 { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(public_id, visitor) };
8045 let system_id =
8046 { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(system_id, visitor) };
8047 let raw = { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(raw, visitor) };
8048 Token::Doctype {
8049 name,
8050 public_id,
8051 system_id,
8052 raw,
8053 }
8054 }
8055 Token::StartTag {
8056 tag_name,
8057 attributes,
8058 } => {
8059 let tag_name = { <swc_atoms::Atom as FoldWith<V>>::fold_with(tag_name, visitor) };
8060 let attributes =
8061 { <Vec<AttributeToken> as FoldWith<V>>::fold_with(attributes, visitor) };
8062 Token::StartTag {
8063 tag_name,
8064 attributes,
8065 }
8066 }
8067 Token::EndTag {
8068 tag_name,
8069 attributes,
8070 } => {
8071 let tag_name = { <swc_atoms::Atom as FoldWith<V>>::fold_with(tag_name, visitor) };
8072 let attributes =
8073 { <Vec<AttributeToken> as FoldWith<V>>::fold_with(attributes, visitor) };
8074 Token::EndTag {
8075 tag_name,
8076 attributes,
8077 }
8078 }
8079 Token::EmptyTag {
8080 tag_name,
8081 attributes,
8082 } => {
8083 let tag_name = { <swc_atoms::Atom as FoldWith<V>>::fold_with(tag_name, visitor) };
8084 let attributes =
8085 { <Vec<AttributeToken> as FoldWith<V>>::fold_with(attributes, visitor) };
8086 Token::EmptyTag {
8087 tag_name,
8088 attributes,
8089 }
8090 }
8091 Token::Comment { data, raw } => {
8092 let data = { <swc_atoms::Atom as FoldWith<V>>::fold_with(data, visitor) };
8093 let raw = { <swc_atoms::Atom as FoldWith<V>>::fold_with(raw, visitor) };
8094 Token::Comment { data, raw }
8095 }
8096 Token::Character { value, raw } => {
8097 let raw = { <Option<swc_atoms::Atom> as FoldWith<V>>::fold_with(raw, visitor) };
8098 Token::Character { value, raw }
8099 }
8100 Token::ProcessingInstruction { target, data } => {
8101 let target = { <swc_atoms::Atom as FoldWith<V>>::fold_with(target, visitor) };
8102 let data = { <swc_atoms::Atom as FoldWith<V>>::fold_with(data, visitor) };
8103 Token::ProcessingInstruction { target, data }
8104 }
8105 Token::Cdata { data, raw } => {
8106 let data = { <swc_atoms::Atom as FoldWith<V>>::fold_with(data, visitor) };
8107 let raw = { <swc_atoms::Atom as FoldWith<V>>::fold_with(raw, visitor) };
8108 Token::Cdata { data, raw }
8109 }
8110 Token::Eof => Token::Eof,
8111 }
8112 }
8113}
8114impl<V: ?Sized + Fold> FoldWith<V> for TokenAndSpan {
8115 #[doc = "Calls [Fold`::fold_token_and_span`] with `self`."]
8116 fn fold_with(self, visitor: &mut V) -> Self {
8117 <V as Fold>::fold_token_and_span(visitor, self)
8118 }
8119
8120 fn fold_children_with(self, visitor: &mut V) -> Self {
8121 match self {
8122 TokenAndSpan { span, token } => {
8123 let span = { <swc_common::Span as FoldWith<V>>::fold_with(span, visitor) };
8124 let token = { <Token as FoldWith<V>>::fold_with(token, visitor) };
8125 TokenAndSpan { span, token }
8126 }
8127 }
8128 }
8129}
8130impl<V: ?Sized + Fold> FoldWith<V> for swc_atoms::Atom {
8131 #[doc = "Calls [Fold`::fold_atom`] with `self`. (Extra impl)"]
8132 #[inline]
8133 fn fold_with(self, visitor: &mut V) -> Self {
8134 <V as Fold>::fold_atom(visitor, self)
8135 }
8136
8137 #[inline]
8138 fn fold_children_with(self, visitor: &mut V) -> Self {
8139 self
8140 }
8141}
8142impl<V: ?Sized + Fold> FoldWith<V> for Vec<AttributeToken> {
8143 #[doc = "Calls [Fold`::fold_attribute_tokens`] with `self`. (Extra impl)"]
8144 #[inline]
8145 fn fold_with(self, visitor: &mut V) -> Self {
8146 <V as Fold>::fold_attribute_tokens(visitor, self)
8147 }
8148
8149 #[inline]
8150 fn fold_children_with(self, visitor: &mut V) -> Self {
8151 swc_visit::util::move_map::MoveMap::move_map(self, |item| {
8152 <AttributeToken as FoldWith<V>>::fold_with(item, visitor)
8153 })
8154 }
8155}
8156impl<V: ?Sized + Fold> FoldWith<V> for Vec<Attribute> {
8157 #[doc = "Calls [Fold`::fold_attributes`] with `self`. (Extra impl)"]
8158 #[inline]
8159 fn fold_with(self, visitor: &mut V) -> Self {
8160 <V as Fold>::fold_attributes(visitor, self)
8161 }
8162
8163 #[inline]
8164 fn fold_children_with(self, visitor: &mut V) -> Self {
8165 swc_visit::util::move_map::MoveMap::move_map(self, |item| {
8166 <Attribute as FoldWith<V>>::fold_with(item, visitor)
8167 })
8168 }
8169}
8170impl<V: ?Sized + Fold> FoldWith<V> for Vec<Child> {
8171 #[doc = "Calls [Fold`::fold_childs`] with `self`. (Extra impl)"]
8172 #[inline]
8173 fn fold_with(self, visitor: &mut V) -> Self {
8174 <V as Fold>::fold_childs(visitor, self)
8175 }
8176
8177 #[inline]
8178 fn fold_children_with(self, visitor: &mut V) -> Self {
8179 swc_visit::util::move_map::MoveMap::move_map(self, |item| {
8180 <Child as FoldWith<V>>::fold_with(item, visitor)
8181 })
8182 }
8183}
8184impl<V: ?Sized + Fold> FoldWith<V> for Option<swc_atoms::Atom> {
8185 #[doc = "Calls [Fold`::fold_opt_atom`] with `self`. (Extra impl)"]
8186 #[inline]
8187 fn fold_with(self, visitor: &mut V) -> Self {
8188 <V as Fold>::fold_opt_atom(visitor, self)
8189 }
8190
8191 #[inline]
8192 fn fold_children_with(self, visitor: &mut V) -> Self {
8193 self.map(|inner| <swc_atoms::Atom as FoldWith<V>>::fold_with(inner, visitor))
8194 }
8195}
8196impl<V: ?Sized + Fold> FoldWith<V> for Option<Namespace> {
8197 #[doc = "Calls [Fold`::fold_opt_namespace`] with `self`. (Extra impl)"]
8198 #[inline]
8199 fn fold_with(self, visitor: &mut V) -> Self {
8200 <V as Fold>::fold_opt_namespace(visitor, self)
8201 }
8202
8203 #[inline]
8204 fn fold_children_with(self, visitor: &mut V) -> Self {
8205 self.map(|inner| <Namespace as FoldWith<V>>::fold_with(inner, visitor))
8206 }
8207}
8208impl<V: ?Sized + Fold> FoldWith<V> for swc_common::Span {
8209 #[doc = "Calls [Fold`::fold_span`] with `self`. (Extra impl)"]
8210 #[inline]
8211 fn fold_with(self, visitor: &mut V) -> Self {
8212 <V as Fold>::fold_span(visitor, self)
8213 }
8214
8215 #[inline]
8216 fn fold_children_with(self, visitor: &mut V) -> Self {
8217 self
8218 }
8219}
8220impl<V, T> FoldWith<V> for std::boxed::Box<T>
8221where
8222 V: ?Sized + Fold,
8223 T: FoldWith<V>,
8224{
8225 #[inline]
8226 fn fold_with(self, visitor: &mut V) -> Self {
8227 swc_visit::util::map::Map::map(self, |inner| <T as FoldWith<V>>::fold_with(inner, visitor))
8228 }
8229
8230 #[inline]
8231 fn fold_children_with(self, visitor: &mut V) -> Self {
8232 swc_visit::util::map::Map::map(self, |inner| {
8233 <T as FoldWith<V>>::fold_children_with(inner, visitor)
8234 })
8235 }
8236}
8237#[doc = r" A visitor trait for traversing the AST."]
8238#[cfg(any(docsrs, feature = "path"))]
8239#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
8240pub trait FoldAstPath {
8241 #[doc = "Visit a node of type `swc_atoms :: Atom`.\n\nBy default, this method calls \
8242 [`swc_atoms :: Atom::fold_children_with_ast_path`]. If you want to recurse, you need \
8243 to call it manually."]
8244 #[inline]
8245 fn fold_atom(
8246 &mut self,
8247 node: swc_atoms::Atom,
8248 __ast_path: &mut AstKindPath,
8249 ) -> swc_atoms::Atom {
8250 <swc_atoms::Atom as FoldWithAstPath<Self>>::fold_children_with_ast_path(
8251 node, self, __ast_path,
8252 )
8253 }
8254 #[doc = "Visit a node of type `Attribute`.\n\nBy default, this method calls \
8255 [`Attribute::fold_children_with_ast_path`]. If you want to recurse, you need to call \
8256 it manually."]
8257 #[inline]
8258 fn fold_attribute(&mut self, node: Attribute, __ast_path: &mut AstKindPath) -> Attribute {
8259 <Attribute as FoldWithAstPath<Self>>::fold_children_with_ast_path(node, self, __ast_path)
8260 }
8261 #[doc = "Visit a node of type `AttributeToken`.\n\nBy default, this method calls \
8262 [`AttributeToken::fold_children_with_ast_path`]. If you want to recurse, you need to \
8263 call it manually."]
8264 #[inline]
8265 fn fold_attribute_token(
8266 &mut self,
8267 node: AttributeToken,
8268 __ast_path: &mut AstKindPath,
8269 ) -> AttributeToken {
8270 <AttributeToken as FoldWithAstPath<Self>>::fold_children_with_ast_path(
8271 node, self, __ast_path,
8272 )
8273 }
8274 #[doc = "Visit a node of type `Vec < AttributeToken >`.\n\nBy default, this method calls [`Vec \
8275 < AttributeToken >::fold_children_with_ast_path`]. If you want to recurse, you need \
8276 to call it manually."]
8277 #[inline]
8278 fn fold_attribute_tokens(
8279 &mut self,
8280 node: Vec<AttributeToken>,
8281 __ast_path: &mut AstKindPath,
8282 ) -> Vec<AttributeToken> {
8283 <Vec<AttributeToken> as FoldWithAstPath<Self>>::fold_children_with_ast_path(
8284 node, self, __ast_path,
8285 )
8286 }
8287 #[doc = "Visit a node of type `Vec < Attribute >`.\n\nBy default, this method calls [`Vec < \
8288 Attribute >::fold_children_with_ast_path`]. If you want to recurse, you need to call \
8289 it manually."]
8290 #[inline]
8291 fn fold_attributes(
8292 &mut self,
8293 node: Vec<Attribute>,
8294 __ast_path: &mut AstKindPath,
8295 ) -> Vec<Attribute> {
8296 <Vec<Attribute> as FoldWithAstPath<Self>>::fold_children_with_ast_path(
8297 node, self, __ast_path,
8298 )
8299 }
8300 #[doc = "Visit a node of type `CdataSection`.\n\nBy default, this method calls \
8301 [`CdataSection::fold_children_with_ast_path`]. If you want to recurse, you need to \
8302 call it manually."]
8303 #[inline]
8304 fn fold_cdata_section(
8305 &mut self,
8306 node: CdataSection,
8307 __ast_path: &mut AstKindPath,
8308 ) -> CdataSection {
8309 <CdataSection as FoldWithAstPath<Self>>::fold_children_with_ast_path(node, self, __ast_path)
8310 }
8311 #[doc = "Visit a node of type `Child`.\n\nBy default, this method calls \
8312 [`Child::fold_children_with_ast_path`]. If you want to recurse, you need to call it \
8313 manually."]
8314 #[inline]
8315 fn fold_child(&mut self, node: Child, __ast_path: &mut AstKindPath) -> Child {
8316 <Child as FoldWithAstPath<Self>>::fold_children_with_ast_path(node, self, __ast_path)
8317 }
8318 #[doc = "Visit a node of type `Vec < Child >`.\n\nBy default, this method calls [`Vec < Child \
8319 >::fold_children_with_ast_path`]. If you want to recurse, you need to call it \
8320 manually."]
8321 #[inline]
8322 fn fold_childs(&mut self, node: Vec<Child>, __ast_path: &mut AstKindPath) -> Vec<Child> {
8323 <Vec<Child> as FoldWithAstPath<Self>>::fold_children_with_ast_path(node, self, __ast_path)
8324 }
8325 #[doc = "Visit a node of type `Comment`.\n\nBy default, this method calls \
8326 [`Comment::fold_children_with_ast_path`]. If you want to recurse, you need to call it \
8327 manually."]
8328 #[inline]
8329 fn fold_comment(&mut self, node: Comment, __ast_path: &mut AstKindPath) -> Comment {
8330 <Comment as FoldWithAstPath<Self>>::fold_children_with_ast_path(node, self, __ast_path)
8331 }
8332 #[doc = "Visit a node of type `Document`.\n\nBy default, this method calls \
8333 [`Document::fold_children_with_ast_path`]. If you want to recurse, you need to call \
8334 it manually."]
8335 #[inline]
8336 fn fold_document(&mut self, node: Document, __ast_path: &mut AstKindPath) -> Document {
8337 <Document as FoldWithAstPath<Self>>::fold_children_with_ast_path(node, self, __ast_path)
8338 }
8339 #[doc = "Visit a node of type `DocumentMode`.\n\nBy default, this method calls \
8340 [`DocumentMode::fold_children_with_ast_path`]. If you want to recurse, you need to \
8341 call it manually."]
8342 #[inline]
8343 fn fold_document_mode(
8344 &mut self,
8345 node: DocumentMode,
8346 __ast_path: &mut AstKindPath,
8347 ) -> DocumentMode {
8348 <DocumentMode as FoldWithAstPath<Self>>::fold_children_with_ast_path(node, self, __ast_path)
8349 }
8350 #[doc = "Visit a node of type `DocumentType`.\n\nBy default, this method calls \
8351 [`DocumentType::fold_children_with_ast_path`]. If you want to recurse, you need to \
8352 call it manually."]
8353 #[inline]
8354 fn fold_document_type(
8355 &mut self,
8356 node: DocumentType,
8357 __ast_path: &mut AstKindPath,
8358 ) -> DocumentType {
8359 <DocumentType as FoldWithAstPath<Self>>::fold_children_with_ast_path(node, self, __ast_path)
8360 }
8361 #[doc = "Visit a node of type `Element`.\n\nBy default, this method calls \
8362 [`Element::fold_children_with_ast_path`]. If you want to recurse, you need to call it \
8363 manually."]
8364 #[inline]
8365 fn fold_element(&mut self, node: Element, __ast_path: &mut AstKindPath) -> Element {
8366 <Element as FoldWithAstPath<Self>>::fold_children_with_ast_path(node, self, __ast_path)
8367 }
8368 #[doc = "Visit a node of type `Namespace`.\n\nBy default, this method calls \
8369 [`Namespace::fold_children_with_ast_path`]. If you want to recurse, you need to call \
8370 it manually."]
8371 #[inline]
8372 fn fold_namespace(&mut self, node: Namespace, __ast_path: &mut AstKindPath) -> Namespace {
8373 <Namespace as FoldWithAstPath<Self>>::fold_children_with_ast_path(node, self, __ast_path)
8374 }
8375 #[doc = "Visit a node of type `Option < swc_atoms :: Atom >`.\n\nBy default, this method calls \
8376 [`Option < swc_atoms :: Atom >::fold_children_with_ast_path`]. If you want to \
8377 recurse, you need to call it manually."]
8378 #[inline]
8379 fn fold_opt_atom(
8380 &mut self,
8381 node: Option<swc_atoms::Atom>,
8382 __ast_path: &mut AstKindPath,
8383 ) -> Option<swc_atoms::Atom> {
8384 <Option<swc_atoms::Atom> as FoldWithAstPath<Self>>::fold_children_with_ast_path(
8385 node, self, __ast_path,
8386 )
8387 }
8388 #[doc = "Visit a node of type `Option < Namespace >`.\n\nBy default, this method calls \
8389 [`Option < Namespace >::fold_children_with_ast_path`]. If you want to recurse, you \
8390 need to call it manually."]
8391 #[inline]
8392 fn fold_opt_namespace(
8393 &mut self,
8394 node: Option<Namespace>,
8395 __ast_path: &mut AstKindPath,
8396 ) -> Option<Namespace> {
8397 <Option<Namespace> as FoldWithAstPath<Self>>::fold_children_with_ast_path(
8398 node, self, __ast_path,
8399 )
8400 }
8401 #[doc = "Visit a node of type `ProcessingInstruction`.\n\nBy default, this method calls \
8402 [`ProcessingInstruction::fold_children_with_ast_path`]. If you want to recurse, you \
8403 need to call it manually."]
8404 #[inline]
8405 fn fold_processing_instruction(
8406 &mut self,
8407 node: ProcessingInstruction,
8408 __ast_path: &mut AstKindPath,
8409 ) -> ProcessingInstruction {
8410 <ProcessingInstruction as FoldWithAstPath<Self>>::fold_children_with_ast_path(
8411 node, self, __ast_path,
8412 )
8413 }
8414 #[doc = "Visit a node of type `swc_common :: Span`.\n\nBy default, this method calls \
8415 [`swc_common :: Span::fold_children_with_ast_path`]. If you want to recurse, you need \
8416 to call it manually."]
8417 #[inline]
8418 fn fold_span(
8419 &mut self,
8420 node: swc_common::Span,
8421 __ast_path: &mut AstKindPath,
8422 ) -> swc_common::Span {
8423 <swc_common::Span as FoldWithAstPath<Self>>::fold_children_with_ast_path(
8424 node, self, __ast_path,
8425 )
8426 }
8427 #[doc = "Visit a node of type `Text`.\n\nBy default, this method calls \
8428 [`Text::fold_children_with_ast_path`]. If you want to recurse, you need to call it \
8429 manually."]
8430 #[inline]
8431 fn fold_text(&mut self, node: Text, __ast_path: &mut AstKindPath) -> Text {
8432 <Text as FoldWithAstPath<Self>>::fold_children_with_ast_path(node, self, __ast_path)
8433 }
8434 #[doc = "Visit a node of type `Token`.\n\nBy default, this method calls \
8435 [`Token::fold_children_with_ast_path`]. If you want to recurse, you need to call it \
8436 manually."]
8437 #[inline]
8438 fn fold_token(&mut self, node: Token, __ast_path: &mut AstKindPath) -> Token {
8439 <Token as FoldWithAstPath<Self>>::fold_children_with_ast_path(node, self, __ast_path)
8440 }
8441 #[doc = "Visit a node of type `TokenAndSpan`.\n\nBy default, this method calls \
8442 [`TokenAndSpan::fold_children_with_ast_path`]. If you want to recurse, you need to \
8443 call it manually."]
8444 #[inline]
8445 fn fold_token_and_span(
8446 &mut self,
8447 node: TokenAndSpan,
8448 __ast_path: &mut AstKindPath,
8449 ) -> TokenAndSpan {
8450 <TokenAndSpan as FoldWithAstPath<Self>>::fold_children_with_ast_path(node, self, __ast_path)
8451 }
8452}
8453#[cfg(any(docsrs, feature = "path"))]
8454#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
8455impl<V> FoldAstPath for &mut V
8456where
8457 V: ?Sized + FoldAstPath,
8458{
8459 #[inline]
8460 fn fold_atom(
8461 &mut self,
8462 node: swc_atoms::Atom,
8463 __ast_path: &mut AstKindPath,
8464 ) -> swc_atoms::Atom {
8465 <V as FoldAstPath>::fold_atom(&mut **self, node, __ast_path)
8466 }
8467
8468 #[inline]
8469 fn fold_attribute(&mut self, node: Attribute, __ast_path: &mut AstKindPath) -> Attribute {
8470 <V as FoldAstPath>::fold_attribute(&mut **self, node, __ast_path)
8471 }
8472
8473 #[inline]
8474 fn fold_attribute_token(
8475 &mut self,
8476 node: AttributeToken,
8477 __ast_path: &mut AstKindPath,
8478 ) -> AttributeToken {
8479 <V as FoldAstPath>::fold_attribute_token(&mut **self, node, __ast_path)
8480 }
8481
8482 #[inline]
8483 fn fold_attribute_tokens(
8484 &mut self,
8485 node: Vec<AttributeToken>,
8486 __ast_path: &mut AstKindPath,
8487 ) -> Vec<AttributeToken> {
8488 <V as FoldAstPath>::fold_attribute_tokens(&mut **self, node, __ast_path)
8489 }
8490
8491 #[inline]
8492 fn fold_attributes(
8493 &mut self,
8494 node: Vec<Attribute>,
8495 __ast_path: &mut AstKindPath,
8496 ) -> Vec<Attribute> {
8497 <V as FoldAstPath>::fold_attributes(&mut **self, node, __ast_path)
8498 }
8499
8500 #[inline]
8501 fn fold_cdata_section(
8502 &mut self,
8503 node: CdataSection,
8504 __ast_path: &mut AstKindPath,
8505 ) -> CdataSection {
8506 <V as FoldAstPath>::fold_cdata_section(&mut **self, node, __ast_path)
8507 }
8508
8509 #[inline]
8510 fn fold_child(&mut self, node: Child, __ast_path: &mut AstKindPath) -> Child {
8511 <V as FoldAstPath>::fold_child(&mut **self, node, __ast_path)
8512 }
8513
8514 #[inline]
8515 fn fold_childs(&mut self, node: Vec<Child>, __ast_path: &mut AstKindPath) -> Vec<Child> {
8516 <V as FoldAstPath>::fold_childs(&mut **self, node, __ast_path)
8517 }
8518
8519 #[inline]
8520 fn fold_comment(&mut self, node: Comment, __ast_path: &mut AstKindPath) -> Comment {
8521 <V as FoldAstPath>::fold_comment(&mut **self, node, __ast_path)
8522 }
8523
8524 #[inline]
8525 fn fold_document(&mut self, node: Document, __ast_path: &mut AstKindPath) -> Document {
8526 <V as FoldAstPath>::fold_document(&mut **self, node, __ast_path)
8527 }
8528
8529 #[inline]
8530 fn fold_document_mode(
8531 &mut self,
8532 node: DocumentMode,
8533 __ast_path: &mut AstKindPath,
8534 ) -> DocumentMode {
8535 <V as FoldAstPath>::fold_document_mode(&mut **self, node, __ast_path)
8536 }
8537
8538 #[inline]
8539 fn fold_document_type(
8540 &mut self,
8541 node: DocumentType,
8542 __ast_path: &mut AstKindPath,
8543 ) -> DocumentType {
8544 <V as FoldAstPath>::fold_document_type(&mut **self, node, __ast_path)
8545 }
8546
8547 #[inline]
8548 fn fold_element(&mut self, node: Element, __ast_path: &mut AstKindPath) -> Element {
8549 <V as FoldAstPath>::fold_element(&mut **self, node, __ast_path)
8550 }
8551
8552 #[inline]
8553 fn fold_namespace(&mut self, node: Namespace, __ast_path: &mut AstKindPath) -> Namespace {
8554 <V as FoldAstPath>::fold_namespace(&mut **self, node, __ast_path)
8555 }
8556
8557 #[inline]
8558 fn fold_opt_atom(
8559 &mut self,
8560 node: Option<swc_atoms::Atom>,
8561 __ast_path: &mut AstKindPath,
8562 ) -> Option<swc_atoms::Atom> {
8563 <V as FoldAstPath>::fold_opt_atom(&mut **self, node, __ast_path)
8564 }
8565
8566 #[inline]
8567 fn fold_opt_namespace(
8568 &mut self,
8569 node: Option<Namespace>,
8570 __ast_path: &mut AstKindPath,
8571 ) -> Option<Namespace> {
8572 <V as FoldAstPath>::fold_opt_namespace(&mut **self, node, __ast_path)
8573 }
8574
8575 #[inline]
8576 fn fold_processing_instruction(
8577 &mut self,
8578 node: ProcessingInstruction,
8579 __ast_path: &mut AstKindPath,
8580 ) -> ProcessingInstruction {
8581 <V as FoldAstPath>::fold_processing_instruction(&mut **self, node, __ast_path)
8582 }
8583
8584 #[inline]
8585 fn fold_span(
8586 &mut self,
8587 node: swc_common::Span,
8588 __ast_path: &mut AstKindPath,
8589 ) -> swc_common::Span {
8590 <V as FoldAstPath>::fold_span(&mut **self, node, __ast_path)
8591 }
8592
8593 #[inline]
8594 fn fold_text(&mut self, node: Text, __ast_path: &mut AstKindPath) -> Text {
8595 <V as FoldAstPath>::fold_text(&mut **self, node, __ast_path)
8596 }
8597
8598 #[inline]
8599 fn fold_token(&mut self, node: Token, __ast_path: &mut AstKindPath) -> Token {
8600 <V as FoldAstPath>::fold_token(&mut **self, node, __ast_path)
8601 }
8602
8603 #[inline]
8604 fn fold_token_and_span(
8605 &mut self,
8606 node: TokenAndSpan,
8607 __ast_path: &mut AstKindPath,
8608 ) -> TokenAndSpan {
8609 <V as FoldAstPath>::fold_token_and_span(&mut **self, node, __ast_path)
8610 }
8611}
8612#[cfg(any(docsrs, feature = "path"))]
8613#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
8614impl<V> FoldAstPath for Box<V>
8615where
8616 V: ?Sized + FoldAstPath,
8617{
8618 #[inline]
8619 fn fold_atom(
8620 &mut self,
8621 node: swc_atoms::Atom,
8622 __ast_path: &mut AstKindPath,
8623 ) -> swc_atoms::Atom {
8624 <V as FoldAstPath>::fold_atom(&mut **self, node, __ast_path)
8625 }
8626
8627 #[inline]
8628 fn fold_attribute(&mut self, node: Attribute, __ast_path: &mut AstKindPath) -> Attribute {
8629 <V as FoldAstPath>::fold_attribute(&mut **self, node, __ast_path)
8630 }
8631
8632 #[inline]
8633 fn fold_attribute_token(
8634 &mut self,
8635 node: AttributeToken,
8636 __ast_path: &mut AstKindPath,
8637 ) -> AttributeToken {
8638 <V as FoldAstPath>::fold_attribute_token(&mut **self, node, __ast_path)
8639 }
8640
8641 #[inline]
8642 fn fold_attribute_tokens(
8643 &mut self,
8644 node: Vec<AttributeToken>,
8645 __ast_path: &mut AstKindPath,
8646 ) -> Vec<AttributeToken> {
8647 <V as FoldAstPath>::fold_attribute_tokens(&mut **self, node, __ast_path)
8648 }
8649
8650 #[inline]
8651 fn fold_attributes(
8652 &mut self,
8653 node: Vec<Attribute>,
8654 __ast_path: &mut AstKindPath,
8655 ) -> Vec<Attribute> {
8656 <V as FoldAstPath>::fold_attributes(&mut **self, node, __ast_path)
8657 }
8658
8659 #[inline]
8660 fn fold_cdata_section(
8661 &mut self,
8662 node: CdataSection,
8663 __ast_path: &mut AstKindPath,
8664 ) -> CdataSection {
8665 <V as FoldAstPath>::fold_cdata_section(&mut **self, node, __ast_path)
8666 }
8667
8668 #[inline]
8669 fn fold_child(&mut self, node: Child, __ast_path: &mut AstKindPath) -> Child {
8670 <V as FoldAstPath>::fold_child(&mut **self, node, __ast_path)
8671 }
8672
8673 #[inline]
8674 fn fold_childs(&mut self, node: Vec<Child>, __ast_path: &mut AstKindPath) -> Vec<Child> {
8675 <V as FoldAstPath>::fold_childs(&mut **self, node, __ast_path)
8676 }
8677
8678 #[inline]
8679 fn fold_comment(&mut self, node: Comment, __ast_path: &mut AstKindPath) -> Comment {
8680 <V as FoldAstPath>::fold_comment(&mut **self, node, __ast_path)
8681 }
8682
8683 #[inline]
8684 fn fold_document(&mut self, node: Document, __ast_path: &mut AstKindPath) -> Document {
8685 <V as FoldAstPath>::fold_document(&mut **self, node, __ast_path)
8686 }
8687
8688 #[inline]
8689 fn fold_document_mode(
8690 &mut self,
8691 node: DocumentMode,
8692 __ast_path: &mut AstKindPath,
8693 ) -> DocumentMode {
8694 <V as FoldAstPath>::fold_document_mode(&mut **self, node, __ast_path)
8695 }
8696
8697 #[inline]
8698 fn fold_document_type(
8699 &mut self,
8700 node: DocumentType,
8701 __ast_path: &mut AstKindPath,
8702 ) -> DocumentType {
8703 <V as FoldAstPath>::fold_document_type(&mut **self, node, __ast_path)
8704 }
8705
8706 #[inline]
8707 fn fold_element(&mut self, node: Element, __ast_path: &mut AstKindPath) -> Element {
8708 <V as FoldAstPath>::fold_element(&mut **self, node, __ast_path)
8709 }
8710
8711 #[inline]
8712 fn fold_namespace(&mut self, node: Namespace, __ast_path: &mut AstKindPath) -> Namespace {
8713 <V as FoldAstPath>::fold_namespace(&mut **self, node, __ast_path)
8714 }
8715
8716 #[inline]
8717 fn fold_opt_atom(
8718 &mut self,
8719 node: Option<swc_atoms::Atom>,
8720 __ast_path: &mut AstKindPath,
8721 ) -> Option<swc_atoms::Atom> {
8722 <V as FoldAstPath>::fold_opt_atom(&mut **self, node, __ast_path)
8723 }
8724
8725 #[inline]
8726 fn fold_opt_namespace(
8727 &mut self,
8728 node: Option<Namespace>,
8729 __ast_path: &mut AstKindPath,
8730 ) -> Option<Namespace> {
8731 <V as FoldAstPath>::fold_opt_namespace(&mut **self, node, __ast_path)
8732 }
8733
8734 #[inline]
8735 fn fold_processing_instruction(
8736 &mut self,
8737 node: ProcessingInstruction,
8738 __ast_path: &mut AstKindPath,
8739 ) -> ProcessingInstruction {
8740 <V as FoldAstPath>::fold_processing_instruction(&mut **self, node, __ast_path)
8741 }
8742
8743 #[inline]
8744 fn fold_span(
8745 &mut self,
8746 node: swc_common::Span,
8747 __ast_path: &mut AstKindPath,
8748 ) -> swc_common::Span {
8749 <V as FoldAstPath>::fold_span(&mut **self, node, __ast_path)
8750 }
8751
8752 #[inline]
8753 fn fold_text(&mut self, node: Text, __ast_path: &mut AstKindPath) -> Text {
8754 <V as FoldAstPath>::fold_text(&mut **self, node, __ast_path)
8755 }
8756
8757 #[inline]
8758 fn fold_token(&mut self, node: Token, __ast_path: &mut AstKindPath) -> Token {
8759 <V as FoldAstPath>::fold_token(&mut **self, node, __ast_path)
8760 }
8761
8762 #[inline]
8763 fn fold_token_and_span(
8764 &mut self,
8765 node: TokenAndSpan,
8766 __ast_path: &mut AstKindPath,
8767 ) -> TokenAndSpan {
8768 <V as FoldAstPath>::fold_token_and_span(&mut **self, node, __ast_path)
8769 }
8770}
8771#[cfg(any(docsrs, feature = "path"))]
8772#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
8773impl<A, B> FoldAstPath for ::swc_visit::Either<A, B>
8774where
8775 A: FoldAstPath,
8776 B: FoldAstPath,
8777{
8778 #[inline]
8779 fn fold_atom(
8780 &mut self,
8781 node: swc_atoms::Atom,
8782 __ast_path: &mut AstKindPath,
8783 ) -> swc_atoms::Atom {
8784 match self {
8785 swc_visit::Either::Left(visitor) => FoldAstPath::fold_atom(visitor, node, __ast_path),
8786 swc_visit::Either::Right(visitor) => FoldAstPath::fold_atom(visitor, node, __ast_path),
8787 }
8788 }
8789
8790 #[inline]
8791 fn fold_attribute(&mut self, node: Attribute, __ast_path: &mut AstKindPath) -> Attribute {
8792 match self {
8793 swc_visit::Either::Left(visitor) => {
8794 FoldAstPath::fold_attribute(visitor, node, __ast_path)
8795 }
8796 swc_visit::Either::Right(visitor) => {
8797 FoldAstPath::fold_attribute(visitor, node, __ast_path)
8798 }
8799 }
8800 }
8801
8802 #[inline]
8803 fn fold_attribute_token(
8804 &mut self,
8805 node: AttributeToken,
8806 __ast_path: &mut AstKindPath,
8807 ) -> AttributeToken {
8808 match self {
8809 swc_visit::Either::Left(visitor) => {
8810 FoldAstPath::fold_attribute_token(visitor, node, __ast_path)
8811 }
8812 swc_visit::Either::Right(visitor) => {
8813 FoldAstPath::fold_attribute_token(visitor, node, __ast_path)
8814 }
8815 }
8816 }
8817
8818 #[inline]
8819 fn fold_attribute_tokens(
8820 &mut self,
8821 node: Vec<AttributeToken>,
8822 __ast_path: &mut AstKindPath,
8823 ) -> Vec<AttributeToken> {
8824 match self {
8825 swc_visit::Either::Left(visitor) => {
8826 FoldAstPath::fold_attribute_tokens(visitor, node, __ast_path)
8827 }
8828 swc_visit::Either::Right(visitor) => {
8829 FoldAstPath::fold_attribute_tokens(visitor, node, __ast_path)
8830 }
8831 }
8832 }
8833
8834 #[inline]
8835 fn fold_attributes(
8836 &mut self,
8837 node: Vec<Attribute>,
8838 __ast_path: &mut AstKindPath,
8839 ) -> Vec<Attribute> {
8840 match self {
8841 swc_visit::Either::Left(visitor) => {
8842 FoldAstPath::fold_attributes(visitor, node, __ast_path)
8843 }
8844 swc_visit::Either::Right(visitor) => {
8845 FoldAstPath::fold_attributes(visitor, node, __ast_path)
8846 }
8847 }
8848 }
8849
8850 #[inline]
8851 fn fold_cdata_section(
8852 &mut self,
8853 node: CdataSection,
8854 __ast_path: &mut AstKindPath,
8855 ) -> CdataSection {
8856 match self {
8857 swc_visit::Either::Left(visitor) => {
8858 FoldAstPath::fold_cdata_section(visitor, node, __ast_path)
8859 }
8860 swc_visit::Either::Right(visitor) => {
8861 FoldAstPath::fold_cdata_section(visitor, node, __ast_path)
8862 }
8863 }
8864 }
8865
8866 #[inline]
8867 fn fold_child(&mut self, node: Child, __ast_path: &mut AstKindPath) -> Child {
8868 match self {
8869 swc_visit::Either::Left(visitor) => FoldAstPath::fold_child(visitor, node, __ast_path),
8870 swc_visit::Either::Right(visitor) => FoldAstPath::fold_child(visitor, node, __ast_path),
8871 }
8872 }
8873
8874 #[inline]
8875 fn fold_childs(&mut self, node: Vec<Child>, __ast_path: &mut AstKindPath) -> Vec<Child> {
8876 match self {
8877 swc_visit::Either::Left(visitor) => FoldAstPath::fold_childs(visitor, node, __ast_path),
8878 swc_visit::Either::Right(visitor) => {
8879 FoldAstPath::fold_childs(visitor, node, __ast_path)
8880 }
8881 }
8882 }
8883
8884 #[inline]
8885 fn fold_comment(&mut self, node: Comment, __ast_path: &mut AstKindPath) -> Comment {
8886 match self {
8887 swc_visit::Either::Left(visitor) => {
8888 FoldAstPath::fold_comment(visitor, node, __ast_path)
8889 }
8890 swc_visit::Either::Right(visitor) => {
8891 FoldAstPath::fold_comment(visitor, node, __ast_path)
8892 }
8893 }
8894 }
8895
8896 #[inline]
8897 fn fold_document(&mut self, node: Document, __ast_path: &mut AstKindPath) -> Document {
8898 match self {
8899 swc_visit::Either::Left(visitor) => {
8900 FoldAstPath::fold_document(visitor, node, __ast_path)
8901 }
8902 swc_visit::Either::Right(visitor) => {
8903 FoldAstPath::fold_document(visitor, node, __ast_path)
8904 }
8905 }
8906 }
8907
8908 #[inline]
8909 fn fold_document_mode(
8910 &mut self,
8911 node: DocumentMode,
8912 __ast_path: &mut AstKindPath,
8913 ) -> DocumentMode {
8914 match self {
8915 swc_visit::Either::Left(visitor) => {
8916 FoldAstPath::fold_document_mode(visitor, node, __ast_path)
8917 }
8918 swc_visit::Either::Right(visitor) => {
8919 FoldAstPath::fold_document_mode(visitor, node, __ast_path)
8920 }
8921 }
8922 }
8923
8924 #[inline]
8925 fn fold_document_type(
8926 &mut self,
8927 node: DocumentType,
8928 __ast_path: &mut AstKindPath,
8929 ) -> DocumentType {
8930 match self {
8931 swc_visit::Either::Left(visitor) => {
8932 FoldAstPath::fold_document_type(visitor, node, __ast_path)
8933 }
8934 swc_visit::Either::Right(visitor) => {
8935 FoldAstPath::fold_document_type(visitor, node, __ast_path)
8936 }
8937 }
8938 }
8939
8940 #[inline]
8941 fn fold_element(&mut self, node: Element, __ast_path: &mut AstKindPath) -> Element {
8942 match self {
8943 swc_visit::Either::Left(visitor) => {
8944 FoldAstPath::fold_element(visitor, node, __ast_path)
8945 }
8946 swc_visit::Either::Right(visitor) => {
8947 FoldAstPath::fold_element(visitor, node, __ast_path)
8948 }
8949 }
8950 }
8951
8952 #[inline]
8953 fn fold_namespace(&mut self, node: Namespace, __ast_path: &mut AstKindPath) -> Namespace {
8954 match self {
8955 swc_visit::Either::Left(visitor) => {
8956 FoldAstPath::fold_namespace(visitor, node, __ast_path)
8957 }
8958 swc_visit::Either::Right(visitor) => {
8959 FoldAstPath::fold_namespace(visitor, node, __ast_path)
8960 }
8961 }
8962 }
8963
8964 #[inline]
8965 fn fold_opt_atom(
8966 &mut self,
8967 node: Option<swc_atoms::Atom>,
8968 __ast_path: &mut AstKindPath,
8969 ) -> Option<swc_atoms::Atom> {
8970 match self {
8971 swc_visit::Either::Left(visitor) => {
8972 FoldAstPath::fold_opt_atom(visitor, node, __ast_path)
8973 }
8974 swc_visit::Either::Right(visitor) => {
8975 FoldAstPath::fold_opt_atom(visitor, node, __ast_path)
8976 }
8977 }
8978 }
8979
8980 #[inline]
8981 fn fold_opt_namespace(
8982 &mut self,
8983 node: Option<Namespace>,
8984 __ast_path: &mut AstKindPath,
8985 ) -> Option<Namespace> {
8986 match self {
8987 swc_visit::Either::Left(visitor) => {
8988 FoldAstPath::fold_opt_namespace(visitor, node, __ast_path)
8989 }
8990 swc_visit::Either::Right(visitor) => {
8991 FoldAstPath::fold_opt_namespace(visitor, node, __ast_path)
8992 }
8993 }
8994 }
8995
8996 #[inline]
8997 fn fold_processing_instruction(
8998 &mut self,
8999 node: ProcessingInstruction,
9000 __ast_path: &mut AstKindPath,
9001 ) -> ProcessingInstruction {
9002 match self {
9003 swc_visit::Either::Left(visitor) => {
9004 FoldAstPath::fold_processing_instruction(visitor, node, __ast_path)
9005 }
9006 swc_visit::Either::Right(visitor) => {
9007 FoldAstPath::fold_processing_instruction(visitor, node, __ast_path)
9008 }
9009 }
9010 }
9011
9012 #[inline]
9013 fn fold_span(
9014 &mut self,
9015 node: swc_common::Span,
9016 __ast_path: &mut AstKindPath,
9017 ) -> swc_common::Span {
9018 match self {
9019 swc_visit::Either::Left(visitor) => FoldAstPath::fold_span(visitor, node, __ast_path),
9020 swc_visit::Either::Right(visitor) => FoldAstPath::fold_span(visitor, node, __ast_path),
9021 }
9022 }
9023
9024 #[inline]
9025 fn fold_text(&mut self, node: Text, __ast_path: &mut AstKindPath) -> Text {
9026 match self {
9027 swc_visit::Either::Left(visitor) => FoldAstPath::fold_text(visitor, node, __ast_path),
9028 swc_visit::Either::Right(visitor) => FoldAstPath::fold_text(visitor, node, __ast_path),
9029 }
9030 }
9031
9032 #[inline]
9033 fn fold_token(&mut self, node: Token, __ast_path: &mut AstKindPath) -> Token {
9034 match self {
9035 swc_visit::Either::Left(visitor) => FoldAstPath::fold_token(visitor, node, __ast_path),
9036 swc_visit::Either::Right(visitor) => FoldAstPath::fold_token(visitor, node, __ast_path),
9037 }
9038 }
9039
9040 #[inline]
9041 fn fold_token_and_span(
9042 &mut self,
9043 node: TokenAndSpan,
9044 __ast_path: &mut AstKindPath,
9045 ) -> TokenAndSpan {
9046 match self {
9047 swc_visit::Either::Left(visitor) => {
9048 FoldAstPath::fold_token_and_span(visitor, node, __ast_path)
9049 }
9050 swc_visit::Either::Right(visitor) => {
9051 FoldAstPath::fold_token_and_span(visitor, node, __ast_path)
9052 }
9053 }
9054 }
9055}
9056#[cfg(any(docsrs, feature = "path"))]
9057#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9058impl<V> FoldAstPath for ::swc_visit::Optional<V>
9059where
9060 V: FoldAstPath,
9061{
9062 #[inline]
9063 fn fold_atom(
9064 &mut self,
9065 node: swc_atoms::Atom,
9066 __ast_path: &mut AstKindPath,
9067 ) -> swc_atoms::Atom {
9068 if self.enabled {
9069 <V as FoldAstPath>::fold_atom(&mut self.visitor, node, __ast_path)
9070 } else {
9071 node
9072 }
9073 }
9074
9075 #[inline]
9076 fn fold_attribute(&mut self, node: Attribute, __ast_path: &mut AstKindPath) -> Attribute {
9077 if self.enabled {
9078 <V as FoldAstPath>::fold_attribute(&mut self.visitor, node, __ast_path)
9079 } else {
9080 node
9081 }
9082 }
9083
9084 #[inline]
9085 fn fold_attribute_token(
9086 &mut self,
9087 node: AttributeToken,
9088 __ast_path: &mut AstKindPath,
9089 ) -> AttributeToken {
9090 if self.enabled {
9091 <V as FoldAstPath>::fold_attribute_token(&mut self.visitor, node, __ast_path)
9092 } else {
9093 node
9094 }
9095 }
9096
9097 #[inline]
9098 fn fold_attribute_tokens(
9099 &mut self,
9100 node: Vec<AttributeToken>,
9101 __ast_path: &mut AstKindPath,
9102 ) -> Vec<AttributeToken> {
9103 if self.enabled {
9104 <V as FoldAstPath>::fold_attribute_tokens(&mut self.visitor, node, __ast_path)
9105 } else {
9106 node
9107 }
9108 }
9109
9110 #[inline]
9111 fn fold_attributes(
9112 &mut self,
9113 node: Vec<Attribute>,
9114 __ast_path: &mut AstKindPath,
9115 ) -> Vec<Attribute> {
9116 if self.enabled {
9117 <V as FoldAstPath>::fold_attributes(&mut self.visitor, node, __ast_path)
9118 } else {
9119 node
9120 }
9121 }
9122
9123 #[inline]
9124 fn fold_cdata_section(
9125 &mut self,
9126 node: CdataSection,
9127 __ast_path: &mut AstKindPath,
9128 ) -> CdataSection {
9129 if self.enabled {
9130 <V as FoldAstPath>::fold_cdata_section(&mut self.visitor, node, __ast_path)
9131 } else {
9132 node
9133 }
9134 }
9135
9136 #[inline]
9137 fn fold_child(&mut self, node: Child, __ast_path: &mut AstKindPath) -> Child {
9138 if self.enabled {
9139 <V as FoldAstPath>::fold_child(&mut self.visitor, node, __ast_path)
9140 } else {
9141 node
9142 }
9143 }
9144
9145 #[inline]
9146 fn fold_childs(&mut self, node: Vec<Child>, __ast_path: &mut AstKindPath) -> Vec<Child> {
9147 if self.enabled {
9148 <V as FoldAstPath>::fold_childs(&mut self.visitor, node, __ast_path)
9149 } else {
9150 node
9151 }
9152 }
9153
9154 #[inline]
9155 fn fold_comment(&mut self, node: Comment, __ast_path: &mut AstKindPath) -> Comment {
9156 if self.enabled {
9157 <V as FoldAstPath>::fold_comment(&mut self.visitor, node, __ast_path)
9158 } else {
9159 node
9160 }
9161 }
9162
9163 #[inline]
9164 fn fold_document(&mut self, node: Document, __ast_path: &mut AstKindPath) -> Document {
9165 if self.enabled {
9166 <V as FoldAstPath>::fold_document(&mut self.visitor, node, __ast_path)
9167 } else {
9168 node
9169 }
9170 }
9171
9172 #[inline]
9173 fn fold_document_mode(
9174 &mut self,
9175 node: DocumentMode,
9176 __ast_path: &mut AstKindPath,
9177 ) -> DocumentMode {
9178 if self.enabled {
9179 <V as FoldAstPath>::fold_document_mode(&mut self.visitor, node, __ast_path)
9180 } else {
9181 node
9182 }
9183 }
9184
9185 #[inline]
9186 fn fold_document_type(
9187 &mut self,
9188 node: DocumentType,
9189 __ast_path: &mut AstKindPath,
9190 ) -> DocumentType {
9191 if self.enabled {
9192 <V as FoldAstPath>::fold_document_type(&mut self.visitor, node, __ast_path)
9193 } else {
9194 node
9195 }
9196 }
9197
9198 #[inline]
9199 fn fold_element(&mut self, node: Element, __ast_path: &mut AstKindPath) -> Element {
9200 if self.enabled {
9201 <V as FoldAstPath>::fold_element(&mut self.visitor, node, __ast_path)
9202 } else {
9203 node
9204 }
9205 }
9206
9207 #[inline]
9208 fn fold_namespace(&mut self, node: Namespace, __ast_path: &mut AstKindPath) -> Namespace {
9209 if self.enabled {
9210 <V as FoldAstPath>::fold_namespace(&mut self.visitor, node, __ast_path)
9211 } else {
9212 node
9213 }
9214 }
9215
9216 #[inline]
9217 fn fold_opt_atom(
9218 &mut self,
9219 node: Option<swc_atoms::Atom>,
9220 __ast_path: &mut AstKindPath,
9221 ) -> Option<swc_atoms::Atom> {
9222 if self.enabled {
9223 <V as FoldAstPath>::fold_opt_atom(&mut self.visitor, node, __ast_path)
9224 } else {
9225 node
9226 }
9227 }
9228
9229 #[inline]
9230 fn fold_opt_namespace(
9231 &mut self,
9232 node: Option<Namespace>,
9233 __ast_path: &mut AstKindPath,
9234 ) -> Option<Namespace> {
9235 if self.enabled {
9236 <V as FoldAstPath>::fold_opt_namespace(&mut self.visitor, node, __ast_path)
9237 } else {
9238 node
9239 }
9240 }
9241
9242 #[inline]
9243 fn fold_processing_instruction(
9244 &mut self,
9245 node: ProcessingInstruction,
9246 __ast_path: &mut AstKindPath,
9247 ) -> ProcessingInstruction {
9248 if self.enabled {
9249 <V as FoldAstPath>::fold_processing_instruction(&mut self.visitor, node, __ast_path)
9250 } else {
9251 node
9252 }
9253 }
9254
9255 #[inline]
9256 fn fold_span(
9257 &mut self,
9258 node: swc_common::Span,
9259 __ast_path: &mut AstKindPath,
9260 ) -> swc_common::Span {
9261 if self.enabled {
9262 <V as FoldAstPath>::fold_span(&mut self.visitor, node, __ast_path)
9263 } else {
9264 node
9265 }
9266 }
9267
9268 #[inline]
9269 fn fold_text(&mut self, node: Text, __ast_path: &mut AstKindPath) -> Text {
9270 if self.enabled {
9271 <V as FoldAstPath>::fold_text(&mut self.visitor, node, __ast_path)
9272 } else {
9273 node
9274 }
9275 }
9276
9277 #[inline]
9278 fn fold_token(&mut self, node: Token, __ast_path: &mut AstKindPath) -> Token {
9279 if self.enabled {
9280 <V as FoldAstPath>::fold_token(&mut self.visitor, node, __ast_path)
9281 } else {
9282 node
9283 }
9284 }
9285
9286 #[inline]
9287 fn fold_token_and_span(
9288 &mut self,
9289 node: TokenAndSpan,
9290 __ast_path: &mut AstKindPath,
9291 ) -> TokenAndSpan {
9292 if self.enabled {
9293 <V as FoldAstPath>::fold_token_and_span(&mut self.visitor, node, __ast_path)
9294 } else {
9295 node
9296 }
9297 }
9298}
9299#[doc = r" A trait implemented for types that can be visited using a visitor."]
9300#[cfg(any(docsrs, feature = "path"))]
9301#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9302pub trait FoldWithAstPath<V: ?Sized + FoldAstPath> {
9303 #[doc = r" Calls a visitor method (visitor.fold_xxx) with self."]
9304 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self;
9305 #[doc = r" Visit children nodes of `self`` with `visitor`."]
9306 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self;
9307}
9308#[cfg(any(docsrs, feature = "path"))]
9309#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9310impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for Attribute {
9311 #[doc = "Calls [FoldAstPath`::fold_attribute`] with `self`."]
9312 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9313 <V as FoldAstPath>::fold_attribute(visitor, self, __ast_path)
9314 }
9315
9316 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9317 match self {
9318 Attribute {
9319 span,
9320 namespace,
9321 prefix,
9322 name,
9323 raw_name,
9324 value,
9325 raw_value,
9326 } => {
9327 let span = {
9328 let mut __ast_path = __ast_path
9329 .with_guard(AstParentKind::Attribute(self::fields::AttributeField::Span));
9330 <swc_common::Span as FoldWithAstPath<V>>::fold_with_ast_path(
9331 span,
9332 visitor,
9333 &mut *__ast_path,
9334 )
9335 };
9336 let namespace = {
9337 let mut __ast_path = __ast_path.with_guard(AstParentKind::Attribute(
9338 self::fields::AttributeField::Namespace,
9339 ));
9340 <Option<Namespace> as FoldWithAstPath<V>>::fold_with_ast_path(
9341 namespace,
9342 visitor,
9343 &mut *__ast_path,
9344 )
9345 };
9346 let prefix = {
9347 let mut __ast_path = __ast_path.with_guard(AstParentKind::Attribute(
9348 self::fields::AttributeField::Prefix,
9349 ));
9350 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9351 prefix,
9352 visitor,
9353 &mut *__ast_path,
9354 )
9355 };
9356 let name = {
9357 let mut __ast_path = __ast_path
9358 .with_guard(AstParentKind::Attribute(self::fields::AttributeField::Name));
9359 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
9360 name,
9361 visitor,
9362 &mut *__ast_path,
9363 )
9364 };
9365 let raw_name = {
9366 let mut __ast_path = __ast_path.with_guard(AstParentKind::Attribute(
9367 self::fields::AttributeField::RawName,
9368 ));
9369 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9370 raw_name,
9371 visitor,
9372 &mut *__ast_path,
9373 )
9374 };
9375 let value = {
9376 let mut __ast_path = __ast_path.with_guard(AstParentKind::Attribute(
9377 self::fields::AttributeField::Value,
9378 ));
9379 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9380 value,
9381 visitor,
9382 &mut *__ast_path,
9383 )
9384 };
9385 let raw_value = {
9386 let mut __ast_path = __ast_path.with_guard(AstParentKind::Attribute(
9387 self::fields::AttributeField::RawValue,
9388 ));
9389 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9390 raw_value,
9391 visitor,
9392 &mut *__ast_path,
9393 )
9394 };
9395 Attribute {
9396 span,
9397 namespace,
9398 prefix,
9399 name,
9400 raw_name,
9401 value,
9402 raw_value,
9403 }
9404 }
9405 }
9406 }
9407}
9408#[cfg(any(docsrs, feature = "path"))]
9409#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9410impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for AttributeToken {
9411 #[doc = "Calls [FoldAstPath`::fold_attribute_token`] with `self`."]
9412 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9413 <V as FoldAstPath>::fold_attribute_token(visitor, self, __ast_path)
9414 }
9415
9416 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9417 match self {
9418 AttributeToken {
9419 span,
9420 name,
9421 raw_name,
9422 value,
9423 raw_value,
9424 } => {
9425 let span = {
9426 let mut __ast_path = __ast_path.with_guard(AstParentKind::AttributeToken(
9427 self::fields::AttributeTokenField::Span,
9428 ));
9429 <swc_common::Span as FoldWithAstPath<V>>::fold_with_ast_path(
9430 span,
9431 visitor,
9432 &mut *__ast_path,
9433 )
9434 };
9435 let name = {
9436 let mut __ast_path = __ast_path.with_guard(AstParentKind::AttributeToken(
9437 self::fields::AttributeTokenField::Name,
9438 ));
9439 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
9440 name,
9441 visitor,
9442 &mut *__ast_path,
9443 )
9444 };
9445 let raw_name = {
9446 let mut __ast_path = __ast_path.with_guard(AstParentKind::AttributeToken(
9447 self::fields::AttributeTokenField::RawName,
9448 ));
9449 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9450 raw_name,
9451 visitor,
9452 &mut *__ast_path,
9453 )
9454 };
9455 let value = {
9456 let mut __ast_path = __ast_path.with_guard(AstParentKind::AttributeToken(
9457 self::fields::AttributeTokenField::Value,
9458 ));
9459 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9460 value,
9461 visitor,
9462 &mut *__ast_path,
9463 )
9464 };
9465 let raw_value = {
9466 let mut __ast_path = __ast_path.with_guard(AstParentKind::AttributeToken(
9467 self::fields::AttributeTokenField::RawValue,
9468 ));
9469 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9470 raw_value,
9471 visitor,
9472 &mut *__ast_path,
9473 )
9474 };
9475 AttributeToken {
9476 span,
9477 name,
9478 raw_name,
9479 value,
9480 raw_value,
9481 }
9482 }
9483 }
9484 }
9485}
9486#[cfg(any(docsrs, feature = "path"))]
9487#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9488impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for CdataSection {
9489 #[doc = "Calls [FoldAstPath`::fold_cdata_section`] with `self`."]
9490 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9491 <V as FoldAstPath>::fold_cdata_section(visitor, self, __ast_path)
9492 }
9493
9494 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9495 match self {
9496 CdataSection { span, data, raw } => {
9497 let span = {
9498 let mut __ast_path = __ast_path.with_guard(AstParentKind::CdataSection(
9499 self::fields::CdataSectionField::Span,
9500 ));
9501 <swc_common::Span as FoldWithAstPath<V>>::fold_with_ast_path(
9502 span,
9503 visitor,
9504 &mut *__ast_path,
9505 )
9506 };
9507 let data = {
9508 let mut __ast_path = __ast_path.with_guard(AstParentKind::CdataSection(
9509 self::fields::CdataSectionField::Data,
9510 ));
9511 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
9512 data,
9513 visitor,
9514 &mut *__ast_path,
9515 )
9516 };
9517 let raw = {
9518 let mut __ast_path = __ast_path.with_guard(AstParentKind::CdataSection(
9519 self::fields::CdataSectionField::Raw,
9520 ));
9521 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9522 raw,
9523 visitor,
9524 &mut *__ast_path,
9525 )
9526 };
9527 CdataSection { span, data, raw }
9528 }
9529 }
9530 }
9531}
9532#[cfg(any(docsrs, feature = "path"))]
9533#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9534impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for Child {
9535 #[doc = "Calls [FoldAstPath`::fold_child`] with `self`."]
9536 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9537 <V as FoldAstPath>::fold_child(visitor, self, __ast_path)
9538 }
9539
9540 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9541 match self {
9542 Child::DocumentType { 0: _field_0 } => {
9543 let mut __ast_path = __ast_path
9544 .with_guard(AstParentKind::Child(self::fields::ChildField::DocumentType));
9545 let _field_0 = <DocumentType as FoldWithAstPath<V>>::fold_with_ast_path(
9546 _field_0,
9547 visitor,
9548 &mut *__ast_path,
9549 );
9550 Child::DocumentType { 0: _field_0 }
9551 }
9552 Child::Element { 0: _field_0 } => {
9553 let mut __ast_path =
9554 __ast_path.with_guard(AstParentKind::Child(self::fields::ChildField::Element));
9555 let _field_0 = <Element as FoldWithAstPath<V>>::fold_with_ast_path(
9556 _field_0,
9557 visitor,
9558 &mut *__ast_path,
9559 );
9560 Child::Element { 0: _field_0 }
9561 }
9562 Child::Text { 0: _field_0 } => {
9563 let mut __ast_path =
9564 __ast_path.with_guard(AstParentKind::Child(self::fields::ChildField::Text));
9565 let _field_0 = <Text as FoldWithAstPath<V>>::fold_with_ast_path(
9566 _field_0,
9567 visitor,
9568 &mut *__ast_path,
9569 );
9570 Child::Text { 0: _field_0 }
9571 }
9572 Child::CdataSection { 0: _field_0 } => {
9573 let mut __ast_path = __ast_path
9574 .with_guard(AstParentKind::Child(self::fields::ChildField::CdataSection));
9575 let _field_0 = <CdataSection as FoldWithAstPath<V>>::fold_with_ast_path(
9576 _field_0,
9577 visitor,
9578 &mut *__ast_path,
9579 );
9580 Child::CdataSection { 0: _field_0 }
9581 }
9582 Child::Comment { 0: _field_0 } => {
9583 let mut __ast_path =
9584 __ast_path.with_guard(AstParentKind::Child(self::fields::ChildField::Comment));
9585 let _field_0 = <Comment as FoldWithAstPath<V>>::fold_with_ast_path(
9586 _field_0,
9587 visitor,
9588 &mut *__ast_path,
9589 );
9590 Child::Comment { 0: _field_0 }
9591 }
9592 Child::ProcessingInstruction { 0: _field_0 } => {
9593 let mut __ast_path = __ast_path.with_guard(AstParentKind::Child(
9594 self::fields::ChildField::ProcessingInstruction,
9595 ));
9596 let _field_0 = <ProcessingInstruction as FoldWithAstPath<V>>::fold_with_ast_path(
9597 _field_0,
9598 visitor,
9599 &mut *__ast_path,
9600 );
9601 Child::ProcessingInstruction { 0: _field_0 }
9602 }
9603 }
9604 }
9605}
9606#[cfg(any(docsrs, feature = "path"))]
9607#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9608impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for Comment {
9609 #[doc = "Calls [FoldAstPath`::fold_comment`] with `self`."]
9610 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9611 <V as FoldAstPath>::fold_comment(visitor, self, __ast_path)
9612 }
9613
9614 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9615 match self {
9616 Comment { span, data, raw } => {
9617 let span = {
9618 let mut __ast_path = __ast_path
9619 .with_guard(AstParentKind::Comment(self::fields::CommentField::Span));
9620 <swc_common::Span as FoldWithAstPath<V>>::fold_with_ast_path(
9621 span,
9622 visitor,
9623 &mut *__ast_path,
9624 )
9625 };
9626 let data = {
9627 let mut __ast_path = __ast_path
9628 .with_guard(AstParentKind::Comment(self::fields::CommentField::Data));
9629 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
9630 data,
9631 visitor,
9632 &mut *__ast_path,
9633 )
9634 };
9635 let raw = {
9636 let mut __ast_path = __ast_path
9637 .with_guard(AstParentKind::Comment(self::fields::CommentField::Raw));
9638 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9639 raw,
9640 visitor,
9641 &mut *__ast_path,
9642 )
9643 };
9644 Comment { span, data, raw }
9645 }
9646 }
9647 }
9648}
9649#[cfg(any(docsrs, feature = "path"))]
9650#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9651impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for Document {
9652 #[doc = "Calls [FoldAstPath`::fold_document`] with `self`."]
9653 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9654 <V as FoldAstPath>::fold_document(visitor, self, __ast_path)
9655 }
9656
9657 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9658 match self {
9659 Document { span, children } => {
9660 let span = {
9661 let mut __ast_path = __ast_path
9662 .with_guard(AstParentKind::Document(self::fields::DocumentField::Span));
9663 <swc_common::Span as FoldWithAstPath<V>>::fold_with_ast_path(
9664 span,
9665 visitor,
9666 &mut *__ast_path,
9667 )
9668 };
9669 let children = {
9670 let mut __ast_path = __ast_path.with_guard(AstParentKind::Document(
9671 self::fields::DocumentField::Children(usize::MAX),
9672 ));
9673 <Vec<Child> as FoldWithAstPath<V>>::fold_with_ast_path(
9674 children,
9675 visitor,
9676 &mut *__ast_path,
9677 )
9678 };
9679 Document { span, children }
9680 }
9681 }
9682 }
9683}
9684#[cfg(any(docsrs, feature = "path"))]
9685#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9686impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for DocumentMode {
9687 #[doc = "Calls [FoldAstPath`::fold_document_mode`] with `self`."]
9688 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9689 <V as FoldAstPath>::fold_document_mode(visitor, self, __ast_path)
9690 }
9691
9692 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9693 match self {
9694 DocumentMode::NoQuirks => DocumentMode::NoQuirks,
9695 DocumentMode::LimitedQuirks => DocumentMode::LimitedQuirks,
9696 DocumentMode::Quirks => DocumentMode::Quirks,
9697 }
9698 }
9699}
9700#[cfg(any(docsrs, feature = "path"))]
9701#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9702impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for DocumentType {
9703 #[doc = "Calls [FoldAstPath`::fold_document_type`] with `self`."]
9704 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9705 <V as FoldAstPath>::fold_document_type(visitor, self, __ast_path)
9706 }
9707
9708 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9709 match self {
9710 DocumentType {
9711 span,
9712 name,
9713 public_id,
9714 system_id,
9715 raw,
9716 } => {
9717 let span = {
9718 let mut __ast_path = __ast_path.with_guard(AstParentKind::DocumentType(
9719 self::fields::DocumentTypeField::Span,
9720 ));
9721 <swc_common::Span as FoldWithAstPath<V>>::fold_with_ast_path(
9722 span,
9723 visitor,
9724 &mut *__ast_path,
9725 )
9726 };
9727 let name = {
9728 let mut __ast_path = __ast_path.with_guard(AstParentKind::DocumentType(
9729 self::fields::DocumentTypeField::Name,
9730 ));
9731 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9732 name,
9733 visitor,
9734 &mut *__ast_path,
9735 )
9736 };
9737 let public_id = {
9738 let mut __ast_path = __ast_path.with_guard(AstParentKind::DocumentType(
9739 self::fields::DocumentTypeField::PublicId,
9740 ));
9741 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9742 public_id,
9743 visitor,
9744 &mut *__ast_path,
9745 )
9746 };
9747 let system_id = {
9748 let mut __ast_path = __ast_path.with_guard(AstParentKind::DocumentType(
9749 self::fields::DocumentTypeField::SystemId,
9750 ));
9751 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9752 system_id,
9753 visitor,
9754 &mut *__ast_path,
9755 )
9756 };
9757 let raw = {
9758 let mut __ast_path = __ast_path.with_guard(AstParentKind::DocumentType(
9759 self::fields::DocumentTypeField::Raw,
9760 ));
9761 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9762 raw,
9763 visitor,
9764 &mut *__ast_path,
9765 )
9766 };
9767 DocumentType {
9768 span,
9769 name,
9770 public_id,
9771 system_id,
9772 raw,
9773 }
9774 }
9775 }
9776 }
9777}
9778#[cfg(any(docsrs, feature = "path"))]
9779#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9780impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for Element {
9781 #[doc = "Calls [FoldAstPath`::fold_element`] with `self`."]
9782 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9783 <V as FoldAstPath>::fold_element(visitor, self, __ast_path)
9784 }
9785
9786 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9787 match self {
9788 Element {
9789 span,
9790 tag_name,
9791 attributes,
9792 children,
9793 } => {
9794 let span = {
9795 let mut __ast_path = __ast_path
9796 .with_guard(AstParentKind::Element(self::fields::ElementField::Span));
9797 <swc_common::Span as FoldWithAstPath<V>>::fold_with_ast_path(
9798 span,
9799 visitor,
9800 &mut *__ast_path,
9801 )
9802 };
9803 let tag_name = {
9804 let mut __ast_path = __ast_path
9805 .with_guard(AstParentKind::Element(self::fields::ElementField::TagName));
9806 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
9807 tag_name,
9808 visitor,
9809 &mut *__ast_path,
9810 )
9811 };
9812 let attributes = {
9813 let mut __ast_path = __ast_path.with_guard(AstParentKind::Element(
9814 self::fields::ElementField::Attributes(usize::MAX),
9815 ));
9816 <Vec<Attribute> as FoldWithAstPath<V>>::fold_with_ast_path(
9817 attributes,
9818 visitor,
9819 &mut *__ast_path,
9820 )
9821 };
9822 let children = {
9823 let mut __ast_path = __ast_path.with_guard(AstParentKind::Element(
9824 self::fields::ElementField::Children(usize::MAX),
9825 ));
9826 <Vec<Child> as FoldWithAstPath<V>>::fold_with_ast_path(
9827 children,
9828 visitor,
9829 &mut *__ast_path,
9830 )
9831 };
9832 Element {
9833 span,
9834 tag_name,
9835 attributes,
9836 children,
9837 }
9838 }
9839 }
9840 }
9841}
9842#[cfg(any(docsrs, feature = "path"))]
9843#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9844impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for Namespace {
9845 #[doc = "Calls [FoldAstPath`::fold_namespace`] with `self`."]
9846 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9847 <V as FoldAstPath>::fold_namespace(visitor, self, __ast_path)
9848 }
9849
9850 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9851 match self {
9852 Namespace::HTML => Namespace::HTML,
9853 Namespace::MATHML => Namespace::MATHML,
9854 Namespace::SVG => Namespace::SVG,
9855 Namespace::XLINK => Namespace::XLINK,
9856 Namespace::XML => Namespace::XML,
9857 Namespace::XMLNS => Namespace::XMLNS,
9858 }
9859 }
9860}
9861#[cfg(any(docsrs, feature = "path"))]
9862#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9863impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for ProcessingInstruction {
9864 #[doc = "Calls [FoldAstPath`::fold_processing_instruction`] with `self`."]
9865 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9866 <V as FoldAstPath>::fold_processing_instruction(visitor, self, __ast_path)
9867 }
9868
9869 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9870 match self {
9871 ProcessingInstruction { span, target, data } => {
9872 let span = {
9873 let mut __ast_path =
9874 __ast_path.with_guard(AstParentKind::ProcessingInstruction(
9875 self::fields::ProcessingInstructionField::Span,
9876 ));
9877 <swc_common::Span as FoldWithAstPath<V>>::fold_with_ast_path(
9878 span,
9879 visitor,
9880 &mut *__ast_path,
9881 )
9882 };
9883 let target = {
9884 let mut __ast_path =
9885 __ast_path.with_guard(AstParentKind::ProcessingInstruction(
9886 self::fields::ProcessingInstructionField::Target,
9887 ));
9888 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
9889 target,
9890 visitor,
9891 &mut *__ast_path,
9892 )
9893 };
9894 let data = {
9895 let mut __ast_path =
9896 __ast_path.with_guard(AstParentKind::ProcessingInstruction(
9897 self::fields::ProcessingInstructionField::Data,
9898 ));
9899 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
9900 data,
9901 visitor,
9902 &mut *__ast_path,
9903 )
9904 };
9905 ProcessingInstruction { span, target, data }
9906 }
9907 }
9908 }
9909}
9910#[cfg(any(docsrs, feature = "path"))]
9911#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9912impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for Text {
9913 #[doc = "Calls [FoldAstPath`::fold_text`] with `self`."]
9914 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9915 <V as FoldAstPath>::fold_text(visitor, self, __ast_path)
9916 }
9917
9918 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9919 match self {
9920 Text { span, data, raw } => {
9921 let span = {
9922 let mut __ast_path =
9923 __ast_path.with_guard(AstParentKind::Text(self::fields::TextField::Span));
9924 <swc_common::Span as FoldWithAstPath<V>>::fold_with_ast_path(
9925 span,
9926 visitor,
9927 &mut *__ast_path,
9928 )
9929 };
9930 let data = {
9931 let mut __ast_path =
9932 __ast_path.with_guard(AstParentKind::Text(self::fields::TextField::Data));
9933 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
9934 data,
9935 visitor,
9936 &mut *__ast_path,
9937 )
9938 };
9939 let raw = {
9940 let mut __ast_path =
9941 __ast_path.with_guard(AstParentKind::Text(self::fields::TextField::Raw));
9942 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9943 raw,
9944 visitor,
9945 &mut *__ast_path,
9946 )
9947 };
9948 Text { span, data, raw }
9949 }
9950 }
9951 }
9952}
9953#[cfg(any(docsrs, feature = "path"))]
9954#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
9955impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for Token {
9956 #[doc = "Calls [FoldAstPath`::fold_token`] with `self`."]
9957 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9958 <V as FoldAstPath>::fold_token(visitor, self, __ast_path)
9959 }
9960
9961 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
9962 match self {
9963 Token::Doctype {
9964 name,
9965 public_id,
9966 system_id,
9967 raw,
9968 } => {
9969 let mut __ast_path =
9970 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Doctype));
9971 let name = {
9972 let mut __ast_path =
9973 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Name));
9974 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9975 name,
9976 visitor,
9977 &mut *__ast_path,
9978 )
9979 };
9980 let public_id = {
9981 let mut __ast_path = __ast_path
9982 .with_guard(AstParentKind::Token(self::fields::TokenField::PublicId));
9983 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9984 public_id,
9985 visitor,
9986 &mut *__ast_path,
9987 )
9988 };
9989 let system_id = {
9990 let mut __ast_path = __ast_path
9991 .with_guard(AstParentKind::Token(self::fields::TokenField::SystemId));
9992 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
9993 system_id,
9994 visitor,
9995 &mut *__ast_path,
9996 )
9997 };
9998 let raw = {
9999 let mut __ast_path =
10000 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Raw));
10001 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
10002 raw,
10003 visitor,
10004 &mut *__ast_path,
10005 )
10006 };
10007 Token::Doctype {
10008 name,
10009 public_id,
10010 system_id,
10011 raw,
10012 }
10013 }
10014 Token::StartTag {
10015 tag_name,
10016 attributes,
10017 } => {
10018 let mut __ast_path =
10019 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::StartTag));
10020 let tag_name = {
10021 let mut __ast_path = __ast_path
10022 .with_guard(AstParentKind::Token(self::fields::TokenField::TagName));
10023 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
10024 tag_name,
10025 visitor,
10026 &mut *__ast_path,
10027 )
10028 };
10029 let attributes = {
10030 let mut __ast_path = __ast_path.with_guard(AstParentKind::Token(
10031 self::fields::TokenField::Attributes(usize::MAX),
10032 ));
10033 <Vec<AttributeToken> as FoldWithAstPath<V>>::fold_with_ast_path(
10034 attributes,
10035 visitor,
10036 &mut *__ast_path,
10037 )
10038 };
10039 Token::StartTag {
10040 tag_name,
10041 attributes,
10042 }
10043 }
10044 Token::EndTag {
10045 tag_name,
10046 attributes,
10047 } => {
10048 let mut __ast_path =
10049 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::EndTag));
10050 let tag_name = {
10051 let mut __ast_path = __ast_path
10052 .with_guard(AstParentKind::Token(self::fields::TokenField::TagName));
10053 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
10054 tag_name,
10055 visitor,
10056 &mut *__ast_path,
10057 )
10058 };
10059 let attributes = {
10060 let mut __ast_path = __ast_path.with_guard(AstParentKind::Token(
10061 self::fields::TokenField::Attributes(usize::MAX),
10062 ));
10063 <Vec<AttributeToken> as FoldWithAstPath<V>>::fold_with_ast_path(
10064 attributes,
10065 visitor,
10066 &mut *__ast_path,
10067 )
10068 };
10069 Token::EndTag {
10070 tag_name,
10071 attributes,
10072 }
10073 }
10074 Token::EmptyTag {
10075 tag_name,
10076 attributes,
10077 } => {
10078 let mut __ast_path =
10079 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::EmptyTag));
10080 let tag_name = {
10081 let mut __ast_path = __ast_path
10082 .with_guard(AstParentKind::Token(self::fields::TokenField::TagName));
10083 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
10084 tag_name,
10085 visitor,
10086 &mut *__ast_path,
10087 )
10088 };
10089 let attributes = {
10090 let mut __ast_path = __ast_path.with_guard(AstParentKind::Token(
10091 self::fields::TokenField::Attributes(usize::MAX),
10092 ));
10093 <Vec<AttributeToken> as FoldWithAstPath<V>>::fold_with_ast_path(
10094 attributes,
10095 visitor,
10096 &mut *__ast_path,
10097 )
10098 };
10099 Token::EmptyTag {
10100 tag_name,
10101 attributes,
10102 }
10103 }
10104 Token::Comment { data, raw } => {
10105 let mut __ast_path =
10106 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Comment));
10107 let data = {
10108 let mut __ast_path =
10109 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Data));
10110 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
10111 data,
10112 visitor,
10113 &mut *__ast_path,
10114 )
10115 };
10116 let raw = {
10117 let mut __ast_path =
10118 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Raw));
10119 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
10120 raw,
10121 visitor,
10122 &mut *__ast_path,
10123 )
10124 };
10125 Token::Comment { data, raw }
10126 }
10127 Token::Character { value, raw } => {
10128 let mut __ast_path = __ast_path
10129 .with_guard(AstParentKind::Token(self::fields::TokenField::Character));
10130 let raw = {
10131 let mut __ast_path =
10132 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Raw));
10133 <Option<swc_atoms::Atom> as FoldWithAstPath<V>>::fold_with_ast_path(
10134 raw,
10135 visitor,
10136 &mut *__ast_path,
10137 )
10138 };
10139 Token::Character { value, raw }
10140 }
10141 Token::ProcessingInstruction { target, data } => {
10142 let mut __ast_path = __ast_path.with_guard(AstParentKind::Token(
10143 self::fields::TokenField::ProcessingInstruction,
10144 ));
10145 let target = {
10146 let mut __ast_path = __ast_path
10147 .with_guard(AstParentKind::Token(self::fields::TokenField::Target));
10148 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
10149 target,
10150 visitor,
10151 &mut *__ast_path,
10152 )
10153 };
10154 let data = {
10155 let mut __ast_path =
10156 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Data));
10157 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
10158 data,
10159 visitor,
10160 &mut *__ast_path,
10161 )
10162 };
10163 Token::ProcessingInstruction { target, data }
10164 }
10165 Token::Cdata { data, raw } => {
10166 let mut __ast_path =
10167 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Cdata));
10168 let data = {
10169 let mut __ast_path =
10170 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Data));
10171 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
10172 data,
10173 visitor,
10174 &mut *__ast_path,
10175 )
10176 };
10177 let raw = {
10178 let mut __ast_path =
10179 __ast_path.with_guard(AstParentKind::Token(self::fields::TokenField::Raw));
10180 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(
10181 raw,
10182 visitor,
10183 &mut *__ast_path,
10184 )
10185 };
10186 Token::Cdata { data, raw }
10187 }
10188 Token::Eof => Token::Eof,
10189 }
10190 }
10191}
10192#[cfg(any(docsrs, feature = "path"))]
10193#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
10194impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for TokenAndSpan {
10195 #[doc = "Calls [FoldAstPath`::fold_token_and_span`] with `self`."]
10196 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10197 <V as FoldAstPath>::fold_token_and_span(visitor, self, __ast_path)
10198 }
10199
10200 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10201 match self {
10202 TokenAndSpan { span, token } => {
10203 let span = {
10204 let mut __ast_path = __ast_path.with_guard(AstParentKind::TokenAndSpan(
10205 self::fields::TokenAndSpanField::Span,
10206 ));
10207 <swc_common::Span as FoldWithAstPath<V>>::fold_with_ast_path(
10208 span,
10209 visitor,
10210 &mut *__ast_path,
10211 )
10212 };
10213 let token = {
10214 let mut __ast_path = __ast_path.with_guard(AstParentKind::TokenAndSpan(
10215 self::fields::TokenAndSpanField::Token,
10216 ));
10217 <Token as FoldWithAstPath<V>>::fold_with_ast_path(
10218 token,
10219 visitor,
10220 &mut *__ast_path,
10221 )
10222 };
10223 TokenAndSpan { span, token }
10224 }
10225 }
10226 }
10227}
10228#[cfg(any(docsrs, feature = "path"))]
10229#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
10230impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for swc_atoms::Atom {
10231 #[doc = "Calls [FoldAstPath`::fold_atom`] with `self`. (Extra impl)"]
10232 #[inline]
10233 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10234 <V as FoldAstPath>::fold_atom(visitor, self, __ast_path)
10235 }
10236
10237 #[inline]
10238 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10239 self
10240 }
10241}
10242#[cfg(any(docsrs, feature = "path"))]
10243#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
10244impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for Vec<AttributeToken> {
10245 #[doc = "Calls [FoldAstPath`::fold_attribute_tokens`] with `self`. (Extra impl)"]
10246 #[inline]
10247 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10248 <V as FoldAstPath>::fold_attribute_tokens(visitor, self, __ast_path)
10249 }
10250
10251 #[inline]
10252 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10253 self.into_iter()
10254 .enumerate()
10255 .map(|(__idx, item)| {
10256 let mut __ast_path = __ast_path.with_index_guard(__idx);
10257 <AttributeToken as FoldWithAstPath<V>>::fold_with_ast_path(
10258 item,
10259 visitor,
10260 &mut *__ast_path,
10261 )
10262 })
10263 .collect()
10264 }
10265}
10266#[cfg(any(docsrs, feature = "path"))]
10267#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
10268impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for Vec<Attribute> {
10269 #[doc = "Calls [FoldAstPath`::fold_attributes`] with `self`. (Extra impl)"]
10270 #[inline]
10271 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10272 <V as FoldAstPath>::fold_attributes(visitor, self, __ast_path)
10273 }
10274
10275 #[inline]
10276 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10277 self.into_iter()
10278 .enumerate()
10279 .map(|(__idx, item)| {
10280 let mut __ast_path = __ast_path.with_index_guard(__idx);
10281 <Attribute as FoldWithAstPath<V>>::fold_with_ast_path(
10282 item,
10283 visitor,
10284 &mut *__ast_path,
10285 )
10286 })
10287 .collect()
10288 }
10289}
10290#[cfg(any(docsrs, feature = "path"))]
10291#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
10292impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for Vec<Child> {
10293 #[doc = "Calls [FoldAstPath`::fold_childs`] with `self`. (Extra impl)"]
10294 #[inline]
10295 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10296 <V as FoldAstPath>::fold_childs(visitor, self, __ast_path)
10297 }
10298
10299 #[inline]
10300 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10301 self.into_iter()
10302 .enumerate()
10303 .map(|(__idx, item)| {
10304 let mut __ast_path = __ast_path.with_index_guard(__idx);
10305 <Child as FoldWithAstPath<V>>::fold_with_ast_path(item, visitor, &mut *__ast_path)
10306 })
10307 .collect()
10308 }
10309}
10310#[cfg(any(docsrs, feature = "path"))]
10311#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
10312impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for Option<swc_atoms::Atom> {
10313 #[doc = "Calls [FoldAstPath`::fold_opt_atom`] with `self`. (Extra impl)"]
10314 #[inline]
10315 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10316 <V as FoldAstPath>::fold_opt_atom(visitor, self, __ast_path)
10317 }
10318
10319 #[inline]
10320 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10321 self.map(|inner| {
10322 <swc_atoms::Atom as FoldWithAstPath<V>>::fold_with_ast_path(inner, visitor, __ast_path)
10323 })
10324 }
10325}
10326#[cfg(any(docsrs, feature = "path"))]
10327#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
10328impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for Option<Namespace> {
10329 #[doc = "Calls [FoldAstPath`::fold_opt_namespace`] with `self`. (Extra impl)"]
10330 #[inline]
10331 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10332 <V as FoldAstPath>::fold_opt_namespace(visitor, self, __ast_path)
10333 }
10334
10335 #[inline]
10336 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10337 self.map(|inner| {
10338 <Namespace as FoldWithAstPath<V>>::fold_with_ast_path(inner, visitor, __ast_path)
10339 })
10340 }
10341}
10342#[cfg(any(docsrs, feature = "path"))]
10343#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
10344impl<V: ?Sized + FoldAstPath> FoldWithAstPath<V> for swc_common::Span {
10345 #[doc = "Calls [FoldAstPath`::fold_span`] with `self`. (Extra impl)"]
10346 #[inline]
10347 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10348 <V as FoldAstPath>::fold_span(visitor, self, __ast_path)
10349 }
10350
10351 #[inline]
10352 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10353 self
10354 }
10355}
10356#[cfg(any(docsrs, feature = "path"))]
10357#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
10358impl<V, T> FoldWithAstPath<V> for std::boxed::Box<T>
10359where
10360 V: ?Sized + FoldAstPath,
10361 T: FoldWithAstPath<V>,
10362{
10363 #[inline]
10364 fn fold_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10365 swc_visit::util::map::Map::map(self, |inner| {
10366 <T as FoldWithAstPath<V>>::fold_with_ast_path(inner, visitor, __ast_path)
10367 })
10368 }
10369
10370 #[inline]
10371 fn fold_children_with_ast_path(self, visitor: &mut V, __ast_path: &mut AstKindPath) -> Self {
10372 swc_visit::util::map::Map::map(self, |inner| {
10373 <T as FoldWithAstPath<V>>::fold_children_with_ast_path(inner, visitor, __ast_path)
10374 })
10375 }
10376}
10377#[cfg(any(docsrs, feature = "path"))]
10378pub type AstKindPath = swc_visit::AstKindPath<AstParentKind>;
10379#[cfg(any(docsrs, feature = "path"))]
10380pub type AstNodePath<'ast> = swc_visit::AstNodePath<AstParentNodeRef<'ast>>;
10381#[cfg(any(docsrs, feature = "path"))]
10382pub mod fields {
10383 use swc_xml_ast::*;
10384 #[inline(always)]
10385 fn assert_initial_index(idx: usize, index: usize) {
10386 #[cfg(debug_assertions)]
10387 if !(idx == usize::MAX || index == usize::MAX) {
10388 {
10389 panic!("Should be usize::MAX");
10390 }
10391 }
10392 }
10393 impl AttributeField {
10394 pub(crate) fn set_index(&mut self, index: usize) {
10395 match self {
10396 _ => swc_visit::wrong_ast_path(),
10397 }
10398 }
10399 }
10400 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10401 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10402 pub enum AttributeField {
10403 #[doc = "Represents [`Attribute::span`]"]
10404 Span,
10405 #[doc = "Represents [`Attribute::namespace`]"]
10406 Namespace,
10407 #[doc = "Represents [`Attribute::prefix`]"]
10408 Prefix,
10409 #[doc = "Represents [`Attribute::name`]"]
10410 Name,
10411 #[doc = "Represents [`Attribute::raw_name`]"]
10412 RawName,
10413 #[doc = "Represents [`Attribute::value`]"]
10414 Value,
10415 #[doc = "Represents [`Attribute::raw_value`]"]
10416 RawValue,
10417 }
10418 impl AttributeTokenField {
10419 pub(crate) fn set_index(&mut self, index: usize) {
10420 match self {
10421 _ => swc_visit::wrong_ast_path(),
10422 }
10423 }
10424 }
10425 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10426 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10427 pub enum AttributeTokenField {
10428 #[doc = "Represents [`AttributeToken::span`]"]
10429 Span,
10430 #[doc = "Represents [`AttributeToken::name`]"]
10431 Name,
10432 #[doc = "Represents [`AttributeToken::raw_name`]"]
10433 RawName,
10434 #[doc = "Represents [`AttributeToken::value`]"]
10435 Value,
10436 #[doc = "Represents [`AttributeToken::raw_value`]"]
10437 RawValue,
10438 }
10439 impl CdataSectionField {
10440 pub(crate) fn set_index(&mut self, index: usize) {
10441 match self {
10442 _ => swc_visit::wrong_ast_path(),
10443 }
10444 }
10445 }
10446 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10447 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10448 pub enum CdataSectionField {
10449 #[doc = "Represents [`CdataSection::span`]"]
10450 Span,
10451 #[doc = "Represents [`CdataSection::data`]"]
10452 Data,
10453 #[doc = "Represents [`CdataSection::raw`]"]
10454 Raw,
10455 }
10456 impl ChildField {
10457 #[inline(always)]
10458 pub(crate) fn set_index(&mut self, _: usize) {
10459 swc_visit::wrong_ast_path();
10460 }
10461 }
10462 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10463 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10464 pub enum ChildField {
10465 #[doc = "Represents [`Child::DocumentType`]"]
10466 DocumentType,
10467 #[doc = "Represents [`Child::Element`]"]
10468 Element,
10469 #[doc = "Represents [`Child::Text`]"]
10470 Text,
10471 #[doc = "Represents [`Child::CdataSection`]"]
10472 CdataSection,
10473 #[doc = "Represents [`Child::Comment`]"]
10474 Comment,
10475 #[doc = "Represents [`Child::ProcessingInstruction`]"]
10476 ProcessingInstruction,
10477 }
10478 impl CommentField {
10479 pub(crate) fn set_index(&mut self, index: usize) {
10480 match self {
10481 _ => swc_visit::wrong_ast_path(),
10482 }
10483 }
10484 }
10485 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10486 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10487 pub enum CommentField {
10488 #[doc = "Represents [`Comment::span`]"]
10489 Span,
10490 #[doc = "Represents [`Comment::data`]"]
10491 Data,
10492 #[doc = "Represents [`Comment::raw`]"]
10493 Raw,
10494 }
10495 impl DocumentField {
10496 pub(crate) fn set_index(&mut self, index: usize) {
10497 match self {
10498 Self::Children(idx) => {
10499 assert_initial_index(*idx, index);
10500 *idx = index;
10501 }
10502 _ => swc_visit::wrong_ast_path(),
10503 }
10504 }
10505 }
10506 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10507 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10508 pub enum DocumentField {
10509 #[doc = "Represents [`Document::span`]"]
10510 Span,
10511 #[doc = "Represents [`Document::children`]"]
10512 Children(usize),
10513 }
10514 impl DocumentModeField {
10515 #[inline(always)]
10516 pub(crate) fn set_index(&mut self, _: usize) {
10517 swc_visit::wrong_ast_path();
10518 }
10519 }
10520 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10521 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10522 pub enum DocumentModeField {
10523 #[doc = "Represents [`DocumentMode::NoQuirks`]"]
10524 NoQuirks,
10525 #[doc = "Represents [`DocumentMode::LimitedQuirks`]"]
10526 LimitedQuirks,
10527 #[doc = "Represents [`DocumentMode::Quirks`]"]
10528 Quirks,
10529 }
10530 impl DocumentTypeField {
10531 pub(crate) fn set_index(&mut self, index: usize) {
10532 match self {
10533 _ => swc_visit::wrong_ast_path(),
10534 }
10535 }
10536 }
10537 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10538 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10539 pub enum DocumentTypeField {
10540 #[doc = "Represents [`DocumentType::span`]"]
10541 Span,
10542 #[doc = "Represents [`DocumentType::name`]"]
10543 Name,
10544 #[doc = "Represents [`DocumentType::public_id`]"]
10545 PublicId,
10546 #[doc = "Represents [`DocumentType::system_id`]"]
10547 SystemId,
10548 #[doc = "Represents [`DocumentType::raw`]"]
10549 Raw,
10550 }
10551 impl ElementField {
10552 pub(crate) fn set_index(&mut self, index: usize) {
10553 match self {
10554 Self::Attributes(idx) => {
10555 assert_initial_index(*idx, index);
10556 *idx = index;
10557 }
10558 Self::Children(idx) => {
10559 assert_initial_index(*idx, index);
10560 *idx = index;
10561 }
10562 _ => swc_visit::wrong_ast_path(),
10563 }
10564 }
10565 }
10566 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10567 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10568 pub enum ElementField {
10569 #[doc = "Represents [`Element::span`]"]
10570 Span,
10571 #[doc = "Represents [`Element::tag_name`]"]
10572 TagName,
10573 #[doc = "Represents [`Element::attributes`]"]
10574 Attributes(usize),
10575 #[doc = "Represents [`Element::children`]"]
10576 Children(usize),
10577 }
10578 impl NamespaceField {
10579 #[inline(always)]
10580 pub(crate) fn set_index(&mut self, _: usize) {
10581 swc_visit::wrong_ast_path();
10582 }
10583 }
10584 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10585 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10586 pub enum NamespaceField {
10587 #[doc = "Represents [`Namespace::HTML`]"]
10588 Html,
10589 #[doc = "Represents [`Namespace::MATHML`]"]
10590 Mathml,
10591 #[doc = "Represents [`Namespace::SVG`]"]
10592 Svg,
10593 #[doc = "Represents [`Namespace::XLINK`]"]
10594 Xlink,
10595 #[doc = "Represents [`Namespace::XML`]"]
10596 Xml,
10597 #[doc = "Represents [`Namespace::XMLNS`]"]
10598 Xmlns,
10599 }
10600 impl ProcessingInstructionField {
10601 pub(crate) fn set_index(&mut self, index: usize) {
10602 match self {
10603 _ => swc_visit::wrong_ast_path(),
10604 }
10605 }
10606 }
10607 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10608 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10609 pub enum ProcessingInstructionField {
10610 #[doc = "Represents [`ProcessingInstruction::span`]"]
10611 Span,
10612 #[doc = "Represents [`ProcessingInstruction::target`]"]
10613 Target,
10614 #[doc = "Represents [`ProcessingInstruction::data`]"]
10615 Data,
10616 }
10617 impl TextField {
10618 pub(crate) fn set_index(&mut self, index: usize) {
10619 match self {
10620 _ => swc_visit::wrong_ast_path(),
10621 }
10622 }
10623 }
10624 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10625 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10626 pub enum TextField {
10627 #[doc = "Represents [`Text::span`]"]
10628 Span,
10629 #[doc = "Represents [`Text::data`]"]
10630 Data,
10631 #[doc = "Represents [`Text::raw`]"]
10632 Raw,
10633 }
10634 impl TokenField {
10635 #[inline(always)]
10636 pub(crate) fn set_index(&mut self, _: usize) {
10637 swc_visit::wrong_ast_path();
10638 }
10639 }
10640 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10641 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10642 pub enum TokenField {
10643 #[doc = "Represents [`Token::Doctype`]"]
10644 Doctype,
10645 #[doc = "Represents [`Token::StartTag`]"]
10646 StartTag,
10647 #[doc = "Represents [`Token::EndTag`]"]
10648 EndTag,
10649 #[doc = "Represents [`Token::EmptyTag`]"]
10650 EmptyTag,
10651 #[doc = "Represents [`Token::Comment`]"]
10652 Comment,
10653 #[doc = "Represents [`Token::Character`]"]
10654 Character,
10655 #[doc = "Represents [`Token::ProcessingInstruction`]"]
10656 ProcessingInstruction,
10657 #[doc = "Represents [`Token::Cdata`]"]
10658 Cdata,
10659 #[doc = "Represents [`Token::Eof`]"]
10660 Eof,
10661 }
10662 impl TokenAndSpanField {
10663 pub(crate) fn set_index(&mut self, index: usize) {
10664 match self {
10665 _ => swc_visit::wrong_ast_path(),
10666 }
10667 }
10668 }
10669 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10670 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10671 pub enum TokenAndSpanField {
10672 #[doc = "Represents [`TokenAndSpan::span`]"]
10673 Span,
10674 #[doc = "Represents [`TokenAndSpan::token`]"]
10675 Token,
10676 }
10677 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10678 #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
10679 pub enum AstParentKind {
10680 Attribute(AttributeField),
10681 AttributeToken(AttributeTokenField),
10682 CdataSection(CdataSectionField),
10683 Child(ChildField),
10684 Comment(CommentField),
10685 Document(DocumentField),
10686 DocumentMode(DocumentModeField),
10687 DocumentType(DocumentTypeField),
10688 Element(ElementField),
10689 Namespace(NamespaceField),
10690 ProcessingInstruction(ProcessingInstructionField),
10691 Text(TextField),
10692 Token(TokenField),
10693 TokenAndSpan(TokenAndSpanField),
10694 }
10695 impl ::swc_visit::ParentKind for AstParentKind {
10696 #[inline]
10697 fn set_index(&mut self, index: usize) {
10698 match self {
10699 Self::Attribute(v) => v.set_index(index),
10700 Self::AttributeToken(v) => v.set_index(index),
10701 Self::CdataSection(v) => v.set_index(index),
10702 Self::Child(v) => v.set_index(index),
10703 Self::Comment(v) => v.set_index(index),
10704 Self::Document(v) => v.set_index(index),
10705 Self::DocumentMode(v) => v.set_index(index),
10706 Self::DocumentType(v) => v.set_index(index),
10707 Self::Element(v) => v.set_index(index),
10708 Self::Namespace(v) => v.set_index(index),
10709 Self::ProcessingInstruction(v) => v.set_index(index),
10710 Self::Text(v) => v.set_index(index),
10711 Self::Token(v) => v.set_index(index),
10712 Self::TokenAndSpan(v) => v.set_index(index),
10713 }
10714 }
10715 }
10716 #[derive(Debug, Clone, Copy)]
10717 pub enum AstParentNodeRef<'ast> {
10718 Attribute(&'ast Attribute, AttributeField),
10719 AttributeToken(&'ast AttributeToken, AttributeTokenField),
10720 CdataSection(&'ast CdataSection, CdataSectionField),
10721 Child(&'ast Child, ChildField),
10722 Comment(&'ast Comment, CommentField),
10723 Document(&'ast Document, DocumentField),
10724 DocumentMode(&'ast DocumentMode, DocumentModeField),
10725 DocumentType(&'ast DocumentType, DocumentTypeField),
10726 Element(&'ast Element, ElementField),
10727 Namespace(&'ast Namespace, NamespaceField),
10728 ProcessingInstruction(&'ast ProcessingInstruction, ProcessingInstructionField),
10729 Text(&'ast Text, TextField),
10730 Token(&'ast Token, TokenField),
10731 TokenAndSpan(&'ast TokenAndSpan, TokenAndSpanField),
10732 }
10733 impl<'ast> ::swc_visit::NodeRef for AstParentNodeRef<'ast> {
10734 type ParentKind = AstParentKind;
10735
10736 #[inline(always)]
10737 fn kind(&self) -> AstParentKind {
10738 self.kind()
10739 }
10740
10741 fn set_index(&mut self, index: usize) {
10742 match self {
10743 Self::Attribute(_, __field_kind) => __field_kind.set_index(index),
10744 Self::AttributeToken(_, __field_kind) => __field_kind.set_index(index),
10745 Self::CdataSection(_, __field_kind) => __field_kind.set_index(index),
10746 Self::Child(_, __field_kind) => __field_kind.set_index(index),
10747 Self::Comment(_, __field_kind) => __field_kind.set_index(index),
10748 Self::Document(_, __field_kind) => __field_kind.set_index(index),
10749 Self::DocumentMode(_, __field_kind) => __field_kind.set_index(index),
10750 Self::DocumentType(_, __field_kind) => __field_kind.set_index(index),
10751 Self::Element(_, __field_kind) => __field_kind.set_index(index),
10752 Self::Namespace(_, __field_kind) => __field_kind.set_index(index),
10753 Self::ProcessingInstruction(_, __field_kind) => __field_kind.set_index(index),
10754 Self::Text(_, __field_kind) => __field_kind.set_index(index),
10755 Self::Token(_, __field_kind) => __field_kind.set_index(index),
10756 Self::TokenAndSpan(_, __field_kind) => __field_kind.set_index(index),
10757 }
10758 }
10759 }
10760 #[cfg(any(docsrs, feature = "path"))]
10761 impl<'ast> AstParentNodeRef<'ast> {
10762 #[inline]
10763 pub fn kind(&self) -> AstParentKind {
10764 match self {
10765 Self::Attribute(_, __field_kind) => AstParentKind::Attribute(*__field_kind),
10766 Self::AttributeToken(_, __field_kind) => {
10767 AstParentKind::AttributeToken(*__field_kind)
10768 }
10769 Self::CdataSection(_, __field_kind) => AstParentKind::CdataSection(*__field_kind),
10770 Self::Child(_, __field_kind) => AstParentKind::Child(*__field_kind),
10771 Self::Comment(_, __field_kind) => AstParentKind::Comment(*__field_kind),
10772 Self::Document(_, __field_kind) => AstParentKind::Document(*__field_kind),
10773 Self::DocumentMode(_, __field_kind) => AstParentKind::DocumentMode(*__field_kind),
10774 Self::DocumentType(_, __field_kind) => AstParentKind::DocumentType(*__field_kind),
10775 Self::Element(_, __field_kind) => AstParentKind::Element(*__field_kind),
10776 Self::Namespace(_, __field_kind) => AstParentKind::Namespace(*__field_kind),
10777 Self::ProcessingInstruction(_, __field_kind) => {
10778 AstParentKind::ProcessingInstruction(*__field_kind)
10779 }
10780 Self::Text(_, __field_kind) => AstParentKind::Text(*__field_kind),
10781 Self::Token(_, __field_kind) => AstParentKind::Token(*__field_kind),
10782 Self::TokenAndSpan(_, __field_kind) => AstParentKind::TokenAndSpan(*__field_kind),
10783 }
10784 }
10785 }
10786}
10787impl<'ast> From<&'ast Attribute> for NodeRef<'ast> {
10788 fn from(node: &'ast Attribute) -> Self {
10789 NodeRef::Attribute(node)
10790 }
10791}
10792impl<'ast> From<&'ast AttributeToken> for NodeRef<'ast> {
10793 fn from(node: &'ast AttributeToken) -> Self {
10794 NodeRef::AttributeToken(node)
10795 }
10796}
10797impl<'ast> From<&'ast CdataSection> for NodeRef<'ast> {
10798 fn from(node: &'ast CdataSection) -> Self {
10799 NodeRef::CdataSection(node)
10800 }
10801}
10802impl<'ast> From<&'ast Child> for NodeRef<'ast> {
10803 fn from(node: &'ast Child) -> Self {
10804 NodeRef::Child(node)
10805 }
10806}
10807impl<'ast> From<&'ast Comment> for NodeRef<'ast> {
10808 fn from(node: &'ast Comment) -> Self {
10809 NodeRef::Comment(node)
10810 }
10811}
10812impl<'ast> From<&'ast Document> for NodeRef<'ast> {
10813 fn from(node: &'ast Document) -> Self {
10814 NodeRef::Document(node)
10815 }
10816}
10817impl<'ast> From<&'ast DocumentMode> for NodeRef<'ast> {
10818 fn from(node: &'ast DocumentMode) -> Self {
10819 NodeRef::DocumentMode(node)
10820 }
10821}
10822impl<'ast> From<&'ast DocumentType> for NodeRef<'ast> {
10823 fn from(node: &'ast DocumentType) -> Self {
10824 NodeRef::DocumentType(node)
10825 }
10826}
10827impl<'ast> From<&'ast Element> for NodeRef<'ast> {
10828 fn from(node: &'ast Element) -> Self {
10829 NodeRef::Element(node)
10830 }
10831}
10832impl<'ast> From<&'ast Namespace> for NodeRef<'ast> {
10833 fn from(node: &'ast Namespace) -> Self {
10834 NodeRef::Namespace(node)
10835 }
10836}
10837impl<'ast> From<&'ast ProcessingInstruction> for NodeRef<'ast> {
10838 fn from(node: &'ast ProcessingInstruction) -> Self {
10839 NodeRef::ProcessingInstruction(node)
10840 }
10841}
10842impl<'ast> From<&'ast Text> for NodeRef<'ast> {
10843 fn from(node: &'ast Text) -> Self {
10844 NodeRef::Text(node)
10845 }
10846}
10847impl<'ast> From<&'ast Token> for NodeRef<'ast> {
10848 fn from(node: &'ast Token) -> Self {
10849 NodeRef::Token(node)
10850 }
10851}
10852impl<'ast> From<&'ast TokenAndSpan> for NodeRef<'ast> {
10853 fn from(node: &'ast TokenAndSpan) -> Self {
10854 NodeRef::TokenAndSpan(node)
10855 }
10856}
10857#[derive(Debug, Clone, Copy)]
10858pub enum NodeRef<'ast> {
10859 Attribute(&'ast Attribute),
10860 AttributeToken(&'ast AttributeToken),
10861 CdataSection(&'ast CdataSection),
10862 Child(&'ast Child),
10863 Comment(&'ast Comment),
10864 Document(&'ast Document),
10865 DocumentMode(&'ast DocumentMode),
10866 DocumentType(&'ast DocumentType),
10867 Element(&'ast Element),
10868 Namespace(&'ast Namespace),
10869 ProcessingInstruction(&'ast ProcessingInstruction),
10870 Text(&'ast Text),
10871 Token(&'ast Token),
10872 TokenAndSpan(&'ast TokenAndSpan),
10873}
10874impl<'ast> NodeRef<'ast> {
10875 #[doc = r" This is not a part of semver-stable API. It is experimental and subject to change."]
10876 #[allow(unreachable_patterns)]
10877 pub fn experimental_raw_children<'a>(&'a self) -> Box<dyn 'a + Iterator<Item = NodeRef<'ast>>> {
10878 match self {
10879 NodeRef::Attribute(node) => {
10880 let iterator = ::std::iter::empty::<NodeRef<'ast>>().chain(
10881 node.namespace
10882 .iter()
10883 .flat_map(|item| ::std::iter::once(NodeRef::Namespace(&item))),
10884 );
10885 Box::new(iterator)
10886 }
10887 NodeRef::AttributeToken(node) => {
10888 let iterator = ::std::iter::empty::<NodeRef<'ast>>();
10889 Box::new(iterator)
10890 }
10891 NodeRef::CdataSection(node) => {
10892 let iterator = ::std::iter::empty::<NodeRef<'ast>>();
10893 Box::new(iterator)
10894 }
10895 NodeRef::Child(node) => match node {
10896 Child::DocumentType(v0) => Box::new(::std::iter::once(NodeRef::DocumentType(v0))),
10897 Child::Element(v0) => Box::new(::std::iter::once(NodeRef::Element(v0))),
10898 Child::Text(v0) => Box::new(::std::iter::once(NodeRef::Text(v0))),
10899 Child::CdataSection(v0) => Box::new(::std::iter::once(NodeRef::CdataSection(v0))),
10900 Child::Comment(v0) => Box::new(::std::iter::once(NodeRef::Comment(v0))),
10901 Child::ProcessingInstruction(v0) => {
10902 Box::new(::std::iter::once(NodeRef::ProcessingInstruction(v0)))
10903 }
10904 _ => Box::new(::std::iter::empty::<NodeRef<'ast>>()),
10905 },
10906 NodeRef::Comment(node) => {
10907 let iterator = ::std::iter::empty::<NodeRef<'ast>>();
10908 Box::new(iterator)
10909 }
10910 NodeRef::Document(node) => {
10911 let iterator = ::std::iter::empty::<NodeRef<'ast>>().chain(
10912 node.children
10913 .iter()
10914 .flat_map(|item| ::std::iter::once(NodeRef::Child(&item))),
10915 );
10916 Box::new(iterator)
10917 }
10918 NodeRef::DocumentMode(node) => match node {
10919 _ => Box::new(::std::iter::empty::<NodeRef<'ast>>()),
10920 },
10921 NodeRef::DocumentType(node) => {
10922 let iterator = ::std::iter::empty::<NodeRef<'ast>>();
10923 Box::new(iterator)
10924 }
10925 NodeRef::Element(node) => {
10926 let iterator = ::std::iter::empty::<NodeRef<'ast>>()
10927 .chain(
10928 node.attributes
10929 .iter()
10930 .flat_map(|item| ::std::iter::once(NodeRef::Attribute(&item))),
10931 )
10932 .chain(
10933 node.children
10934 .iter()
10935 .flat_map(|item| ::std::iter::once(NodeRef::Child(&item))),
10936 );
10937 Box::new(iterator)
10938 }
10939 NodeRef::Namespace(node) => match node {
10940 _ => Box::new(::std::iter::empty::<NodeRef<'ast>>()),
10941 },
10942 NodeRef::ProcessingInstruction(node) => {
10943 let iterator = ::std::iter::empty::<NodeRef<'ast>>();
10944 Box::new(iterator)
10945 }
10946 NodeRef::Text(node) => {
10947 let iterator = ::std::iter::empty::<NodeRef<'ast>>();
10948 Box::new(iterator)
10949 }
10950 NodeRef::Token(node) => match node {
10951 _ => Box::new(::std::iter::empty::<NodeRef<'ast>>()),
10952 },
10953 NodeRef::TokenAndSpan(node) => {
10954 let iterator = ::std::iter::empty::<NodeRef<'ast>>()
10955 .chain(::std::iter::once(NodeRef::Token(&node.token)));
10956 Box::new(iterator)
10957 }
10958 }
10959 }
10960}
10961impl<'ast> NodeRef<'ast> {
10962 #[doc = r" Visit all nodes in self in preorder."]
10963 #[doc = r""]
10964 #[doc = r" This is not a part of semver-stable API. It is"]
10965 #[doc = r" experimental and subject to change."]
10966 pub fn experimental_traverse(&'ast self) -> Box<dyn 'ast + Iterator<Item = NodeRef<'ast>>> {
10967 let mut queue = std::collections::VecDeque::<NodeRef<'ast>>::new();
10968 queue.push_back(*self);
10969 Box::new(std::iter::from_fn(move || {
10970 let node: NodeRef<'ast> = queue.pop_front()?;
10971 {
10972 let children = node.experimental_raw_children();
10973 queue.extend(children);
10974 }
10975 Some(node)
10976 }))
10977 }
10978}
10979#[cfg(any(docsrs, feature = "path"))]
10980pub use self::fields::{AstParentKind, AstParentNodeRef};