Also fix the case where we are to the right of a spread expr

This commit is contained in:
Ryan Cavanaugh
2015-07-31 14:05:43 -07:00
parent f224b5022e
commit a45e9a91bf
2 changed files with 24 additions and 2 deletions

View File

@@ -3393,6 +3393,7 @@ namespace ts {
case SyntaxKind.SlashToken:
case SyntaxKind.Identifier:
case SyntaxKind.JsxAttribute:
case SyntaxKind.JsxSpreadAttribute:
if (parent && (parent.kind === SyntaxKind.JsxSelfClosingElement || parent.kind === SyntaxKind.JsxOpeningElement)) {
return <JsxOpeningLikeElement>parent;
}
@@ -3402,7 +3403,7 @@ namespace ts {
// its parent is a JsxExpression, whose parent is a JsxAttribute,
// whose parent is a JsxOpeningLikeElement
case SyntaxKind.StringLiteral:
if (parent && parent.kind === SyntaxKind.JsxAttribute) {
if (parent && ((parent.kind === SyntaxKind.JsxAttribute) || (parent.kind === SyntaxKind.JsxSpreadAttribute))) {
return <JsxOpeningLikeElement>parent.parent;
}
@@ -3412,11 +3413,15 @@ namespace ts {
if (parent &&
parent.kind === SyntaxKind.JsxExpression &&
parent.parent &&
parent.parent.kind === SyntaxKind.JsxAttribute) {
(parent.parent.kind === SyntaxKind.JsxAttribute)) {
return <JsxOpeningLikeElement>parent.parent.parent;
}
if (parent && parent.kind === SyntaxKind.JsxSpreadAttribute) {
return <JsxOpeningLikeElement>parent.parent;
}
break;
}
}