imporve conditional operator if missing colon token (#20498)

f2
This commit is contained in:
Wenlu Wang
2018-01-08 13:16:17 -08:00
committed by Mohamed Hegazy
parent a82d1f8580
commit 0ecdc876f3
3 changed files with 11 additions and 9 deletions
+3 -1
View File
@@ -3504,7 +3504,9 @@ namespace ts {
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
node.colonToken = parseExpectedToken(SyntaxKind.ColonToken, /*reportAtCurrentPosition*/ false,
Diagnostics._0_expected, tokenToString(SyntaxKind.ColonToken));
node.whenFalse = parseAssignmentExpressionOrHigher();
node.whenFalse = nodeIsPresent(node.colonToken)
? parseAssignmentExpressionOrHigher()
: createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, tokenToString(SyntaxKind.ColonToken));
return finishNode(node);
}