Fix #2725: Add check for parent before using it

This commit is contained in:
Mohamed Hegazy 2015-04-13 16:28:06 -07:00
parent 6637f49209
commit 4e42054277
2 changed files with 9 additions and 1 deletions

View File

@ -3109,6 +3109,7 @@ module ts {
case SyntaxKind.SemicolonToken:
return containingNodeKind === SyntaxKind.PropertySignature &&
previousToken.parent && previousToken.parent.parent &&
(previousToken.parent.parent.kind === SyntaxKind.InterfaceDeclaration || // interface a { f; |
previousToken.parent.parent.kind === SyntaxKind.TypeLiteral); // let x : { a; |
@ -3124,7 +3125,8 @@ module ts {
case SyntaxKind.DotDotDotToken:
return containingNodeKind === SyntaxKind.Parameter ||
containingNodeKind === SyntaxKind.Constructor ||
(previousToken.parent.parent.kind === SyntaxKind.ArrayBindingPattern); // var [ ...z|
(previousToken.parent && previousToken.parent.parent &&
previousToken.parent.parent.kind === SyntaxKind.ArrayBindingPattern); // var [ ...z|
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:

View File

@ -0,0 +1,6 @@
/// <reference path='fourslash.ts'/>
////.../**/
goTo.marker();
verify.not.completionListIsEmpty();