diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 9397661839d..de2d75286dc 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1395,10 +1395,12 @@ module ts { } function parseContextualModifier(t: SyntaxKind): boolean { - return token === t && tryParse(() => { - nextToken(); - return canFollowModifier(); - }); + return token === t && tryParse(nextTokenCanFollowModifier); + } + + function nextTokenCanFollowModifier() { + nextToken(); + return canFollowModifier(); } function parseAnyContextualModifier(): boolean { @@ -4066,9 +4068,13 @@ module ts { // literals. We check to ensure that it is only a string literal later in the grammar // walker. node.expression = parseExpression(); + + // Ensure the string being required is in our 'identifier' table. This will ensure + // that features like 'find refs' will look inside this file when search for its name. if (node.expression.kind === SyntaxKind.StringLiteral) { internIdentifier((node.expression).text); } + parseExpected(SyntaxKind.CloseParenToken); return finishNode(node); }