Skip to content

Commit ea01ad4

Browse files
author
Kanchalai Tanglertsampan
committed
Check for conflict marker when trying to parse JSX child
1 parent 8c54bba commit ea01ad4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/compiler/parser.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3862,6 +3862,9 @@ namespace ts {
38623862
parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, getTextOfNodeFromSourceText(sourceText, openingTagName));
38633863
break;
38643864
}
3865+
else if (token() === SyntaxKind.ConflictMarkerTrivia) {
3866+
break;
3867+
}
38653868
result.push(parseJsxChild());
38663869
}
38673870

src/compiler/scanner.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1716,9 +1716,18 @@ namespace ts {
17161716
while (pos < end) {
17171717
pos++;
17181718
char = text.charCodeAt(pos);
1719-
if ((char === CharacterCodes.openBrace) || (char === CharacterCodes.lessThan)) {
1719+
if (char === CharacterCodes.openBrace) {
17201720
break;
17211721
}
1722+
if (char === CharacterCodes.lessThan) {
1723+
if (isConflictMarkerTrivia(text, pos)) {
1724+
pos = scanConflictMarkerTrivia(text, pos, error);
1725+
return token = SyntaxKind.ConflictMarkerTrivia;
1726+
}
1727+
else {
1728+
break;
1729+
}
1730+
}
17221731
}
17231732
return token = SyntaxKind.JsxText;
17241733
}

0 commit comments

Comments
 (0)