(openingTag *ast.Expression)
| 4819 | } |
| 4820 | |
| 4821 | func (p *Parser) parseJsxChildren(openingTag *ast.Expression) *ast.NodeList { |
| 4822 | pos := p.nodePos() |
| 4823 | saveParsingContexts := p.parsingContexts |
| 4824 | p.parsingContexts |= 1 << PCJsxChildren |
| 4825 | var list []*ast.Node |
| 4826 | for { |
| 4827 | currentToken := p.scanner.ReScanJsxToken(true /*allowMultilineJsxText*/) |
| 4828 | child := p.parseJsxChild(openingTag, currentToken) |
| 4829 | if child == nil { |
| 4830 | break |
| 4831 | } |
| 4832 | list = append(list, child) |
| 4833 | if ast.IsJsxOpeningElement(openingTag) && child.Kind == ast.KindJsxElement && |
| 4834 | !ast.TagNamesAreEquivalent(child.AsJsxElement().OpeningElement.TagName(), child.AsJsxElement().ClosingElement.TagName()) && |
| 4835 | ast.TagNamesAreEquivalent(openingTag.TagName(), child.AsJsxElement().ClosingElement.TagName()) { |
| 4836 | // stop after parsing a mismatched child like <div>...(<span></div>) in order to reattach the </div> higher |
| 4837 | break |
| 4838 | } |
| 4839 | } |
| 4840 | p.parsingContexts = saveParsingContexts |
| 4841 | return p.newNodeList(core.NewTextRange(pos, p.nodePos()), list) |
| 4842 | } |
| 4843 | |
| 4844 | func (p *Parser) parseJsxChild(openingTag *ast.Node, token ast.Kind) *ast.Expression { |
| 4845 | switch token { |
no test coverage detected