Respond to CR

This commit is contained in:
uniqueiniquity 2017-10-24 13:22:29 -07:00
parent a7f9ec00ed
commit fb058868de
4 changed files with 5 additions and 11 deletions

View file

@ -3611,7 +3611,7 @@
"category": "Error", "category": "Error",
"code": 17014 "code": 17014
}, },
"Expected corresponding JSX fragment closing tag.": { "Expected corresponding closing tag for JSX fragment.": {
"category": "Error", "category": "Error",
"code": 17015 "code": 17015
}, },

View file

@ -2090,9 +2090,9 @@ namespace ts {
if (isJsxOpeningElement(node)) { if (isJsxOpeningElement(node)) {
emitJsxTagName(node.tagName); emitJsxTagName(node.tagName);
writeIfAny(node.attributes.properties, " ");
// We are checking here so we won't re-enter the emitting pipeline and emit extra sourcemap // We are checking here so we won't re-enter the emitting pipeline and emit extra sourcemap
if (node.attributes.properties && node.attributes.properties.length > 0) { if (node.attributes.properties && node.attributes.properties.length > 0) {
write(" ");
emit(node.attributes); emit(node.attributes);
} }
} }
@ -2627,12 +2627,6 @@ namespace ts {
writer.decreaseIndent(); writer.decreaseIndent();
} }
function writeIfAny(nodes: NodeArray<Node>, text: string) {
if (some(nodes)) {
write(text);
}
}
function writeToken(token: SyntaxKind, pos: number, contextNode?: Node) { function writeToken(token: SyntaxKind, pos: number, contextNode?: Node) {
return onEmitSourceMapOfToken return onEmitSourceMapOfToken
? onEmitSourceMapOfToken(contextNode, token, pos, writeTokenText) ? onEmitSourceMapOfToken(contextNode, token, pos, writeTokenText)

View file

@ -4213,7 +4213,7 @@ namespace ts {
parseExpected(SyntaxKind.LessThanSlashToken); parseExpected(SyntaxKind.LessThanSlashToken);
if (tokenIsIdentifierOrKeyword(token())) { if (tokenIsIdentifierOrKeyword(token())) {
const unexpectedTagName = parseJsxElementName(); const unexpectedTagName = parseJsxElementName();
parseErrorAtPosition(unexpectedTagName.pos, unexpectedTagName.end - unexpectedTagName.pos, Diagnostics.Expected_corresponding_JSX_fragment_closing_tag); parseErrorAtPosition(unexpectedTagName.pos, unexpectedTagName.end - unexpectedTagName.pos, Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
} }
if (inExpressionContext) { if (inExpressionContext) {
parseExpected(SyntaxKind.GreaterThanToken); parseExpected(SyntaxKind.GreaterThanToken);

View file

@ -1,4 +1,4 @@
tests/cases/conformance/jsx/file.tsx(9,7): error TS17015: Expected corresponding JSX fragment closing tag. tests/cases/conformance/jsx/file.tsx(9,7): error TS17015: Expected corresponding closing tag for JSX fragment.
tests/cases/conformance/jsx/file.tsx(9,11): error TS17014: JSX fragment has no corresponding closing tag. tests/cases/conformance/jsx/file.tsx(9,11): error TS17014: JSX fragment has no corresponding closing tag.
tests/cases/conformance/jsx/file.tsx(11,17): error TS1005: '</' expected. tests/cases/conformance/jsx/file.tsx(11,17): error TS1005: '</' expected.
@ -14,7 +14,7 @@ tests/cases/conformance/jsx/file.tsx(11,17): error TS1005: '</' expected.
<>hi</div> // Error <>hi</div> // Error
~~~ ~~~
!!! error TS17015: Expected corresponding JSX fragment closing tag. !!! error TS17015: Expected corresponding closing tag for JSX fragment.
~~~~~~~~~ ~~~~~~~~~