MCPcopy Create free account
hub / github.com/microsoft/typescript-go / parseJsxClosingElement

Method parseJsxClosingElement

internal/parser/parser.go:4918–4931  ·  view source on GitHub ↗
(open *ast.Node, inExpressionContext bool)

Source from the content-addressed store, hash-verified

4916}
4917
4918func (p *Parser) parseJsxClosingElement(open *ast.Node, inExpressionContext bool) *ast.Node {
4919 pos := p.nodePos()
4920 p.parseExpected(ast.KindLessThanSlashToken)
4921 tagName := p.parseJsxElementName()
4922 if p.parseExpectedWithDiagnostic(ast.KindGreaterThanToken, nil /*diagnosticMessage*/, false /*shouldAdvance*/) {
4923 // manually advance the scanner in order to look for jsx text inside jsx
4924 if inExpressionContext || !ast.TagNamesAreEquivalent(open.TagName(), tagName) {
4925 p.nextToken()
4926 } else {
4927 p.scanJsxText()
4928 }
4929 }
4930 return p.finishNode(p.factory.NewJsxClosingElement(tagName), pos)
4931}
4932
4933func (p *Parser) parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext bool) *ast.Expression {
4934 pos := p.nodePos()

Calls 10

nodePosMethod · 0.95
parseExpectedMethod · 0.95
parseJsxElementNameMethod · 0.95
nextTokenMethod · 0.95
scanJsxTextMethod · 0.95
finishNodeMethod · 0.95
TagNamesAreEquivalentFunction · 0.92
TagNameMethod · 0.80
NewJsxClosingElementMethod · 0.80

Tested by

no test coverage detected