( pattern: Node, kind: BindingKind, declaration: Node, parent: Node, scope = this.scope )
| 518 | } |
| 519 | |
| 520 | private bindPattern( |
| 521 | pattern: Node, |
| 522 | kind: BindingKind, |
| 523 | declaration: Node, |
| 524 | parent: Node, |
| 525 | scope = this.scope |
| 526 | ): void { |
| 527 | pattern.parent = parent |
| 528 | switch (pattern.type) { |
| 529 | case "Identifier": |
| 530 | if (pattern.name === "this") return |
| 531 | return this.bind(pattern, kind, declaration, parent, scope) |
| 532 | case "ObjectPattern": |
| 533 | for (const property of pattern.properties) { |
| 534 | property.parent = pattern |
| 535 | if (property.type === "RestElement") { |
| 536 | this.bindPattern( |
| 537 | property.argument, |
| 538 | kind, |
| 539 | declaration, |
| 540 | property, |
| 541 | scope |
| 542 | ) |
| 543 | } else { |
| 544 | if (property.computed) this.visit(property.key, property) |
| 545 | else property.key.parent = property |
| 546 | this.bindPattern(property.value, kind, declaration, property, scope) |
| 547 | } |
| 548 | } |
| 549 | return |
| 550 | case "ArrayPattern": |
| 551 | for (const element of pattern.elements) { |
| 552 | if (element) |
| 553 | this.bindPattern(element, kind, declaration, pattern, scope) |
| 554 | } |
| 555 | return |
| 556 | case "AssignmentPattern": |
| 557 | this.bindPattern(pattern.left, kind, declaration, pattern, scope) |
| 558 | return this.visit(pattern.right, pattern) |
| 559 | case "RestElement": |
| 560 | return this.bindPattern( |
| 561 | pattern.argument, |
| 562 | kind, |
| 563 | declaration, |
| 564 | pattern, |
| 565 | scope |
| 566 | ) |
| 567 | case "TSParameterProperty": |
| 568 | return this.bindPattern( |
| 569 | pattern.parameter, |
| 570 | kind, |
| 571 | declaration, |
| 572 | pattern, |
| 573 | scope |
| 574 | ) |
| 575 | } |
| 576 | } |
| 577 |
no test coverage detected