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