From bea124b217ba9ebd227700853d551536380f74d7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 5 Nov 2014 04:07:53 -0800 Subject: [PATCH] Simplify code. --- src/services/syntax/parser.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/services/syntax/parser.ts b/src/services/syntax/parser.ts index e2b652f1492..efa73c8164a 100644 --- a/src/services/syntax/parser.ts +++ b/src/services/syntax/parser.ts @@ -3396,16 +3396,9 @@ module TypeScript.Parser { function isPropertyName(peekIndex: number, inErrorRecovery: boolean): boolean { var token = peekToken(peekIndex); if (token.kind === SyntaxKind.OpenBracketToken) { - // If we're in a class declaration. - // it's a property name as long as it doesn't start with: - // - // [id: - // - // If it starts with that, then it's an index signature. Fortunately, there is no - // ambiguity in the language as a property name must have an assignment expression - // after the open bracket (and no assignment expressions start with "id:"). - var isIndexSignature = isIdentifier(peekToken(peekIndex + 1)) && peekToken(peekIndex + 2).kind === SyntaxKind.ColonToken; - return !isIndexSignature; + // A '[' only starts a property name as long as we're sure it doesn't start an + // index signature. + return !isIndexSignature(peekIndex); } return isPropertyNameToken(token, inErrorRecovery);