Check for conflict marker when trying to parse JSX child

This commit is contained in:
Kanchalai Tanglertsampan 2017-02-16 14:03:41 -08:00
parent 8c54bbaa04
commit ea01ad4cbd
2 changed files with 13 additions and 1 deletions

View File

@ -3862,6 +3862,9 @@ namespace ts {
parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, getTextOfNodeFromSourceText(sourceText, openingTagName));
break;
}
else if (token() === SyntaxKind.ConflictMarkerTrivia) {
break;
}
result.push(parseJsxChild());
}

View File

@ -1716,9 +1716,18 @@ namespace ts {
while (pos < end) {
pos++;
char = text.charCodeAt(pos);
if ((char === CharacterCodes.openBrace) || (char === CharacterCodes.lessThan)) {
if (char === CharacterCodes.openBrace) {
break;
}
if (char === CharacterCodes.lessThan) {
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
return token = SyntaxKind.ConflictMarkerTrivia;
}
else {
break;
}
}
}
return token = SyntaxKind.JsxText;
}