1 // WARNING: This file is auto-generated by crates/ast/generate_ast.py.
2 
3 use crate::SourceLocation;
4 use crate::arena;
5 use crate::types::*;
6 use std::borrow::{Borrow, BorrowMut};
7 
8 pub trait SourceLocationAccessor {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)9     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation);
get_loc(&self) -> SourceLocation10     fn get_loc(&self) -> SourceLocation;
11 }
12 impl<'alloc> SourceLocationAccessor for Argument<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)13     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
14         match self {
15             Argument::SpreadElement(content) => { content.set_loc(start, end) }
16             Argument::Expression(content) => { content.set_loc(start, end) }
17         }
18     }
19 
get_loc(&self) -> SourceLocation20     fn get_loc(&self) -> SourceLocation {
21         match self {
22             Argument::SpreadElement(content) => { content.get_loc() }
23             Argument::Expression(content) => { content.get_loc() }
24         }
25     }
26 }
27 
28 impl<'alloc> SourceLocationAccessor for Arguments<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)29     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
30         self.loc.start = start.start;
31         self.loc.end = end.end;
32     }
33 
get_loc(&self) -> SourceLocation34     fn get_loc(&self) -> SourceLocation {
35         self.loc
36     }
37 }
38 
39 impl<'alloc> SourceLocationAccessor for ArrayAssignmentTarget<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)40     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
41         self.loc.start = start.start;
42         self.loc.end = end.end;
43     }
44 
get_loc(&self) -> SourceLocation45     fn get_loc(&self) -> SourceLocation {
46         self.loc
47     }
48 }
49 
50 impl<'alloc> SourceLocationAccessor for ArrayBinding<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)51     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
52         self.loc.start = start.start;
53         self.loc.end = end.end;
54     }
55 
get_loc(&self) -> SourceLocation56     fn get_loc(&self) -> SourceLocation {
57         self.loc
58     }
59 }
60 
61 impl<'alloc> SourceLocationAccessor for ArrayExpression<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)62     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
63         self.loc.start = start.start;
64         self.loc.end = end.end;
65     }
66 
get_loc(&self) -> SourceLocation67     fn get_loc(&self) -> SourceLocation {
68         self.loc
69     }
70 }
71 
72 impl<'alloc> SourceLocationAccessor for ArrayExpressionElement<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)73     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
74         match self {
75             ArrayExpressionElement::SpreadElement(content) => { content.set_loc(start, end) }
76             ArrayExpressionElement::Expression(content) => { content.set_loc(start, end) }
77             ArrayExpressionElement::Elision { mut loc } => {
78                 loc.start = start.start;
79                 loc.end = end.end;
80             }
81         }
82     }
83 
get_loc(&self) -> SourceLocation84     fn get_loc(&self) -> SourceLocation {
85         match self {
86             ArrayExpressionElement::SpreadElement(content) => { content.get_loc() }
87             ArrayExpressionElement::Expression(content) => { content.get_loc() }
88             ArrayExpressionElement::Elision { loc } => {
89                 *loc
90             }
91         }
92     }
93 }
94 
95 impl<'alloc> SourceLocationAccessor for ArrowExpressionBody<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)96     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
97         match self {
98             ArrowExpressionBody::FunctionBody(content) => { content.set_loc(start, end) }
99             ArrowExpressionBody::Expression(content) => { content.set_loc(start, end) }
100         }
101     }
102 
get_loc(&self) -> SourceLocation103     fn get_loc(&self) -> SourceLocation {
104         match self {
105             ArrowExpressionBody::FunctionBody(content) => { content.get_loc() }
106             ArrowExpressionBody::Expression(content) => { content.get_loc() }
107         }
108     }
109 }
110 
111 impl<'alloc> SourceLocationAccessor for AssignmentTarget<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)112     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
113         match self {
114             AssignmentTarget::AssignmentTargetPattern(content) => { content.set_loc(start, end) }
115             AssignmentTarget::SimpleAssignmentTarget(content) => { content.set_loc(start, end) }
116         }
117     }
118 
get_loc(&self) -> SourceLocation119     fn get_loc(&self) -> SourceLocation {
120         match self {
121             AssignmentTarget::AssignmentTargetPattern(content) => { content.get_loc() }
122             AssignmentTarget::SimpleAssignmentTarget(content) => { content.get_loc() }
123         }
124     }
125 }
126 
127 impl<'alloc> SourceLocationAccessor for AssignmentTargetIdentifier {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)128     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
129         self.loc.start = start.start;
130         self.loc.end = end.end;
131     }
132 
get_loc(&self) -> SourceLocation133     fn get_loc(&self) -> SourceLocation {
134         self.loc
135     }
136 }
137 
138 impl<'alloc> SourceLocationAccessor for AssignmentTargetMaybeDefault<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)139     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
140         match self {
141             AssignmentTargetMaybeDefault::AssignmentTarget(content) => { content.set_loc(start, end) }
142             AssignmentTargetMaybeDefault::AssignmentTargetWithDefault(content) => { content.set_loc(start, end) }
143         }
144     }
145 
get_loc(&self) -> SourceLocation146     fn get_loc(&self) -> SourceLocation {
147         match self {
148             AssignmentTargetMaybeDefault::AssignmentTarget(content) => { content.get_loc() }
149             AssignmentTargetMaybeDefault::AssignmentTargetWithDefault(content) => { content.get_loc() }
150         }
151     }
152 }
153 
154 impl<'alloc> SourceLocationAccessor for AssignmentTargetPattern<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)155     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
156         match self {
157             AssignmentTargetPattern::ArrayAssignmentTarget(content) => { content.set_loc(start, end) }
158             AssignmentTargetPattern::ObjectAssignmentTarget(content) => { content.set_loc(start, end) }
159         }
160     }
161 
get_loc(&self) -> SourceLocation162     fn get_loc(&self) -> SourceLocation {
163         match self {
164             AssignmentTargetPattern::ArrayAssignmentTarget(content) => { content.get_loc() }
165             AssignmentTargetPattern::ObjectAssignmentTarget(content) => { content.get_loc() }
166         }
167     }
168 }
169 
170 impl<'alloc> SourceLocationAccessor for AssignmentTargetProperty<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)171     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
172         match self {
173             AssignmentTargetProperty::AssignmentTargetPropertyIdentifier(content) => { content.set_loc(start, end) }
174             AssignmentTargetProperty::AssignmentTargetPropertyProperty(content) => { content.set_loc(start, end) }
175         }
176     }
177 
get_loc(&self) -> SourceLocation178     fn get_loc(&self) -> SourceLocation {
179         match self {
180             AssignmentTargetProperty::AssignmentTargetPropertyIdentifier(content) => { content.get_loc() }
181             AssignmentTargetProperty::AssignmentTargetPropertyProperty(content) => { content.get_loc() }
182         }
183     }
184 }
185 
186 impl<'alloc> SourceLocationAccessor for AssignmentTargetPropertyIdentifier<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)187     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
188         self.loc.start = start.start;
189         self.loc.end = end.end;
190     }
191 
get_loc(&self) -> SourceLocation192     fn get_loc(&self) -> SourceLocation {
193         self.loc
194     }
195 }
196 
197 impl<'alloc> SourceLocationAccessor for AssignmentTargetPropertyProperty<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)198     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
199         self.loc.start = start.start;
200         self.loc.end = end.end;
201     }
202 
get_loc(&self) -> SourceLocation203     fn get_loc(&self) -> SourceLocation {
204         self.loc
205     }
206 }
207 
208 impl<'alloc> SourceLocationAccessor for AssignmentTargetWithDefault<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)209     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
210         self.loc.start = start.start;
211         self.loc.end = end.end;
212     }
213 
get_loc(&self) -> SourceLocation214     fn get_loc(&self) -> SourceLocation {
215         self.loc
216     }
217 }
218 
219 impl<'alloc> SourceLocationAccessor for BinaryOperator {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)220     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
221         match self {
222             BinaryOperator::Equals { mut loc } => {
223                 loc.start = start.start;
224                 loc.end = end.end;
225             }
226             BinaryOperator::NotEquals { mut loc } => {
227                 loc.start = start.start;
228                 loc.end = end.end;
229             }
230             BinaryOperator::StrictEquals { mut loc } => {
231                 loc.start = start.start;
232                 loc.end = end.end;
233             }
234             BinaryOperator::StrictNotEquals { mut loc } => {
235                 loc.start = start.start;
236                 loc.end = end.end;
237             }
238             BinaryOperator::LessThan { mut loc } => {
239                 loc.start = start.start;
240                 loc.end = end.end;
241             }
242             BinaryOperator::LessThanOrEqual { mut loc } => {
243                 loc.start = start.start;
244                 loc.end = end.end;
245             }
246             BinaryOperator::GreaterThan { mut loc } => {
247                 loc.start = start.start;
248                 loc.end = end.end;
249             }
250             BinaryOperator::GreaterThanOrEqual { mut loc } => {
251                 loc.start = start.start;
252                 loc.end = end.end;
253             }
254             BinaryOperator::In { mut loc } => {
255                 loc.start = start.start;
256                 loc.end = end.end;
257             }
258             BinaryOperator::Instanceof { mut loc } => {
259                 loc.start = start.start;
260                 loc.end = end.end;
261             }
262             BinaryOperator::LeftShift { mut loc } => {
263                 loc.start = start.start;
264                 loc.end = end.end;
265             }
266             BinaryOperator::RightShift { mut loc } => {
267                 loc.start = start.start;
268                 loc.end = end.end;
269             }
270             BinaryOperator::RightShiftExt { mut loc } => {
271                 loc.start = start.start;
272                 loc.end = end.end;
273             }
274             BinaryOperator::Add { mut loc } => {
275                 loc.start = start.start;
276                 loc.end = end.end;
277             }
278             BinaryOperator::Sub { mut loc } => {
279                 loc.start = start.start;
280                 loc.end = end.end;
281             }
282             BinaryOperator::Mul { mut loc } => {
283                 loc.start = start.start;
284                 loc.end = end.end;
285             }
286             BinaryOperator::Div { mut loc } => {
287                 loc.start = start.start;
288                 loc.end = end.end;
289             }
290             BinaryOperator::Mod { mut loc } => {
291                 loc.start = start.start;
292                 loc.end = end.end;
293             }
294             BinaryOperator::Pow { mut loc } => {
295                 loc.start = start.start;
296                 loc.end = end.end;
297             }
298             BinaryOperator::Comma { mut loc } => {
299                 loc.start = start.start;
300                 loc.end = end.end;
301             }
302             BinaryOperator::Coalesce { mut loc } => {
303                 loc.start = start.start;
304                 loc.end = end.end;
305             }
306             BinaryOperator::LogicalOr { mut loc } => {
307                 loc.start = start.start;
308                 loc.end = end.end;
309             }
310             BinaryOperator::LogicalAnd { mut loc } => {
311                 loc.start = start.start;
312                 loc.end = end.end;
313             }
314             BinaryOperator::BitwiseOr { mut loc } => {
315                 loc.start = start.start;
316                 loc.end = end.end;
317             }
318             BinaryOperator::BitwiseXor { mut loc } => {
319                 loc.start = start.start;
320                 loc.end = end.end;
321             }
322             BinaryOperator::BitwiseAnd { mut loc } => {
323                 loc.start = start.start;
324                 loc.end = end.end;
325             }
326         }
327     }
328 
get_loc(&self) -> SourceLocation329     fn get_loc(&self) -> SourceLocation {
330         match self {
331             BinaryOperator::Equals { loc } => {
332                 *loc
333             }
334             BinaryOperator::NotEquals { loc } => {
335                 *loc
336             }
337             BinaryOperator::StrictEquals { loc } => {
338                 *loc
339             }
340             BinaryOperator::StrictNotEquals { loc } => {
341                 *loc
342             }
343             BinaryOperator::LessThan { loc } => {
344                 *loc
345             }
346             BinaryOperator::LessThanOrEqual { loc } => {
347                 *loc
348             }
349             BinaryOperator::GreaterThan { loc } => {
350                 *loc
351             }
352             BinaryOperator::GreaterThanOrEqual { loc } => {
353                 *loc
354             }
355             BinaryOperator::In { loc } => {
356                 *loc
357             }
358             BinaryOperator::Instanceof { loc } => {
359                 *loc
360             }
361             BinaryOperator::LeftShift { loc } => {
362                 *loc
363             }
364             BinaryOperator::RightShift { loc } => {
365                 *loc
366             }
367             BinaryOperator::RightShiftExt { loc } => {
368                 *loc
369             }
370             BinaryOperator::Add { loc } => {
371                 *loc
372             }
373             BinaryOperator::Sub { loc } => {
374                 *loc
375             }
376             BinaryOperator::Mul { loc } => {
377                 *loc
378             }
379             BinaryOperator::Div { loc } => {
380                 *loc
381             }
382             BinaryOperator::Mod { loc } => {
383                 *loc
384             }
385             BinaryOperator::Pow { loc } => {
386                 *loc
387             }
388             BinaryOperator::Comma { loc } => {
389                 *loc
390             }
391             BinaryOperator::Coalesce { loc } => {
392                 *loc
393             }
394             BinaryOperator::LogicalOr { loc } => {
395                 *loc
396             }
397             BinaryOperator::LogicalAnd { loc } => {
398                 *loc
399             }
400             BinaryOperator::BitwiseOr { loc } => {
401                 *loc
402             }
403             BinaryOperator::BitwiseXor { loc } => {
404                 *loc
405             }
406             BinaryOperator::BitwiseAnd { loc } => {
407                 *loc
408             }
409         }
410     }
411 }
412 
413 impl<'alloc> SourceLocationAccessor for Binding<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)414     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
415         match self {
416             Binding::BindingPattern(content) => { content.set_loc(start, end) }
417             Binding::BindingIdentifier(content) => { content.set_loc(start, end) }
418         }
419     }
420 
get_loc(&self) -> SourceLocation421     fn get_loc(&self) -> SourceLocation {
422         match self {
423             Binding::BindingPattern(content) => { content.get_loc() }
424             Binding::BindingIdentifier(content) => { content.get_loc() }
425         }
426     }
427 }
428 
429 impl<'alloc> SourceLocationAccessor for BindingIdentifier {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)430     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
431         self.loc.start = start.start;
432         self.loc.end = end.end;
433     }
434 
get_loc(&self) -> SourceLocation435     fn get_loc(&self) -> SourceLocation {
436         self.loc
437     }
438 }
439 
440 impl<'alloc> SourceLocationAccessor for BindingPattern<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)441     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
442         match self {
443             BindingPattern::ObjectBinding(content) => { content.set_loc(start, end) }
444             BindingPattern::ArrayBinding(content) => { content.set_loc(start, end) }
445         }
446     }
447 
get_loc(&self) -> SourceLocation448     fn get_loc(&self) -> SourceLocation {
449         match self {
450             BindingPattern::ObjectBinding(content) => { content.get_loc() }
451             BindingPattern::ArrayBinding(content) => { content.get_loc() }
452         }
453     }
454 }
455 
456 impl<'alloc> SourceLocationAccessor for BindingProperty<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)457     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
458         match self {
459             BindingProperty::BindingPropertyIdentifier(content) => { content.set_loc(start, end) }
460             BindingProperty::BindingPropertyProperty(content) => { content.set_loc(start, end) }
461         }
462     }
463 
get_loc(&self) -> SourceLocation464     fn get_loc(&self) -> SourceLocation {
465         match self {
466             BindingProperty::BindingPropertyIdentifier(content) => { content.get_loc() }
467             BindingProperty::BindingPropertyProperty(content) => { content.get_loc() }
468         }
469     }
470 }
471 
472 impl<'alloc> SourceLocationAccessor for BindingPropertyIdentifier<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)473     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
474         self.loc.start = start.start;
475         self.loc.end = end.end;
476     }
477 
get_loc(&self) -> SourceLocation478     fn get_loc(&self) -> SourceLocation {
479         self.loc
480     }
481 }
482 
483 impl<'alloc> SourceLocationAccessor for BindingPropertyProperty<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)484     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
485         self.loc.start = start.start;
486         self.loc.end = end.end;
487     }
488 
get_loc(&self) -> SourceLocation489     fn get_loc(&self) -> SourceLocation {
490         self.loc
491     }
492 }
493 
494 impl<'alloc> SourceLocationAccessor for BindingWithDefault<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)495     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
496         self.loc.start = start.start;
497         self.loc.end = end.end;
498     }
499 
get_loc(&self) -> SourceLocation500     fn get_loc(&self) -> SourceLocation {
501         self.loc
502     }
503 }
504 
505 impl<'alloc> SourceLocationAccessor for Block<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)506     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
507         self.loc.start = start.start;
508         self.loc.end = end.end;
509     }
510 
get_loc(&self) -> SourceLocation511     fn get_loc(&self) -> SourceLocation {
512         self.loc
513     }
514 }
515 
516 impl<'alloc> SourceLocationAccessor for CallExpression<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)517     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
518         self.loc.start = start.start;
519         self.loc.end = end.end;
520     }
521 
get_loc(&self) -> SourceLocation522     fn get_loc(&self) -> SourceLocation {
523         self.loc
524     }
525 }
526 
527 impl<'alloc> SourceLocationAccessor for CatchClause<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)528     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
529         self.loc.start = start.start;
530         self.loc.end = end.end;
531     }
532 
get_loc(&self) -> SourceLocation533     fn get_loc(&self) -> SourceLocation {
534         self.loc
535     }
536 }
537 
538 impl<'alloc> SourceLocationAccessor for ClassDeclaration<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)539     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
540         self.loc.start = start.start;
541         self.loc.end = end.end;
542     }
543 
get_loc(&self) -> SourceLocation544     fn get_loc(&self) -> SourceLocation {
545         self.loc
546     }
547 }
548 
549 impl<'alloc> SourceLocationAccessor for ClassElement<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)550     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
551         match self {
552             ClassElement::MethodDefinition { mut loc, .. } => {
553                 loc.start = start.start;
554                 loc.end = end.end;
555             }
556             ClassElement::FieldDefinition { mut loc, .. } => {
557                 loc.start = start.start;
558                 loc.end = end.end;
559             }
560         }
561     }
562 
get_loc(&self) -> SourceLocation563     fn get_loc(&self) -> SourceLocation {
564         match self {
565             ClassElement::MethodDefinition { loc, .. } => {
566                 *loc
567             }
568             ClassElement::FieldDefinition { loc, .. } => {
569                 *loc
570             }
571         }
572     }
573 }
574 
575 impl<'alloc> SourceLocationAccessor for ClassElementName<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)576     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
577         match self {
578             ClassElementName::ComputedPropertyName(content) => { content.set_loc(start, end) }
579             ClassElementName::StaticPropertyName(content) => { content.set_loc(start, end) }
580             ClassElementName::StaticNumericPropertyName(content) => { content.set_loc(start, end) }
581             ClassElementName::PrivateFieldName(content) => { content.set_loc(start, end) }
582         }
583     }
584 
get_loc(&self) -> SourceLocation585     fn get_loc(&self) -> SourceLocation {
586         match self {
587             ClassElementName::ComputedPropertyName(content) => { content.get_loc() }
588             ClassElementName::StaticPropertyName(content) => { content.get_loc() }
589             ClassElementName::StaticNumericPropertyName(content) => { content.get_loc() }
590             ClassElementName::PrivateFieldName(content) => { content.get_loc() }
591         }
592     }
593 }
594 
595 impl<'alloc> SourceLocationAccessor for ClassExpression<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)596     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
597         self.loc.start = start.start;
598         self.loc.end = end.end;
599     }
600 
get_loc(&self) -> SourceLocation601     fn get_loc(&self) -> SourceLocation {
602         self.loc
603     }
604 }
605 
606 impl<'alloc> SourceLocationAccessor for CompoundAssignmentOperator {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)607     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
608         match self {
609             CompoundAssignmentOperator::LogicalOr { mut loc } => {
610                 loc.start = start.start;
611                 loc.end = end.end;
612             }
613             CompoundAssignmentOperator::LogicalAnd { mut loc } => {
614                 loc.start = start.start;
615                 loc.end = end.end;
616             }
617             CompoundAssignmentOperator::Coalesce { mut loc } => {
618                 loc.start = start.start;
619                 loc.end = end.end;
620             }
621             CompoundAssignmentOperator::Add { mut loc } => {
622                 loc.start = start.start;
623                 loc.end = end.end;
624             }
625             CompoundAssignmentOperator::Sub { mut loc } => {
626                 loc.start = start.start;
627                 loc.end = end.end;
628             }
629             CompoundAssignmentOperator::Mul { mut loc } => {
630                 loc.start = start.start;
631                 loc.end = end.end;
632             }
633             CompoundAssignmentOperator::Div { mut loc } => {
634                 loc.start = start.start;
635                 loc.end = end.end;
636             }
637             CompoundAssignmentOperator::Mod { mut loc } => {
638                 loc.start = start.start;
639                 loc.end = end.end;
640             }
641             CompoundAssignmentOperator::Pow { mut loc } => {
642                 loc.start = start.start;
643                 loc.end = end.end;
644             }
645             CompoundAssignmentOperator::LeftShift { mut loc } => {
646                 loc.start = start.start;
647                 loc.end = end.end;
648             }
649             CompoundAssignmentOperator::RightShift { mut loc } => {
650                 loc.start = start.start;
651                 loc.end = end.end;
652             }
653             CompoundAssignmentOperator::RightShiftExt { mut loc } => {
654                 loc.start = start.start;
655                 loc.end = end.end;
656             }
657             CompoundAssignmentOperator::Or { mut loc } => {
658                 loc.start = start.start;
659                 loc.end = end.end;
660             }
661             CompoundAssignmentOperator::Xor { mut loc } => {
662                 loc.start = start.start;
663                 loc.end = end.end;
664             }
665             CompoundAssignmentOperator::And { mut loc } => {
666                 loc.start = start.start;
667                 loc.end = end.end;
668             }
669         }
670     }
671 
get_loc(&self) -> SourceLocation672     fn get_loc(&self) -> SourceLocation {
673         match self {
674             CompoundAssignmentOperator::LogicalOr { loc } => {
675                 *loc
676             }
677             CompoundAssignmentOperator::LogicalAnd { loc } => {
678                 *loc
679             }
680             CompoundAssignmentOperator::Coalesce { loc } => {
681                 *loc
682             }
683             CompoundAssignmentOperator::Add { loc } => {
684                 *loc
685             }
686             CompoundAssignmentOperator::Sub { loc } => {
687                 *loc
688             }
689             CompoundAssignmentOperator::Mul { loc } => {
690                 *loc
691             }
692             CompoundAssignmentOperator::Div { loc } => {
693                 *loc
694             }
695             CompoundAssignmentOperator::Mod { loc } => {
696                 *loc
697             }
698             CompoundAssignmentOperator::Pow { loc } => {
699                 *loc
700             }
701             CompoundAssignmentOperator::LeftShift { loc } => {
702                 *loc
703             }
704             CompoundAssignmentOperator::RightShift { loc } => {
705                 *loc
706             }
707             CompoundAssignmentOperator::RightShiftExt { loc } => {
708                 *loc
709             }
710             CompoundAssignmentOperator::Or { loc } => {
711                 *loc
712             }
713             CompoundAssignmentOperator::Xor { loc } => {
714                 *loc
715             }
716             CompoundAssignmentOperator::And { loc } => {
717                 *loc
718             }
719         }
720     }
721 }
722 
723 impl<'alloc> SourceLocationAccessor for ComputedMemberAssignmentTarget<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)724     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
725         self.loc.start = start.start;
726         self.loc.end = end.end;
727     }
728 
get_loc(&self) -> SourceLocation729     fn get_loc(&self) -> SourceLocation {
730         self.loc
731     }
732 }
733 
734 impl<'alloc> SourceLocationAccessor for ComputedMemberExpression<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)735     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
736         self.loc.start = start.start;
737         self.loc.end = end.end;
738     }
739 
get_loc(&self) -> SourceLocation740     fn get_loc(&self) -> SourceLocation {
741         self.loc
742     }
743 }
744 
745 impl<'alloc> SourceLocationAccessor for ComputedPropertyName<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)746     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
747         self.loc.start = start.start;
748         self.loc.end = end.end;
749     }
750 
get_loc(&self) -> SourceLocation751     fn get_loc(&self) -> SourceLocation {
752         self.loc
753     }
754 }
755 
756 impl<'alloc> SourceLocationAccessor for CoverParenthesized<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)757     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
758         match self {
759             CoverParenthesized::Expression { mut loc, .. } => {
760                 loc.start = start.start;
761                 loc.end = end.end;
762             }
763             CoverParenthesized::Parameters(content) => { content.set_loc(start, end) }
764         }
765     }
766 
get_loc(&self) -> SourceLocation767     fn get_loc(&self) -> SourceLocation {
768         match self {
769             CoverParenthesized::Expression { loc, .. } => {
770                 *loc
771             }
772             CoverParenthesized::Parameters(content) => { content.get_loc() }
773         }
774     }
775 }
776 
777 impl<'alloc> SourceLocationAccessor for DataProperty<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)778     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
779         self.loc.start = start.start;
780         self.loc.end = end.end;
781     }
782 
get_loc(&self) -> SourceLocation783     fn get_loc(&self) -> SourceLocation {
784         self.loc
785     }
786 }
787 
788 impl<'alloc> SourceLocationAccessor for Directive {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)789     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
790         self.loc.start = start.start;
791         self.loc.end = end.end;
792     }
793 
get_loc(&self) -> SourceLocation794     fn get_loc(&self) -> SourceLocation {
795         self.loc
796     }
797 }
798 
799 impl<'alloc> SourceLocationAccessor for Export<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)800     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
801         match self {
802             Export::FunctionDeclaration(content) => { content.set_loc(start, end) }
803             Export::ClassDeclaration(content) => { content.set_loc(start, end) }
804             Export::VariableDeclaration(content) => { content.set_loc(start, end) }
805         }
806     }
807 
get_loc(&self) -> SourceLocation808     fn get_loc(&self) -> SourceLocation {
809         match self {
810             Export::FunctionDeclaration(content) => { content.get_loc() }
811             Export::ClassDeclaration(content) => { content.get_loc() }
812             Export::VariableDeclaration(content) => { content.get_loc() }
813         }
814     }
815 }
816 
817 impl<'alloc> SourceLocationAccessor for ExportAllFrom {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)818     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
819         self.loc.start = start.start;
820         self.loc.end = end.end;
821     }
822 
get_loc(&self) -> SourceLocation823     fn get_loc(&self) -> SourceLocation {
824         self.loc
825     }
826 }
827 
828 impl<'alloc> SourceLocationAccessor for ExportDeclaration<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)829     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
830         match self {
831             ExportDeclaration::ExportAllFrom(content) => { content.set_loc(start, end) }
832             ExportDeclaration::ExportFrom(content) => { content.set_loc(start, end) }
833             ExportDeclaration::ExportLocals(content) => { content.set_loc(start, end) }
834             ExportDeclaration::Export(content) => { content.set_loc(start, end) }
835             ExportDeclaration::ExportDefault(content) => { content.set_loc(start, end) }
836         }
837     }
838 
get_loc(&self) -> SourceLocation839     fn get_loc(&self) -> SourceLocation {
840         match self {
841             ExportDeclaration::ExportAllFrom(content) => { content.get_loc() }
842             ExportDeclaration::ExportFrom(content) => { content.get_loc() }
843             ExportDeclaration::ExportLocals(content) => { content.get_loc() }
844             ExportDeclaration::Export(content) => { content.get_loc() }
845             ExportDeclaration::ExportDefault(content) => { content.get_loc() }
846         }
847     }
848 }
849 
850 impl<'alloc> SourceLocationAccessor for ExportDefault<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)851     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
852         match self {
853             ExportDefault::FunctionDeclaration(content) => { content.set_loc(start, end) }
854             ExportDefault::ClassDeclaration(content) => { content.set_loc(start, end) }
855             ExportDefault::Expression(content) => { content.set_loc(start, end) }
856         }
857     }
858 
get_loc(&self) -> SourceLocation859     fn get_loc(&self) -> SourceLocation {
860         match self {
861             ExportDefault::FunctionDeclaration(content) => { content.get_loc() }
862             ExportDefault::ClassDeclaration(content) => { content.get_loc() }
863             ExportDefault::Expression(content) => { content.get_loc() }
864         }
865     }
866 }
867 
868 impl<'alloc> SourceLocationAccessor for ExportFrom<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)869     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
870         self.loc.start = start.start;
871         self.loc.end = end.end;
872     }
873 
get_loc(&self) -> SourceLocation874     fn get_loc(&self) -> SourceLocation {
875         self.loc
876     }
877 }
878 
879 impl<'alloc> SourceLocationAccessor for ExportFromSpecifier {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)880     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
881         self.loc.start = start.start;
882         self.loc.end = end.end;
883     }
884 
get_loc(&self) -> SourceLocation885     fn get_loc(&self) -> SourceLocation {
886         self.loc
887     }
888 }
889 
890 impl<'alloc> SourceLocationAccessor for ExportLocalSpecifier {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)891     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
892         self.loc.start = start.start;
893         self.loc.end = end.end;
894     }
895 
get_loc(&self) -> SourceLocation896     fn get_loc(&self) -> SourceLocation {
897         self.loc
898     }
899 }
900 
901 impl<'alloc> SourceLocationAccessor for ExportLocals<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)902     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
903         self.loc.start = start.start;
904         self.loc.end = end.end;
905     }
906 
get_loc(&self) -> SourceLocation907     fn get_loc(&self) -> SourceLocation {
908         self.loc
909     }
910 }
911 
912 impl<'alloc> SourceLocationAccessor for Expression<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)913     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
914         match self {
915             Expression::MemberExpression(content) => { content.set_loc(start, end) }
916             Expression::ClassExpression(content) => { content.set_loc(start, end) }
917             Expression::LiteralBooleanExpression { mut loc, .. } => {
918                 loc.start = start.start;
919                 loc.end = end.end;
920             }
921             Expression::LiteralInfinityExpression { mut loc } => {
922                 loc.start = start.start;
923                 loc.end = end.end;
924             }
925             Expression::LiteralNullExpression { mut loc } => {
926                 loc.start = start.start;
927                 loc.end = end.end;
928             }
929             Expression::LiteralNumericExpression(content) => { content.set_loc(start, end) }
930             Expression::LiteralRegExpExpression { mut loc, .. } => {
931                 loc.start = start.start;
932                 loc.end = end.end;
933             }
934             Expression::LiteralStringExpression { mut loc, .. } => {
935                 loc.start = start.start;
936                 loc.end = end.end;
937             }
938             Expression::ArrayExpression(content) => { content.set_loc(start, end) }
939             Expression::ArrowExpression { mut loc, .. } => {
940                 loc.start = start.start;
941                 loc.end = end.end;
942             }
943             Expression::AssignmentExpression { mut loc, .. } => {
944                 loc.start = start.start;
945                 loc.end = end.end;
946             }
947             Expression::BinaryExpression { mut loc, .. } => {
948                 loc.start = start.start;
949                 loc.end = end.end;
950             }
951             Expression::CallExpression(content) => { content.set_loc(start, end) }
952             Expression::CompoundAssignmentExpression { mut loc, .. } => {
953                 loc.start = start.start;
954                 loc.end = end.end;
955             }
956             Expression::ConditionalExpression { mut loc, .. } => {
957                 loc.start = start.start;
958                 loc.end = end.end;
959             }
960             Expression::FunctionExpression(content) => { content.set_loc(start, end) }
961             Expression::IdentifierExpression(content) => { content.set_loc(start, end) }
962             Expression::NewExpression { mut loc, .. } => {
963                 loc.start = start.start;
964                 loc.end = end.end;
965             }
966             Expression::NewTargetExpression { mut loc } => {
967                 loc.start = start.start;
968                 loc.end = end.end;
969             }
970             Expression::ObjectExpression(content) => { content.set_loc(start, end) }
971             Expression::OptionalExpression { mut loc, .. } => {
972                 loc.start = start.start;
973                 loc.end = end.end;
974             }
975             Expression::OptionalChain(content) => { content.set_loc(start, end) }
976             Expression::UnaryExpression { mut loc, .. } => {
977                 loc.start = start.start;
978                 loc.end = end.end;
979             }
980             Expression::TemplateExpression(content) => { content.set_loc(start, end) }
981             Expression::ThisExpression { mut loc } => {
982                 loc.start = start.start;
983                 loc.end = end.end;
984             }
985             Expression::UpdateExpression { mut loc, .. } => {
986                 loc.start = start.start;
987                 loc.end = end.end;
988             }
989             Expression::YieldExpression { mut loc, .. } => {
990                 loc.start = start.start;
991                 loc.end = end.end;
992             }
993             Expression::YieldGeneratorExpression { mut loc, .. } => {
994                 loc.start = start.start;
995                 loc.end = end.end;
996             }
997             Expression::AwaitExpression { mut loc, .. } => {
998                 loc.start = start.start;
999                 loc.end = end.end;
1000             }
1001             Expression::ImportCallExpression { mut loc, .. } => {
1002                 loc.start = start.start;
1003                 loc.end = end.end;
1004             }
1005         }
1006     }
1007 
get_loc(&self) -> SourceLocation1008     fn get_loc(&self) -> SourceLocation {
1009         match self {
1010             Expression::MemberExpression(content) => { content.get_loc() }
1011             Expression::ClassExpression(content) => { content.get_loc() }
1012             Expression::LiteralBooleanExpression { loc, .. } => {
1013                 *loc
1014             }
1015             Expression::LiteralInfinityExpression { loc } => {
1016                 *loc
1017             }
1018             Expression::LiteralNullExpression { loc } => {
1019                 *loc
1020             }
1021             Expression::LiteralNumericExpression(content) => { content.get_loc() }
1022             Expression::LiteralRegExpExpression { loc, .. } => {
1023                 *loc
1024             }
1025             Expression::LiteralStringExpression { loc, .. } => {
1026                 *loc
1027             }
1028             Expression::ArrayExpression(content) => { content.get_loc() }
1029             Expression::ArrowExpression { loc, .. } => {
1030                 *loc
1031             }
1032             Expression::AssignmentExpression { loc, .. } => {
1033                 *loc
1034             }
1035             Expression::BinaryExpression { loc, .. } => {
1036                 *loc
1037             }
1038             Expression::CallExpression(content) => { content.get_loc() }
1039             Expression::CompoundAssignmentExpression { loc, .. } => {
1040                 *loc
1041             }
1042             Expression::ConditionalExpression { loc, .. } => {
1043                 *loc
1044             }
1045             Expression::FunctionExpression(content) => { content.get_loc() }
1046             Expression::IdentifierExpression(content) => { content.get_loc() }
1047             Expression::NewExpression { loc, .. } => {
1048                 *loc
1049             }
1050             Expression::NewTargetExpression { loc } => {
1051                 *loc
1052             }
1053             Expression::ObjectExpression(content) => { content.get_loc() }
1054             Expression::OptionalExpression { loc, .. } => {
1055                 *loc
1056             }
1057             Expression::OptionalChain(content) => { content.get_loc() }
1058             Expression::UnaryExpression { loc, .. } => {
1059                 *loc
1060             }
1061             Expression::TemplateExpression(content) => { content.get_loc() }
1062             Expression::ThisExpression { loc } => {
1063                 *loc
1064             }
1065             Expression::UpdateExpression { loc, .. } => {
1066                 *loc
1067             }
1068             Expression::YieldExpression { loc, .. } => {
1069                 *loc
1070             }
1071             Expression::YieldGeneratorExpression { loc, .. } => {
1072                 *loc
1073             }
1074             Expression::AwaitExpression { loc, .. } => {
1075                 *loc
1076             }
1077             Expression::ImportCallExpression { loc, .. } => {
1078                 *loc
1079             }
1080         }
1081     }
1082 }
1083 
1084 impl<'alloc> SourceLocationAccessor for ExpressionOrSuper<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1085     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1086         match self {
1087             ExpressionOrSuper::Expression(content) => { content.set_loc(start, end) }
1088             ExpressionOrSuper::Super { mut loc } => {
1089                 loc.start = start.start;
1090                 loc.end = end.end;
1091             }
1092         }
1093     }
1094 
get_loc(&self) -> SourceLocation1095     fn get_loc(&self) -> SourceLocation {
1096         match self {
1097             ExpressionOrSuper::Expression(content) => { content.get_loc() }
1098             ExpressionOrSuper::Super { loc } => {
1099                 *loc
1100             }
1101         }
1102     }
1103 }
1104 
1105 impl<'alloc> SourceLocationAccessor for FormalParameters<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1106     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1107         self.loc.start = start.start;
1108         self.loc.end = end.end;
1109     }
1110 
get_loc(&self) -> SourceLocation1111     fn get_loc(&self) -> SourceLocation {
1112         self.loc
1113     }
1114 }
1115 
1116 impl<'alloc> SourceLocationAccessor for Function<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1117     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1118         self.loc.start = start.start;
1119         self.loc.end = end.end;
1120     }
1121 
get_loc(&self) -> SourceLocation1122     fn get_loc(&self) -> SourceLocation {
1123         self.loc
1124     }
1125 }
1126 
1127 impl<'alloc> SourceLocationAccessor for FunctionBody<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1128     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1129         self.loc.start = start.start;
1130         self.loc.end = end.end;
1131     }
1132 
get_loc(&self) -> SourceLocation1133     fn get_loc(&self) -> SourceLocation {
1134         self.loc
1135     }
1136 }
1137 
1138 impl<'alloc> SourceLocationAccessor for Getter<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1139     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1140         self.loc.start = start.start;
1141         self.loc.end = end.end;
1142     }
1143 
get_loc(&self) -> SourceLocation1144     fn get_loc(&self) -> SourceLocation {
1145         self.loc
1146     }
1147 }
1148 
1149 impl<'alloc> SourceLocationAccessor for Identifier {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1150     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1151         self.loc.start = start.start;
1152         self.loc.end = end.end;
1153     }
1154 
get_loc(&self) -> SourceLocation1155     fn get_loc(&self) -> SourceLocation {
1156         self.loc
1157     }
1158 }
1159 
1160 impl<'alloc> SourceLocationAccessor for IdentifierExpression {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1161     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1162         self.loc.start = start.start;
1163         self.loc.end = end.end;
1164     }
1165 
get_loc(&self) -> SourceLocation1166     fn get_loc(&self) -> SourceLocation {
1167         self.loc
1168     }
1169 }
1170 
1171 impl<'alloc> SourceLocationAccessor for IdentifierName {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1172     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1173         self.loc.start = start.start;
1174         self.loc.end = end.end;
1175     }
1176 
get_loc(&self) -> SourceLocation1177     fn get_loc(&self) -> SourceLocation {
1178         self.loc
1179     }
1180 }
1181 
1182 impl<'alloc> SourceLocationAccessor for IfStatement<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1183     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1184         self.loc.start = start.start;
1185         self.loc.end = end.end;
1186     }
1187 
get_loc(&self) -> SourceLocation1188     fn get_loc(&self) -> SourceLocation {
1189         self.loc
1190     }
1191 }
1192 
1193 impl<'alloc> SourceLocationAccessor for Import<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1194     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1195         self.loc.start = start.start;
1196         self.loc.end = end.end;
1197     }
1198 
get_loc(&self) -> SourceLocation1199     fn get_loc(&self) -> SourceLocation {
1200         self.loc
1201     }
1202 }
1203 
1204 impl<'alloc> SourceLocationAccessor for ImportDeclaration<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1205     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1206         match self {
1207             ImportDeclaration::Import(content) => { content.set_loc(start, end) }
1208             ImportDeclaration::ImportNamespace(content) => { content.set_loc(start, end) }
1209         }
1210     }
1211 
get_loc(&self) -> SourceLocation1212     fn get_loc(&self) -> SourceLocation {
1213         match self {
1214             ImportDeclaration::Import(content) => { content.get_loc() }
1215             ImportDeclaration::ImportNamespace(content) => { content.get_loc() }
1216         }
1217     }
1218 }
1219 
1220 impl<'alloc> SourceLocationAccessor for ImportNamespace {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1221     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1222         self.loc.start = start.start;
1223         self.loc.end = end.end;
1224     }
1225 
get_loc(&self) -> SourceLocation1226     fn get_loc(&self) -> SourceLocation {
1227         self.loc
1228     }
1229 }
1230 
1231 impl<'alloc> SourceLocationAccessor for ImportSpecifier {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1232     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1233         self.loc.start = start.start;
1234         self.loc.end = end.end;
1235     }
1236 
get_loc(&self) -> SourceLocation1237     fn get_loc(&self) -> SourceLocation {
1238         self.loc
1239     }
1240 }
1241 
1242 impl<'alloc> SourceLocationAccessor for Label {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1243     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1244         self.loc.start = start.start;
1245         self.loc.end = end.end;
1246     }
1247 
get_loc(&self) -> SourceLocation1248     fn get_loc(&self) -> SourceLocation {
1249         self.loc
1250     }
1251 }
1252 
1253 impl<'alloc> SourceLocationAccessor for MemberAssignmentTarget<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1254     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1255         match self {
1256             MemberAssignmentTarget::ComputedMemberAssignmentTarget(content) => { content.set_loc(start, end) }
1257             MemberAssignmentTarget::StaticMemberAssignmentTarget(content) => { content.set_loc(start, end) }
1258         }
1259     }
1260 
get_loc(&self) -> SourceLocation1261     fn get_loc(&self) -> SourceLocation {
1262         match self {
1263             MemberAssignmentTarget::ComputedMemberAssignmentTarget(content) => { content.get_loc() }
1264             MemberAssignmentTarget::StaticMemberAssignmentTarget(content) => { content.get_loc() }
1265         }
1266     }
1267 }
1268 
1269 impl<'alloc> SourceLocationAccessor for MemberExpression<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1270     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1271         match self {
1272             MemberExpression::ComputedMemberExpression(content) => { content.set_loc(start, end) }
1273             MemberExpression::StaticMemberExpression(content) => { content.set_loc(start, end) }
1274             MemberExpression::PrivateFieldExpression(content) => { content.set_loc(start, end) }
1275         }
1276     }
1277 
get_loc(&self) -> SourceLocation1278     fn get_loc(&self) -> SourceLocation {
1279         match self {
1280             MemberExpression::ComputedMemberExpression(content) => { content.get_loc() }
1281             MemberExpression::StaticMemberExpression(content) => { content.get_loc() }
1282             MemberExpression::PrivateFieldExpression(content) => { content.get_loc() }
1283         }
1284     }
1285 }
1286 
1287 impl<'alloc> SourceLocationAccessor for Method<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1288     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1289         self.loc.start = start.start;
1290         self.loc.end = end.end;
1291     }
1292 
get_loc(&self) -> SourceLocation1293     fn get_loc(&self) -> SourceLocation {
1294         self.loc
1295     }
1296 }
1297 
1298 impl<'alloc> SourceLocationAccessor for MethodDefinition<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1299     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1300         match self {
1301             MethodDefinition::Method(content) => { content.set_loc(start, end) }
1302             MethodDefinition::Getter(content) => { content.set_loc(start, end) }
1303             MethodDefinition::Setter(content) => { content.set_loc(start, end) }
1304         }
1305     }
1306 
get_loc(&self) -> SourceLocation1307     fn get_loc(&self) -> SourceLocation {
1308         match self {
1309             MethodDefinition::Method(content) => { content.get_loc() }
1310             MethodDefinition::Getter(content) => { content.get_loc() }
1311             MethodDefinition::Setter(content) => { content.get_loc() }
1312         }
1313     }
1314 }
1315 
1316 impl<'alloc> SourceLocationAccessor for Module<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1317     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1318         self.loc.start = start.start;
1319         self.loc.end = end.end;
1320     }
1321 
get_loc(&self) -> SourceLocation1322     fn get_loc(&self) -> SourceLocation {
1323         self.loc
1324     }
1325 }
1326 
1327 impl<'alloc> SourceLocationAccessor for ModuleItems<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1328     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1329         match self {
1330             ModuleItems::ImportDeclaration(content) => { content.set_loc(start, end) }
1331             ModuleItems::ExportDeclaration(content) => { content.set_loc(start, end) }
1332             ModuleItems::Statement(content) => { content.set_loc(start, end) }
1333         }
1334     }
1335 
get_loc(&self) -> SourceLocation1336     fn get_loc(&self) -> SourceLocation {
1337         match self {
1338             ModuleItems::ImportDeclaration(content) => { content.get_loc() }
1339             ModuleItems::ExportDeclaration(content) => { content.get_loc() }
1340             ModuleItems::Statement(content) => { content.get_loc() }
1341         }
1342     }
1343 }
1344 
1345 impl<'alloc> SourceLocationAccessor for NamedObjectProperty<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1346     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1347         match self {
1348             NamedObjectProperty::MethodDefinition(content) => { content.set_loc(start, end) }
1349             NamedObjectProperty::DataProperty(content) => { content.set_loc(start, end) }
1350         }
1351     }
1352 
get_loc(&self) -> SourceLocation1353     fn get_loc(&self) -> SourceLocation {
1354         match self {
1355             NamedObjectProperty::MethodDefinition(content) => { content.get_loc() }
1356             NamedObjectProperty::DataProperty(content) => { content.get_loc() }
1357         }
1358     }
1359 }
1360 
1361 impl<'alloc> SourceLocationAccessor for NumericLiteral {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1362     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1363         self.loc.start = start.start;
1364         self.loc.end = end.end;
1365     }
1366 
get_loc(&self) -> SourceLocation1367     fn get_loc(&self) -> SourceLocation {
1368         self.loc
1369     }
1370 }
1371 
1372 impl<'alloc> SourceLocationAccessor for ObjectAssignmentTarget<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1373     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1374         self.loc.start = start.start;
1375         self.loc.end = end.end;
1376     }
1377 
get_loc(&self) -> SourceLocation1378     fn get_loc(&self) -> SourceLocation {
1379         self.loc
1380     }
1381 }
1382 
1383 impl<'alloc> SourceLocationAccessor for ObjectBinding<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1384     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1385         self.loc.start = start.start;
1386         self.loc.end = end.end;
1387     }
1388 
get_loc(&self) -> SourceLocation1389     fn get_loc(&self) -> SourceLocation {
1390         self.loc
1391     }
1392 }
1393 
1394 impl<'alloc> SourceLocationAccessor for ObjectExpression<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1395     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1396         self.loc.start = start.start;
1397         self.loc.end = end.end;
1398     }
1399 
get_loc(&self) -> SourceLocation1400     fn get_loc(&self) -> SourceLocation {
1401         self.loc
1402     }
1403 }
1404 
1405 impl<'alloc> SourceLocationAccessor for ObjectProperty<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1406     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1407         match self {
1408             ObjectProperty::NamedObjectProperty(content) => { content.set_loc(start, end) }
1409             ObjectProperty::ShorthandProperty(content) => { content.set_loc(start, end) }
1410             ObjectProperty::SpreadProperty(content) => { content.set_loc(start, end) }
1411         }
1412     }
1413 
get_loc(&self) -> SourceLocation1414     fn get_loc(&self) -> SourceLocation {
1415         match self {
1416             ObjectProperty::NamedObjectProperty(content) => { content.get_loc() }
1417             ObjectProperty::ShorthandProperty(content) => { content.get_loc() }
1418             ObjectProperty::SpreadProperty(content) => { content.get_loc() }
1419         }
1420     }
1421 }
1422 
1423 impl<'alloc> SourceLocationAccessor for OptionalChain<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1424     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1425         match self {
1426             OptionalChain::ComputedMemberExpressionTail { mut loc, .. } => {
1427                 loc.start = start.start;
1428                 loc.end = end.end;
1429             }
1430             OptionalChain::StaticMemberExpressionTail { mut loc, .. } => {
1431                 loc.start = start.start;
1432                 loc.end = end.end;
1433             }
1434             OptionalChain::CallExpressionTail { mut loc, .. } => {
1435                 loc.start = start.start;
1436                 loc.end = end.end;
1437             }
1438             OptionalChain::ComputedMemberExpression(content) => { content.set_loc(start, end) }
1439             OptionalChain::StaticMemberExpression(content) => { content.set_loc(start, end) }
1440             OptionalChain::CallExpression(content) => { content.set_loc(start, end) }
1441         }
1442     }
1443 
get_loc(&self) -> SourceLocation1444     fn get_loc(&self) -> SourceLocation {
1445         match self {
1446             OptionalChain::ComputedMemberExpressionTail { loc, .. } => {
1447                 *loc
1448             }
1449             OptionalChain::StaticMemberExpressionTail { loc, .. } => {
1450                 *loc
1451             }
1452             OptionalChain::CallExpressionTail { loc, .. } => {
1453                 *loc
1454             }
1455             OptionalChain::ComputedMemberExpression(content) => { content.get_loc() }
1456             OptionalChain::StaticMemberExpression(content) => { content.get_loc() }
1457             OptionalChain::CallExpression(content) => { content.get_loc() }
1458         }
1459     }
1460 }
1461 
1462 impl<'alloc> SourceLocationAccessor for Parameter<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1463     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1464         match self {
1465             Parameter::Binding(content) => { content.set_loc(start, end) }
1466             Parameter::BindingWithDefault(content) => { content.set_loc(start, end) }
1467         }
1468     }
1469 
get_loc(&self) -> SourceLocation1470     fn get_loc(&self) -> SourceLocation {
1471         match self {
1472             Parameter::Binding(content) => { content.get_loc() }
1473             Parameter::BindingWithDefault(content) => { content.get_loc() }
1474         }
1475     }
1476 }
1477 
1478 impl<'alloc> SourceLocationAccessor for PrivateFieldExpression<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1479     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1480         self.loc.start = start.start;
1481         self.loc.end = end.end;
1482     }
1483 
get_loc(&self) -> SourceLocation1484     fn get_loc(&self) -> SourceLocation {
1485         self.loc
1486     }
1487 }
1488 
1489 impl<'alloc> SourceLocationAccessor for PrivateIdentifier {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1490     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1491         self.loc.start = start.start;
1492         self.loc.end = end.end;
1493     }
1494 
get_loc(&self) -> SourceLocation1495     fn get_loc(&self) -> SourceLocation {
1496         self.loc
1497     }
1498 }
1499 
1500 impl<'alloc> SourceLocationAccessor for Program<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1501     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1502         match self {
1503             Program::Module(content) => { content.set_loc(start, end) }
1504             Program::Script(content) => { content.set_loc(start, end) }
1505         }
1506     }
1507 
get_loc(&self) -> SourceLocation1508     fn get_loc(&self) -> SourceLocation {
1509         match self {
1510             Program::Module(content) => { content.get_loc() }
1511             Program::Script(content) => { content.get_loc() }
1512         }
1513     }
1514 }
1515 
1516 impl<'alloc> SourceLocationAccessor for PropertyName<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1517     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1518         match self {
1519             PropertyName::ComputedPropertyName(content) => { content.set_loc(start, end) }
1520             PropertyName::StaticPropertyName(content) => { content.set_loc(start, end) }
1521             PropertyName::StaticNumericPropertyName(content) => { content.set_loc(start, end) }
1522         }
1523     }
1524 
get_loc(&self) -> SourceLocation1525     fn get_loc(&self) -> SourceLocation {
1526         match self {
1527             PropertyName::ComputedPropertyName(content) => { content.get_loc() }
1528             PropertyName::StaticPropertyName(content) => { content.get_loc() }
1529             PropertyName::StaticNumericPropertyName(content) => { content.get_loc() }
1530         }
1531     }
1532 }
1533 
1534 impl<'alloc> SourceLocationAccessor for Script<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1535     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1536         self.loc.start = start.start;
1537         self.loc.end = end.end;
1538     }
1539 
get_loc(&self) -> SourceLocation1540     fn get_loc(&self) -> SourceLocation {
1541         self.loc
1542     }
1543 }
1544 
1545 impl<'alloc> SourceLocationAccessor for Setter<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1546     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1547         self.loc.start = start.start;
1548         self.loc.end = end.end;
1549     }
1550 
get_loc(&self) -> SourceLocation1551     fn get_loc(&self) -> SourceLocation {
1552         self.loc
1553     }
1554 }
1555 
1556 impl<'alloc> SourceLocationAccessor for ShorthandProperty {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1557     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1558         self.loc.start = start.start;
1559         self.loc.end = end.end;
1560     }
1561 
get_loc(&self) -> SourceLocation1562     fn get_loc(&self) -> SourceLocation {
1563         self.loc
1564     }
1565 }
1566 
1567 impl<'alloc> SourceLocationAccessor for SimpleAssignmentTarget<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1568     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1569         match self {
1570             SimpleAssignmentTarget::AssignmentTargetIdentifier(content) => { content.set_loc(start, end) }
1571             SimpleAssignmentTarget::MemberAssignmentTarget(content) => { content.set_loc(start, end) }
1572         }
1573     }
1574 
get_loc(&self) -> SourceLocation1575     fn get_loc(&self) -> SourceLocation {
1576         match self {
1577             SimpleAssignmentTarget::AssignmentTargetIdentifier(content) => { content.get_loc() }
1578             SimpleAssignmentTarget::MemberAssignmentTarget(content) => { content.get_loc() }
1579         }
1580     }
1581 }
1582 
1583 impl<'alloc> SourceLocationAccessor for Statement<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1584     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1585         match self {
1586             Statement::BlockStatement { mut loc, .. } => {
1587                 loc.start = start.start;
1588                 loc.end = end.end;
1589             }
1590             Statement::BreakStatement { mut loc, .. } => {
1591                 loc.start = start.start;
1592                 loc.end = end.end;
1593             }
1594             Statement::ContinueStatement { mut loc, .. } => {
1595                 loc.start = start.start;
1596                 loc.end = end.end;
1597             }
1598             Statement::DebuggerStatement { mut loc } => {
1599                 loc.start = start.start;
1600                 loc.end = end.end;
1601             }
1602             Statement::DoWhileStatement { mut loc, .. } => {
1603                 loc.start = start.start;
1604                 loc.end = end.end;
1605             }
1606             Statement::EmptyStatement { mut loc } => {
1607                 loc.start = start.start;
1608                 loc.end = end.end;
1609             }
1610             Statement::ExpressionStatement(content) => { content.set_loc(start, end) }
1611             Statement::ForInStatement { mut loc, .. } => {
1612                 loc.start = start.start;
1613                 loc.end = end.end;
1614             }
1615             Statement::ForOfStatement { mut loc, .. } => {
1616                 loc.start = start.start;
1617                 loc.end = end.end;
1618             }
1619             Statement::ForStatement { mut loc, .. } => {
1620                 loc.start = start.start;
1621                 loc.end = end.end;
1622             }
1623             Statement::IfStatement(content) => { content.set_loc(start, end) }
1624             Statement::LabelledStatement { mut loc, .. } => {
1625                 loc.start = start.start;
1626                 loc.end = end.end;
1627             }
1628             Statement::ReturnStatement { mut loc, .. } => {
1629                 loc.start = start.start;
1630                 loc.end = end.end;
1631             }
1632             Statement::SwitchStatement { mut loc, .. } => {
1633                 loc.start = start.start;
1634                 loc.end = end.end;
1635             }
1636             Statement::SwitchStatementWithDefault { mut loc, .. } => {
1637                 loc.start = start.start;
1638                 loc.end = end.end;
1639             }
1640             Statement::ThrowStatement { mut loc, .. } => {
1641                 loc.start = start.start;
1642                 loc.end = end.end;
1643             }
1644             Statement::TryCatchStatement { mut loc, .. } => {
1645                 loc.start = start.start;
1646                 loc.end = end.end;
1647             }
1648             Statement::TryFinallyStatement { mut loc, .. } => {
1649                 loc.start = start.start;
1650                 loc.end = end.end;
1651             }
1652             Statement::WhileStatement { mut loc, .. } => {
1653                 loc.start = start.start;
1654                 loc.end = end.end;
1655             }
1656             Statement::WithStatement { mut loc, .. } => {
1657                 loc.start = start.start;
1658                 loc.end = end.end;
1659             }
1660             Statement::VariableDeclarationStatement(content) => { content.set_loc(start, end) }
1661             Statement::FunctionDeclaration(content) => { content.set_loc(start, end) }
1662             Statement::ClassDeclaration(content) => { content.set_loc(start, end) }
1663         }
1664     }
1665 
get_loc(&self) -> SourceLocation1666     fn get_loc(&self) -> SourceLocation {
1667         match self {
1668             Statement::BlockStatement { loc, .. } => {
1669                 *loc
1670             }
1671             Statement::BreakStatement { loc, .. } => {
1672                 *loc
1673             }
1674             Statement::ContinueStatement { loc, .. } => {
1675                 *loc
1676             }
1677             Statement::DebuggerStatement { loc } => {
1678                 *loc
1679             }
1680             Statement::DoWhileStatement { loc, .. } => {
1681                 *loc
1682             }
1683             Statement::EmptyStatement { loc } => {
1684                 *loc
1685             }
1686             Statement::ExpressionStatement(content) => { content.get_loc() }
1687             Statement::ForInStatement { loc, .. } => {
1688                 *loc
1689             }
1690             Statement::ForOfStatement { loc, .. } => {
1691                 *loc
1692             }
1693             Statement::ForStatement { loc, .. } => {
1694                 *loc
1695             }
1696             Statement::IfStatement(content) => { content.get_loc() }
1697             Statement::LabelledStatement { loc, .. } => {
1698                 *loc
1699             }
1700             Statement::ReturnStatement { loc, .. } => {
1701                 *loc
1702             }
1703             Statement::SwitchStatement { loc, .. } => {
1704                 *loc
1705             }
1706             Statement::SwitchStatementWithDefault { loc, .. } => {
1707                 *loc
1708             }
1709             Statement::ThrowStatement { loc, .. } => {
1710                 *loc
1711             }
1712             Statement::TryCatchStatement { loc, .. } => {
1713                 *loc
1714             }
1715             Statement::TryFinallyStatement { loc, .. } => {
1716                 *loc
1717             }
1718             Statement::WhileStatement { loc, .. } => {
1719                 *loc
1720             }
1721             Statement::WithStatement { loc, .. } => {
1722                 *loc
1723             }
1724             Statement::VariableDeclarationStatement(content) => { content.get_loc() }
1725             Statement::FunctionDeclaration(content) => { content.get_loc() }
1726             Statement::ClassDeclaration(content) => { content.get_loc() }
1727         }
1728     }
1729 }
1730 
1731 impl<'alloc> SourceLocationAccessor for StaticMemberAssignmentTarget<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1732     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1733         self.loc.start = start.start;
1734         self.loc.end = end.end;
1735     }
1736 
get_loc(&self) -> SourceLocation1737     fn get_loc(&self) -> SourceLocation {
1738         self.loc
1739     }
1740 }
1741 
1742 impl<'alloc> SourceLocationAccessor for StaticMemberExpression<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1743     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1744         self.loc.start = start.start;
1745         self.loc.end = end.end;
1746     }
1747 
get_loc(&self) -> SourceLocation1748     fn get_loc(&self) -> SourceLocation {
1749         self.loc
1750     }
1751 }
1752 
1753 impl<'alloc> SourceLocationAccessor for StaticPropertyName {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1754     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1755         self.loc.start = start.start;
1756         self.loc.end = end.end;
1757     }
1758 
get_loc(&self) -> SourceLocation1759     fn get_loc(&self) -> SourceLocation {
1760         self.loc
1761     }
1762 }
1763 
1764 impl<'alloc> SourceLocationAccessor for SwitchCase<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1765     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1766         self.loc.start = start.start;
1767         self.loc.end = end.end;
1768     }
1769 
get_loc(&self) -> SourceLocation1770     fn get_loc(&self) -> SourceLocation {
1771         self.loc
1772     }
1773 }
1774 
1775 impl<'alloc> SourceLocationAccessor for SwitchDefault<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1776     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1777         self.loc.start = start.start;
1778         self.loc.end = end.end;
1779     }
1780 
get_loc(&self) -> SourceLocation1781     fn get_loc(&self) -> SourceLocation {
1782         self.loc
1783     }
1784 }
1785 
1786 impl<'alloc> SourceLocationAccessor for TemplateElement {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1787     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1788         self.loc.start = start.start;
1789         self.loc.end = end.end;
1790     }
1791 
get_loc(&self) -> SourceLocation1792     fn get_loc(&self) -> SourceLocation {
1793         self.loc
1794     }
1795 }
1796 
1797 impl<'alloc> SourceLocationAccessor for TemplateExpression<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1798     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1799         self.loc.start = start.start;
1800         self.loc.end = end.end;
1801     }
1802 
get_loc(&self) -> SourceLocation1803     fn get_loc(&self) -> SourceLocation {
1804         self.loc
1805     }
1806 }
1807 
1808 impl<'alloc> SourceLocationAccessor for TemplateExpressionElement<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1809     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1810         match self {
1811             TemplateExpressionElement::Expression(content) => { content.set_loc(start, end) }
1812             TemplateExpressionElement::TemplateElement(content) => { content.set_loc(start, end) }
1813         }
1814     }
1815 
get_loc(&self) -> SourceLocation1816     fn get_loc(&self) -> SourceLocation {
1817         match self {
1818             TemplateExpressionElement::Expression(content) => { content.get_loc() }
1819             TemplateExpressionElement::TemplateElement(content) => { content.get_loc() }
1820         }
1821     }
1822 }
1823 
1824 impl<'alloc> SourceLocationAccessor for UnaryOperator {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1825     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1826         match self {
1827             UnaryOperator::Plus { mut loc } => {
1828                 loc.start = start.start;
1829                 loc.end = end.end;
1830             }
1831             UnaryOperator::Minus { mut loc } => {
1832                 loc.start = start.start;
1833                 loc.end = end.end;
1834             }
1835             UnaryOperator::LogicalNot { mut loc } => {
1836                 loc.start = start.start;
1837                 loc.end = end.end;
1838             }
1839             UnaryOperator::BitwiseNot { mut loc } => {
1840                 loc.start = start.start;
1841                 loc.end = end.end;
1842             }
1843             UnaryOperator::Typeof { mut loc } => {
1844                 loc.start = start.start;
1845                 loc.end = end.end;
1846             }
1847             UnaryOperator::Void { mut loc } => {
1848                 loc.start = start.start;
1849                 loc.end = end.end;
1850             }
1851             UnaryOperator::Delete { mut loc } => {
1852                 loc.start = start.start;
1853                 loc.end = end.end;
1854             }
1855         }
1856     }
1857 
get_loc(&self) -> SourceLocation1858     fn get_loc(&self) -> SourceLocation {
1859         match self {
1860             UnaryOperator::Plus { loc } => {
1861                 *loc
1862             }
1863             UnaryOperator::Minus { loc } => {
1864                 *loc
1865             }
1866             UnaryOperator::LogicalNot { loc } => {
1867                 *loc
1868             }
1869             UnaryOperator::BitwiseNot { loc } => {
1870                 *loc
1871             }
1872             UnaryOperator::Typeof { loc } => {
1873                 *loc
1874             }
1875             UnaryOperator::Void { loc } => {
1876                 *loc
1877             }
1878             UnaryOperator::Delete { loc } => {
1879                 *loc
1880             }
1881         }
1882     }
1883 }
1884 
1885 impl<'alloc> SourceLocationAccessor for UpdateOperator {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1886     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1887         match self {
1888             UpdateOperator::Increment { mut loc } => {
1889                 loc.start = start.start;
1890                 loc.end = end.end;
1891             }
1892             UpdateOperator::Decrement { mut loc } => {
1893                 loc.start = start.start;
1894                 loc.end = end.end;
1895             }
1896         }
1897     }
1898 
get_loc(&self) -> SourceLocation1899     fn get_loc(&self) -> SourceLocation {
1900         match self {
1901             UpdateOperator::Increment { loc } => {
1902                 *loc
1903             }
1904             UpdateOperator::Decrement { loc } => {
1905                 *loc
1906             }
1907         }
1908     }
1909 }
1910 
1911 impl<'alloc> SourceLocationAccessor for VariableDeclaration<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1912     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1913         self.loc.start = start.start;
1914         self.loc.end = end.end;
1915     }
1916 
get_loc(&self) -> SourceLocation1917     fn get_loc(&self) -> SourceLocation {
1918         self.loc
1919     }
1920 }
1921 
1922 impl<'alloc> SourceLocationAccessor for VariableDeclarationKind {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1923     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1924         match self {
1925             VariableDeclarationKind::Var { mut loc } => {
1926                 loc.start = start.start;
1927                 loc.end = end.end;
1928             }
1929             VariableDeclarationKind::Let { mut loc } => {
1930                 loc.start = start.start;
1931                 loc.end = end.end;
1932             }
1933             VariableDeclarationKind::Const { mut loc } => {
1934                 loc.start = start.start;
1935                 loc.end = end.end;
1936             }
1937         }
1938     }
1939 
get_loc(&self) -> SourceLocation1940     fn get_loc(&self) -> SourceLocation {
1941         match self {
1942             VariableDeclarationKind::Var { loc } => {
1943                 *loc
1944             }
1945             VariableDeclarationKind::Let { loc } => {
1946                 *loc
1947             }
1948             VariableDeclarationKind::Const { loc } => {
1949                 *loc
1950             }
1951         }
1952     }
1953 }
1954 
1955 impl<'alloc> SourceLocationAccessor for VariableDeclarationOrAssignmentTarget<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1956     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1957         match self {
1958             VariableDeclarationOrAssignmentTarget::VariableDeclaration(content) => { content.set_loc(start, end) }
1959             VariableDeclarationOrAssignmentTarget::AssignmentTarget(content) => { content.set_loc(start, end) }
1960         }
1961     }
1962 
get_loc(&self) -> SourceLocation1963     fn get_loc(&self) -> SourceLocation {
1964         match self {
1965             VariableDeclarationOrAssignmentTarget::VariableDeclaration(content) => { content.get_loc() }
1966             VariableDeclarationOrAssignmentTarget::AssignmentTarget(content) => { content.get_loc() }
1967         }
1968     }
1969 }
1970 
1971 impl<'alloc> SourceLocationAccessor for VariableDeclarationOrExpression<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1972     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1973         match self {
1974             VariableDeclarationOrExpression::VariableDeclaration(content) => { content.set_loc(start, end) }
1975             VariableDeclarationOrExpression::Expression(content) => { content.set_loc(start, end) }
1976         }
1977     }
1978 
get_loc(&self) -> SourceLocation1979     fn get_loc(&self) -> SourceLocation {
1980         match self {
1981             VariableDeclarationOrExpression::VariableDeclaration(content) => { content.get_loc() }
1982             VariableDeclarationOrExpression::Expression(content) => { content.get_loc() }
1983         }
1984     }
1985 }
1986 
1987 impl<'alloc> SourceLocationAccessor for VariableDeclarator<'alloc> {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1988     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
1989         self.loc.start = start.start;
1990         self.loc.end = end.end;
1991     }
1992 
get_loc(&self) -> SourceLocation1993     fn get_loc(&self) -> SourceLocation {
1994         self.loc
1995     }
1996 }
1997 
1998 impl<'alloc> SourceLocationAccessor for VariableReference {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)1999     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
2000         match self {
2001             VariableReference::BindingIdentifier(content) => { content.set_loc(start, end) }
2002             VariableReference::AssignmentTargetIdentifier(content) => { content.set_loc(start, end) }
2003         }
2004     }
2005 
get_loc(&self) -> SourceLocation2006     fn get_loc(&self) -> SourceLocation {
2007         match self {
2008             VariableReference::BindingIdentifier(content) => { content.get_loc() }
2009             VariableReference::AssignmentTargetIdentifier(content) => { content.get_loc() }
2010         }
2011     }
2012 }
2013 
2014 impl<'alloc, T> SourceLocationAccessor for arena::Box<'alloc, T>
2015 where
2016     T: SourceLocationAccessor,
2017 {
set_loc(&mut self, start: SourceLocation, end: SourceLocation)2018     fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) {
2019         (self.borrow_mut() as &mut T).set_loc(start, end)
2020     }
2021 
get_loc(&self) -> SourceLocation2022     fn get_loc(&self) -> SourceLocation {
2023         (self.borrow() as &T).get_loc()
2024     }
2025 }
2026