Don't consume 'is' keyword if there is a preceding line terminator

This commit is contained in:
Jason Freeman
2015-06-09 11:12:00 -07:00
parent ce2d914e4a
commit 75ed565f81
5 changed files with 40 additions and 1 deletions

View File

@@ -1903,7 +1903,7 @@ module ts {
function parseTypeReferenceOrTypePredicate(): TypeReferenceNode | TypePredicateNode {
let typeName = parseEntityName(/*allowReservedWords*/ false, Diagnostics.Type_expected);
if (typeName.kind === SyntaxKind.Identifier && token === SyntaxKind.IsKeyword) {
if (typeName.kind === SyntaxKind.Identifier && token === SyntaxKind.IsKeyword && !scanner.hasPrecedingLineBreak()) {
nextToken();
let node = <TypePredicateNode>createNode(SyntaxKind.TypePredicate, typeName.pos);
node.parameterName = <Identifier>typeName;