From dcfaf6d6d3b03fe715c6ff98b9e26e17d3c06550 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 27 Nov 2014 14:28:44 -0800 Subject: [PATCH] Support parsing const enums. --- src/services/syntax/parser.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/services/syntax/parser.ts b/src/services/syntax/parser.ts index f276ffd9561..f55577dded1 100644 --- a/src/services/syntax/parser.ts +++ b/src/services/syntax/parser.ts @@ -1098,6 +1098,7 @@ module TypeScript.Parser { case SyntaxKind.StaticKeyword: case SyntaxKind.DeclareKeyword: case SyntaxKind.AsyncKeyword: + case SyntaxKind.ConstKeyword: return true; } @@ -1117,6 +1118,11 @@ module TypeScript.Parser { } } + if (token.kind === SyntaxKind.ConstKeyword) { + // In order for 'const' to be a modifier, the next token must be 'enum'. + return nextToken.kind === SyntaxKind.EnumKeyword; + } + var nextTokenKind = nextToken.kind; switch (nextTokenKind) { // public foo'