()
| 9430 | } |
| 9431 | |
| 9432 | function parseJSXElement() { |
| 9433 | var openingElement, closingElement = null, children = [], origInJSXChild, origInJSXTag, marker = markerCreate(); |
| 9434 | |
| 9435 | origInJSXChild = state.inJSXChild; |
| 9436 | origInJSXTag = state.inJSXTag; |
| 9437 | openingElement = parseJSXOpeningElement(); |
| 9438 | |
| 9439 | if (!openingElement.selfClosing) { |
| 9440 | while (index < length) { |
| 9441 | state.inJSXChild = false; // Call lookahead2() with inJSXChild = false because </ should not be considered in the child |
| 9442 | if (lookahead.value === '<' && lookahead2().value === '/') { |
| 9443 | break; |
| 9444 | } |
| 9445 | state.inJSXChild = true; |
| 9446 | children.push(parseJSXChild()); |
| 9447 | } |
| 9448 | state.inJSXChild = origInJSXChild; |
| 9449 | state.inJSXTag = origInJSXTag; |
| 9450 | closingElement = parseJSXClosingElement(); |
| 9451 | if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) { |
| 9452 | throwError({}, Messages.ExpectedJSXClosingTag, getQualifiedJSXName(openingElement.name)); |
| 9453 | } |
| 9454 | } |
| 9455 | |
| 9456 | // When (erroneously) writing two adjacent tags like |
| 9457 | // |
| 9458 | // var x = <div>one</div><div>two</div>; |
| 9459 | // |
| 9460 | // the default error message is a bit incomprehensible. Since it's |
| 9461 | // rarely (never?) useful to write a less-than sign after an JSX |
| 9462 | // element, we disallow it here in the parser in order to provide a |
| 9463 | // better error message. (In the rare case that the less-than operator |
| 9464 | // was intended, the left tag can be wrapped in parentheses.) |
| 9465 | if (!origInJSXChild && match('<')) { |
| 9466 | throwError(lookahead, Messages.AdjacentJSXElements); |
| 9467 | } |
| 9468 | |
| 9469 | return markerApply(marker, delegate.createJSXElement(openingElement, closingElement, children)); |
| 9470 | } |
| 9471 | |
| 9472 | function parseTypeAlias() { |
| 9473 | var id, marker = markerCreate(), typeParameters = null, right; |
no test coverage detected