()
| 709 | } |
| 710 | |
| 711 | parseArrayInitializer(): Node.ArrayExpression { |
| 712 | const node = this.createNode(); |
| 713 | const elements: Node.ArrayExpressionElement[] = []; |
| 714 | |
| 715 | this.expect('['); |
| 716 | while (!this.match(']')) { |
| 717 | if (this.match(',')) { |
| 718 | this.nextToken(); |
| 719 | elements.push(null); |
| 720 | } else if (this.match('...')) { |
| 721 | const element = this.parseSpreadElement(); |
| 722 | if (!this.match(']')) { |
| 723 | this.context.isAssignmentTarget = false; |
| 724 | this.context.isBindingElement = false; |
| 725 | this.expect(','); |
| 726 | } |
| 727 | elements.push(element); |
| 728 | } else { |
| 729 | elements.push(this.inheritCoverGrammar(this.parseAssignmentExpression)); |
| 730 | if (!this.match(']')) { |
| 731 | this.expect(','); |
| 732 | } |
| 733 | } |
| 734 | } |
| 735 | this.expect(']'); |
| 736 | |
| 737 | return this.finalize(node, new Node.ArrayExpression(elements)); |
| 738 | } |
| 739 | |
| 740 | // https://tc39.github.io/ecma262/#sec-object-initializer |
| 741 |
no test coverage detected