(openingTag *ast.Node, token ast.Kind)
| 4842 | } |
| 4843 | |
| 4844 | func (p *Parser) parseJsxChild(openingTag *ast.Node, token ast.Kind) *ast.Expression { |
| 4845 | switch token { |
| 4846 | case ast.KindEndOfFile: |
| 4847 | // If we hit EOF, issue the error at the tag that lacks the closing element |
| 4848 | // rather than at the end of the file (which is useless) |
| 4849 | if ast.IsJsxOpeningFragment(openingTag) { |
| 4850 | p.parseErrorAtRange(openingTag.Loc, diagnostics.JSX_fragment_has_no_corresponding_closing_tag) |
| 4851 | } else { |
| 4852 | // We want the error span to cover only 'Foo.Bar' in < Foo.Bar > |
| 4853 | // or to cover only 'Foo' in < Foo > |
| 4854 | tag := openingTag.TagName() |
| 4855 | start := min(scanner.SkipTrivia(p.sourceText, tag.Pos()), tag.End()) |
| 4856 | p.parseErrorAt(start, tag.End(), diagnostics.JSX_element_0_has_no_corresponding_closing_tag, |
| 4857 | scanner.GetTextOfNodeFromSourceText(p.sourceText, openingTag.TagName(), false /*includeTrivia*/)) |
| 4858 | } |
| 4859 | return nil |
| 4860 | case ast.KindLessThanSlashToken, ast.KindConflictMarkerTrivia: |
| 4861 | return nil |
| 4862 | case ast.KindJsxText, ast.KindJsxTextAllWhiteSpaces: |
| 4863 | return p.parseJsxText() |
| 4864 | case ast.KindOpenBraceToken: |
| 4865 | return p.parseJsxExpression(false /*inExpressionContext*/) |
| 4866 | case ast.KindLessThanToken: |
| 4867 | return p.parseJsxElementOrSelfClosingElementOrFragment(false /*inExpressionContext*/, -1 /*topInvalidNodePosition*/, openingTag, false) |
| 4868 | } |
| 4869 | panic("Unhandled case in parseJsxChild") |
| 4870 | } |
| 4871 | |
| 4872 | func (p *Parser) parseJsxText() *ast.Node { |
| 4873 | pos := p.nodePos() |
no test coverage detected