(el: MetaJSXElement)
| 549 | } |
| 550 | |
| 551 | parseComplexJSXElement(el: MetaJSXElement): MetaJSXElement { |
| 552 | const stack: MetaJSXElement[] = []; |
| 553 | |
| 554 | while (!this.scanner.eof()) { |
| 555 | el.children = el.children.concat(this.parseJSXChildren()); |
| 556 | const node = this.createJSXChildNode(); |
| 557 | const element = this.parseJSXBoundaryElement(); |
| 558 | if (element.type === JSXSyntax.JSXOpeningElement) { |
| 559 | const opening = element as JSXNode.JSXOpeningElement; |
| 560 | if (opening.selfClosing) { |
| 561 | const child = this.finalize(node, new JSXNode.JSXElement(opening, [], null)); |
| 562 | el.children.push(child); |
| 563 | } else { |
| 564 | stack.push(el); |
| 565 | el = { node, opening, closing: null, children: [] }; |
| 566 | } |
| 567 | } |
| 568 | if (element.type === JSXSyntax.JSXClosingElement) { |
| 569 | el.closing = element as JSXNode.JSXClosingElement; |
| 570 | const open = getQualifiedElementName(el.opening.name); |
| 571 | const close = getQualifiedElementName(el.closing.name); |
| 572 | if (open !== close) { |
| 573 | this.tolerateError('Expected corresponding JSX closing tag for %0', open); |
| 574 | } |
| 575 | if (stack.length > 0) { |
| 576 | const child = this.finalize(el.node, new JSXNode.JSXElement(el.opening, el.children, el.closing)); |
| 577 | el = stack[stack.length - 1]; |
| 578 | el.children.push(child); |
| 579 | stack.pop(); |
| 580 | } else { |
| 581 | break; |
| 582 | } |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | return el; |
| 587 | } |
| 588 | |
| 589 | parseJSXElement(): JSXNode.JSXElement { |
| 590 | const node = this.createJSXNode(); |
no test coverage detected