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::PrivateFieldAssignmentTarget(content) => { content.set_loc(start, end) } 1258 MemberAssignmentTarget::StaticMemberAssignmentTarget(content) => { content.set_loc(start, end) } 1259 } 1260 } 1261 get_loc(&self) -> SourceLocation1262 fn get_loc(&self) -> SourceLocation { 1263 match self { 1264 MemberAssignmentTarget::ComputedMemberAssignmentTarget(content) => { content.get_loc() } 1265 MemberAssignmentTarget::PrivateFieldAssignmentTarget(content) => { content.get_loc() } 1266 MemberAssignmentTarget::StaticMemberAssignmentTarget(content) => { content.get_loc() } 1267 } 1268 } 1269 } 1270 1271 impl<'alloc> SourceLocationAccessor for MemberExpression<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1272 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1273 match self { 1274 MemberExpression::ComputedMemberExpression(content) => { content.set_loc(start, end) } 1275 MemberExpression::StaticMemberExpression(content) => { content.set_loc(start, end) } 1276 MemberExpression::PrivateFieldExpression(content) => { content.set_loc(start, end) } 1277 } 1278 } 1279 get_loc(&self) -> SourceLocation1280 fn get_loc(&self) -> SourceLocation { 1281 match self { 1282 MemberExpression::ComputedMemberExpression(content) => { content.get_loc() } 1283 MemberExpression::StaticMemberExpression(content) => { content.get_loc() } 1284 MemberExpression::PrivateFieldExpression(content) => { content.get_loc() } 1285 } 1286 } 1287 } 1288 1289 impl<'alloc> SourceLocationAccessor for Method<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1290 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1291 self.loc.start = start.start; 1292 self.loc.end = end.end; 1293 } 1294 get_loc(&self) -> SourceLocation1295 fn get_loc(&self) -> SourceLocation { 1296 self.loc 1297 } 1298 } 1299 1300 impl<'alloc> SourceLocationAccessor for MethodDefinition<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1301 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1302 match self { 1303 MethodDefinition::Method(content) => { content.set_loc(start, end) } 1304 MethodDefinition::Getter(content) => { content.set_loc(start, end) } 1305 MethodDefinition::Setter(content) => { content.set_loc(start, end) } 1306 } 1307 } 1308 get_loc(&self) -> SourceLocation1309 fn get_loc(&self) -> SourceLocation { 1310 match self { 1311 MethodDefinition::Method(content) => { content.get_loc() } 1312 MethodDefinition::Getter(content) => { content.get_loc() } 1313 MethodDefinition::Setter(content) => { content.get_loc() } 1314 } 1315 } 1316 } 1317 1318 impl<'alloc> SourceLocationAccessor for Module<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1319 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1320 self.loc.start = start.start; 1321 self.loc.end = end.end; 1322 } 1323 get_loc(&self) -> SourceLocation1324 fn get_loc(&self) -> SourceLocation { 1325 self.loc 1326 } 1327 } 1328 1329 impl<'alloc> SourceLocationAccessor for ModuleItems<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1330 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1331 match self { 1332 ModuleItems::ImportDeclaration(content) => { content.set_loc(start, end) } 1333 ModuleItems::ExportDeclaration(content) => { content.set_loc(start, end) } 1334 ModuleItems::Statement(content) => { content.set_loc(start, end) } 1335 } 1336 } 1337 get_loc(&self) -> SourceLocation1338 fn get_loc(&self) -> SourceLocation { 1339 match self { 1340 ModuleItems::ImportDeclaration(content) => { content.get_loc() } 1341 ModuleItems::ExportDeclaration(content) => { content.get_loc() } 1342 ModuleItems::Statement(content) => { content.get_loc() } 1343 } 1344 } 1345 } 1346 1347 impl<'alloc> SourceLocationAccessor for NamedObjectProperty<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1348 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1349 match self { 1350 NamedObjectProperty::MethodDefinition(content) => { content.set_loc(start, end) } 1351 NamedObjectProperty::DataProperty(content) => { content.set_loc(start, end) } 1352 } 1353 } 1354 get_loc(&self) -> SourceLocation1355 fn get_loc(&self) -> SourceLocation { 1356 match self { 1357 NamedObjectProperty::MethodDefinition(content) => { content.get_loc() } 1358 NamedObjectProperty::DataProperty(content) => { content.get_loc() } 1359 } 1360 } 1361 } 1362 1363 impl<'alloc> SourceLocationAccessor for NumericLiteral { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1364 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1365 self.loc.start = start.start; 1366 self.loc.end = end.end; 1367 } 1368 get_loc(&self) -> SourceLocation1369 fn get_loc(&self) -> SourceLocation { 1370 self.loc 1371 } 1372 } 1373 1374 impl<'alloc> SourceLocationAccessor for ObjectAssignmentTarget<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1375 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1376 self.loc.start = start.start; 1377 self.loc.end = end.end; 1378 } 1379 get_loc(&self) -> SourceLocation1380 fn get_loc(&self) -> SourceLocation { 1381 self.loc 1382 } 1383 } 1384 1385 impl<'alloc> SourceLocationAccessor for ObjectBinding<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1386 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1387 self.loc.start = start.start; 1388 self.loc.end = end.end; 1389 } 1390 get_loc(&self) -> SourceLocation1391 fn get_loc(&self) -> SourceLocation { 1392 self.loc 1393 } 1394 } 1395 1396 impl<'alloc> SourceLocationAccessor for ObjectExpression<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1397 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1398 self.loc.start = start.start; 1399 self.loc.end = end.end; 1400 } 1401 get_loc(&self) -> SourceLocation1402 fn get_loc(&self) -> SourceLocation { 1403 self.loc 1404 } 1405 } 1406 1407 impl<'alloc> SourceLocationAccessor for ObjectProperty<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1408 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1409 match self { 1410 ObjectProperty::NamedObjectProperty(content) => { content.set_loc(start, end) } 1411 ObjectProperty::ShorthandProperty(content) => { content.set_loc(start, end) } 1412 ObjectProperty::SpreadProperty(content) => { content.set_loc(start, end) } 1413 } 1414 } 1415 get_loc(&self) -> SourceLocation1416 fn get_loc(&self) -> SourceLocation { 1417 match self { 1418 ObjectProperty::NamedObjectProperty(content) => { content.get_loc() } 1419 ObjectProperty::ShorthandProperty(content) => { content.get_loc() } 1420 ObjectProperty::SpreadProperty(content) => { content.get_loc() } 1421 } 1422 } 1423 } 1424 1425 impl<'alloc> SourceLocationAccessor for OptionalChain<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1426 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1427 match self { 1428 OptionalChain::ComputedMemberExpressionTail { mut loc, .. } => { 1429 loc.start = start.start; 1430 loc.end = end.end; 1431 } 1432 OptionalChain::StaticMemberExpressionTail { mut loc, .. } => { 1433 loc.start = start.start; 1434 loc.end = end.end; 1435 } 1436 OptionalChain::PrivateFieldExpressionTail { mut loc, .. } => { 1437 loc.start = start.start; 1438 loc.end = end.end; 1439 } 1440 OptionalChain::CallExpressionTail { mut loc, .. } => { 1441 loc.start = start.start; 1442 loc.end = end.end; 1443 } 1444 OptionalChain::ComputedMemberExpression(content) => { content.set_loc(start, end) } 1445 OptionalChain::StaticMemberExpression(content) => { content.set_loc(start, end) } 1446 OptionalChain::PrivateFieldExpression(content) => { content.set_loc(start, end) } 1447 OptionalChain::CallExpression(content) => { content.set_loc(start, end) } 1448 } 1449 } 1450 get_loc(&self) -> SourceLocation1451 fn get_loc(&self) -> SourceLocation { 1452 match self { 1453 OptionalChain::ComputedMemberExpressionTail { loc, .. } => { 1454 *loc 1455 } 1456 OptionalChain::StaticMemberExpressionTail { loc, .. } => { 1457 *loc 1458 } 1459 OptionalChain::PrivateFieldExpressionTail { loc, .. } => { 1460 *loc 1461 } 1462 OptionalChain::CallExpressionTail { loc, .. } => { 1463 *loc 1464 } 1465 OptionalChain::ComputedMemberExpression(content) => { content.get_loc() } 1466 OptionalChain::StaticMemberExpression(content) => { content.get_loc() } 1467 OptionalChain::PrivateFieldExpression(content) => { content.get_loc() } 1468 OptionalChain::CallExpression(content) => { content.get_loc() } 1469 } 1470 } 1471 } 1472 1473 impl<'alloc> SourceLocationAccessor for Parameter<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1474 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1475 match self { 1476 Parameter::Binding(content) => { content.set_loc(start, end) } 1477 Parameter::BindingWithDefault(content) => { content.set_loc(start, end) } 1478 } 1479 } 1480 get_loc(&self) -> SourceLocation1481 fn get_loc(&self) -> SourceLocation { 1482 match self { 1483 Parameter::Binding(content) => { content.get_loc() } 1484 Parameter::BindingWithDefault(content) => { content.get_loc() } 1485 } 1486 } 1487 } 1488 1489 impl<'alloc> SourceLocationAccessor for PrivateFieldAssignmentTarget<'alloc> { 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 PrivateFieldExpression<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1501 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1502 self.loc.start = start.start; 1503 self.loc.end = end.end; 1504 } 1505 get_loc(&self) -> SourceLocation1506 fn get_loc(&self) -> SourceLocation { 1507 self.loc 1508 } 1509 } 1510 1511 impl<'alloc> SourceLocationAccessor for PrivateIdentifier { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1512 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1513 self.loc.start = start.start; 1514 self.loc.end = end.end; 1515 } 1516 get_loc(&self) -> SourceLocation1517 fn get_loc(&self) -> SourceLocation { 1518 self.loc 1519 } 1520 } 1521 1522 impl<'alloc> SourceLocationAccessor for Program<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1523 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1524 match self { 1525 Program::Module(content) => { content.set_loc(start, end) } 1526 Program::Script(content) => { content.set_loc(start, end) } 1527 } 1528 } 1529 get_loc(&self) -> SourceLocation1530 fn get_loc(&self) -> SourceLocation { 1531 match self { 1532 Program::Module(content) => { content.get_loc() } 1533 Program::Script(content) => { content.get_loc() } 1534 } 1535 } 1536 } 1537 1538 impl<'alloc> SourceLocationAccessor for PropertyName<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1539 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1540 match self { 1541 PropertyName::ComputedPropertyName(content) => { content.set_loc(start, end) } 1542 PropertyName::StaticPropertyName(content) => { content.set_loc(start, end) } 1543 PropertyName::StaticNumericPropertyName(content) => { content.set_loc(start, end) } 1544 } 1545 } 1546 get_loc(&self) -> SourceLocation1547 fn get_loc(&self) -> SourceLocation { 1548 match self { 1549 PropertyName::ComputedPropertyName(content) => { content.get_loc() } 1550 PropertyName::StaticPropertyName(content) => { content.get_loc() } 1551 PropertyName::StaticNumericPropertyName(content) => { content.get_loc() } 1552 } 1553 } 1554 } 1555 1556 impl<'alloc> SourceLocationAccessor for Script<'alloc> { 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 Setter<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1568 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1569 self.loc.start = start.start; 1570 self.loc.end = end.end; 1571 } 1572 get_loc(&self) -> SourceLocation1573 fn get_loc(&self) -> SourceLocation { 1574 self.loc 1575 } 1576 } 1577 1578 impl<'alloc> SourceLocationAccessor for ShorthandProperty { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1579 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1580 self.loc.start = start.start; 1581 self.loc.end = end.end; 1582 } 1583 get_loc(&self) -> SourceLocation1584 fn get_loc(&self) -> SourceLocation { 1585 self.loc 1586 } 1587 } 1588 1589 impl<'alloc> SourceLocationAccessor for SimpleAssignmentTarget<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1590 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1591 match self { 1592 SimpleAssignmentTarget::AssignmentTargetIdentifier(content) => { content.set_loc(start, end) } 1593 SimpleAssignmentTarget::MemberAssignmentTarget(content) => { content.set_loc(start, end) } 1594 } 1595 } 1596 get_loc(&self) -> SourceLocation1597 fn get_loc(&self) -> SourceLocation { 1598 match self { 1599 SimpleAssignmentTarget::AssignmentTargetIdentifier(content) => { content.get_loc() } 1600 SimpleAssignmentTarget::MemberAssignmentTarget(content) => { content.get_loc() } 1601 } 1602 } 1603 } 1604 1605 impl<'alloc> SourceLocationAccessor for Statement<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1606 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1607 match self { 1608 Statement::BlockStatement { mut loc, .. } => { 1609 loc.start = start.start; 1610 loc.end = end.end; 1611 } 1612 Statement::BreakStatement { mut loc, .. } => { 1613 loc.start = start.start; 1614 loc.end = end.end; 1615 } 1616 Statement::ContinueStatement { mut loc, .. } => { 1617 loc.start = start.start; 1618 loc.end = end.end; 1619 } 1620 Statement::DebuggerStatement { mut loc } => { 1621 loc.start = start.start; 1622 loc.end = end.end; 1623 } 1624 Statement::DoWhileStatement { mut loc, .. } => { 1625 loc.start = start.start; 1626 loc.end = end.end; 1627 } 1628 Statement::EmptyStatement { mut loc } => { 1629 loc.start = start.start; 1630 loc.end = end.end; 1631 } 1632 Statement::ExpressionStatement(content) => { content.set_loc(start, end) } 1633 Statement::ForInStatement { mut loc, .. } => { 1634 loc.start = start.start; 1635 loc.end = end.end; 1636 } 1637 Statement::ForOfStatement { mut loc, .. } => { 1638 loc.start = start.start; 1639 loc.end = end.end; 1640 } 1641 Statement::ForStatement { mut loc, .. } => { 1642 loc.start = start.start; 1643 loc.end = end.end; 1644 } 1645 Statement::IfStatement(content) => { content.set_loc(start, end) } 1646 Statement::LabelledStatement { mut loc, .. } => { 1647 loc.start = start.start; 1648 loc.end = end.end; 1649 } 1650 Statement::ReturnStatement { mut loc, .. } => { 1651 loc.start = start.start; 1652 loc.end = end.end; 1653 } 1654 Statement::SwitchStatement { mut loc, .. } => { 1655 loc.start = start.start; 1656 loc.end = end.end; 1657 } 1658 Statement::SwitchStatementWithDefault { mut loc, .. } => { 1659 loc.start = start.start; 1660 loc.end = end.end; 1661 } 1662 Statement::ThrowStatement { mut loc, .. } => { 1663 loc.start = start.start; 1664 loc.end = end.end; 1665 } 1666 Statement::TryCatchStatement { mut loc, .. } => { 1667 loc.start = start.start; 1668 loc.end = end.end; 1669 } 1670 Statement::TryFinallyStatement { mut loc, .. } => { 1671 loc.start = start.start; 1672 loc.end = end.end; 1673 } 1674 Statement::WhileStatement { mut loc, .. } => { 1675 loc.start = start.start; 1676 loc.end = end.end; 1677 } 1678 Statement::WithStatement { mut loc, .. } => { 1679 loc.start = start.start; 1680 loc.end = end.end; 1681 } 1682 Statement::VariableDeclarationStatement(content) => { content.set_loc(start, end) } 1683 Statement::FunctionDeclaration(content) => { content.set_loc(start, end) } 1684 Statement::ClassDeclaration(content) => { content.set_loc(start, end) } 1685 } 1686 } 1687 get_loc(&self) -> SourceLocation1688 fn get_loc(&self) -> SourceLocation { 1689 match self { 1690 Statement::BlockStatement { loc, .. } => { 1691 *loc 1692 } 1693 Statement::BreakStatement { loc, .. } => { 1694 *loc 1695 } 1696 Statement::ContinueStatement { loc, .. } => { 1697 *loc 1698 } 1699 Statement::DebuggerStatement { loc } => { 1700 *loc 1701 } 1702 Statement::DoWhileStatement { loc, .. } => { 1703 *loc 1704 } 1705 Statement::EmptyStatement { loc } => { 1706 *loc 1707 } 1708 Statement::ExpressionStatement(content) => { content.get_loc() } 1709 Statement::ForInStatement { loc, .. } => { 1710 *loc 1711 } 1712 Statement::ForOfStatement { loc, .. } => { 1713 *loc 1714 } 1715 Statement::ForStatement { loc, .. } => { 1716 *loc 1717 } 1718 Statement::IfStatement(content) => { content.get_loc() } 1719 Statement::LabelledStatement { loc, .. } => { 1720 *loc 1721 } 1722 Statement::ReturnStatement { loc, .. } => { 1723 *loc 1724 } 1725 Statement::SwitchStatement { loc, .. } => { 1726 *loc 1727 } 1728 Statement::SwitchStatementWithDefault { loc, .. } => { 1729 *loc 1730 } 1731 Statement::ThrowStatement { loc, .. } => { 1732 *loc 1733 } 1734 Statement::TryCatchStatement { loc, .. } => { 1735 *loc 1736 } 1737 Statement::TryFinallyStatement { loc, .. } => { 1738 *loc 1739 } 1740 Statement::WhileStatement { loc, .. } => { 1741 *loc 1742 } 1743 Statement::WithStatement { loc, .. } => { 1744 *loc 1745 } 1746 Statement::VariableDeclarationStatement(content) => { content.get_loc() } 1747 Statement::FunctionDeclaration(content) => { content.get_loc() } 1748 Statement::ClassDeclaration(content) => { content.get_loc() } 1749 } 1750 } 1751 } 1752 1753 impl<'alloc> SourceLocationAccessor for StaticMemberAssignmentTarget<'alloc> { 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 StaticMemberExpression<'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 StaticPropertyName { 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 SwitchCase<'alloc> { 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 SwitchDefault<'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 TemplateElement { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1809 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1810 self.loc.start = start.start; 1811 self.loc.end = end.end; 1812 } 1813 get_loc(&self) -> SourceLocation1814 fn get_loc(&self) -> SourceLocation { 1815 self.loc 1816 } 1817 } 1818 1819 impl<'alloc> SourceLocationAccessor for TemplateExpression<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1820 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1821 self.loc.start = start.start; 1822 self.loc.end = end.end; 1823 } 1824 get_loc(&self) -> SourceLocation1825 fn get_loc(&self) -> SourceLocation { 1826 self.loc 1827 } 1828 } 1829 1830 impl<'alloc> SourceLocationAccessor for TemplateExpressionElement<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1831 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1832 match self { 1833 TemplateExpressionElement::Expression(content) => { content.set_loc(start, end) } 1834 TemplateExpressionElement::TemplateElement(content) => { content.set_loc(start, end) } 1835 } 1836 } 1837 get_loc(&self) -> SourceLocation1838 fn get_loc(&self) -> SourceLocation { 1839 match self { 1840 TemplateExpressionElement::Expression(content) => { content.get_loc() } 1841 TemplateExpressionElement::TemplateElement(content) => { content.get_loc() } 1842 } 1843 } 1844 } 1845 1846 impl<'alloc> SourceLocationAccessor for UnaryOperator { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1847 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1848 match self { 1849 UnaryOperator::Plus { mut loc } => { 1850 loc.start = start.start; 1851 loc.end = end.end; 1852 } 1853 UnaryOperator::Minus { mut loc } => { 1854 loc.start = start.start; 1855 loc.end = end.end; 1856 } 1857 UnaryOperator::LogicalNot { mut loc } => { 1858 loc.start = start.start; 1859 loc.end = end.end; 1860 } 1861 UnaryOperator::BitwiseNot { mut loc } => { 1862 loc.start = start.start; 1863 loc.end = end.end; 1864 } 1865 UnaryOperator::Typeof { mut loc } => { 1866 loc.start = start.start; 1867 loc.end = end.end; 1868 } 1869 UnaryOperator::Void { mut loc } => { 1870 loc.start = start.start; 1871 loc.end = end.end; 1872 } 1873 UnaryOperator::Delete { mut loc } => { 1874 loc.start = start.start; 1875 loc.end = end.end; 1876 } 1877 } 1878 } 1879 get_loc(&self) -> SourceLocation1880 fn get_loc(&self) -> SourceLocation { 1881 match self { 1882 UnaryOperator::Plus { loc } => { 1883 *loc 1884 } 1885 UnaryOperator::Minus { loc } => { 1886 *loc 1887 } 1888 UnaryOperator::LogicalNot { loc } => { 1889 *loc 1890 } 1891 UnaryOperator::BitwiseNot { loc } => { 1892 *loc 1893 } 1894 UnaryOperator::Typeof { loc } => { 1895 *loc 1896 } 1897 UnaryOperator::Void { loc } => { 1898 *loc 1899 } 1900 UnaryOperator::Delete { loc } => { 1901 *loc 1902 } 1903 } 1904 } 1905 } 1906 1907 impl<'alloc> SourceLocationAccessor for UpdateOperator { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1908 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1909 match self { 1910 UpdateOperator::Increment { mut loc } => { 1911 loc.start = start.start; 1912 loc.end = end.end; 1913 } 1914 UpdateOperator::Decrement { mut loc } => { 1915 loc.start = start.start; 1916 loc.end = end.end; 1917 } 1918 } 1919 } 1920 get_loc(&self) -> SourceLocation1921 fn get_loc(&self) -> SourceLocation { 1922 match self { 1923 UpdateOperator::Increment { loc } => { 1924 *loc 1925 } 1926 UpdateOperator::Decrement { loc } => { 1927 *loc 1928 } 1929 } 1930 } 1931 } 1932 1933 impl<'alloc> SourceLocationAccessor for VariableDeclaration<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1934 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1935 self.loc.start = start.start; 1936 self.loc.end = end.end; 1937 } 1938 get_loc(&self) -> SourceLocation1939 fn get_loc(&self) -> SourceLocation { 1940 self.loc 1941 } 1942 } 1943 1944 impl<'alloc> SourceLocationAccessor for VariableDeclarationKind { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1945 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1946 match self { 1947 VariableDeclarationKind::Var { mut loc } => { 1948 loc.start = start.start; 1949 loc.end = end.end; 1950 } 1951 VariableDeclarationKind::Let { mut loc } => { 1952 loc.start = start.start; 1953 loc.end = end.end; 1954 } 1955 VariableDeclarationKind::Const { mut loc } => { 1956 loc.start = start.start; 1957 loc.end = end.end; 1958 } 1959 } 1960 } 1961 get_loc(&self) -> SourceLocation1962 fn get_loc(&self) -> SourceLocation { 1963 match self { 1964 VariableDeclarationKind::Var { loc } => { 1965 *loc 1966 } 1967 VariableDeclarationKind::Let { loc } => { 1968 *loc 1969 } 1970 VariableDeclarationKind::Const { loc } => { 1971 *loc 1972 } 1973 } 1974 } 1975 } 1976 1977 impl<'alloc> SourceLocationAccessor for VariableDeclarationOrAssignmentTarget<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1978 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1979 match self { 1980 VariableDeclarationOrAssignmentTarget::VariableDeclaration(content) => { content.set_loc(start, end) } 1981 VariableDeclarationOrAssignmentTarget::AssignmentTarget(content) => { content.set_loc(start, end) } 1982 } 1983 } 1984 get_loc(&self) -> SourceLocation1985 fn get_loc(&self) -> SourceLocation { 1986 match self { 1987 VariableDeclarationOrAssignmentTarget::VariableDeclaration(content) => { content.get_loc() } 1988 VariableDeclarationOrAssignmentTarget::AssignmentTarget(content) => { content.get_loc() } 1989 } 1990 } 1991 } 1992 1993 impl<'alloc> SourceLocationAccessor for VariableDeclarationOrExpression<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)1994 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 1995 match self { 1996 VariableDeclarationOrExpression::VariableDeclaration(content) => { content.set_loc(start, end) } 1997 VariableDeclarationOrExpression::Expression(content) => { content.set_loc(start, end) } 1998 } 1999 } 2000 get_loc(&self) -> SourceLocation2001 fn get_loc(&self) -> SourceLocation { 2002 match self { 2003 VariableDeclarationOrExpression::VariableDeclaration(content) => { content.get_loc() } 2004 VariableDeclarationOrExpression::Expression(content) => { content.get_loc() } 2005 } 2006 } 2007 } 2008 2009 impl<'alloc> SourceLocationAccessor for VariableDeclarator<'alloc> { set_loc(&mut self, start: SourceLocation, end: SourceLocation)2010 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 2011 self.loc.start = start.start; 2012 self.loc.end = end.end; 2013 } 2014 get_loc(&self) -> SourceLocation2015 fn get_loc(&self) -> SourceLocation { 2016 self.loc 2017 } 2018 } 2019 2020 impl<'alloc> SourceLocationAccessor for VariableReference { set_loc(&mut self, start: SourceLocation, end: SourceLocation)2021 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 2022 match self { 2023 VariableReference::BindingIdentifier(content) => { content.set_loc(start, end) } 2024 VariableReference::AssignmentTargetIdentifier(content) => { content.set_loc(start, end) } 2025 } 2026 } 2027 get_loc(&self) -> SourceLocation2028 fn get_loc(&self) -> SourceLocation { 2029 match self { 2030 VariableReference::BindingIdentifier(content) => { content.get_loc() } 2031 VariableReference::AssignmentTargetIdentifier(content) => { content.get_loc() } 2032 } 2033 } 2034 } 2035 2036 impl<'alloc, T> SourceLocationAccessor for arena::Box<'alloc, T> 2037 where 2038 T: SourceLocationAccessor, 2039 { set_loc(&mut self, start: SourceLocation, end: SourceLocation)2040 fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { 2041 (self.borrow_mut() as &mut T).set_loc(start, end) 2042 } 2043 get_loc(&self) -> SourceLocation2044 fn get_loc(&self) -> SourceLocation { 2045 (self.borrow() as &T).get_loc() 2046 } 2047 } 2048