Skip to content

Commit 71a1f13

Browse files
Don't report a diagnostic explicitly.
1 parent 76d83ee commit 71a1f13

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/services/syntax/parser.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -563,19 +563,18 @@ module TypeScript.Parser {
563563
return Syntax.emptyToken(kind, fullStart);
564564
}
565565

566-
function createMissingToken(expectedKind: SyntaxKind, actual: ISyntaxToken, diagnosticCode?: string): ISyntaxToken {
567-
var diagnostic = getExpectedTokenDiagnostic(expectedKind, actual, diagnosticCode);
566+
function createMissingToken(expectedKind: SyntaxKind, actual: ISyntaxToken, diagnosticCode?: string, args?: any[]): ISyntaxToken {
567+
var diagnostic = getExpectedTokenDiagnostic(expectedKind, actual, diagnosticCode, args);
568568
addDiagnostic(diagnostic);
569569

570570
// The missing token will be at the full start of the current token. That way empty tokens
571571
// will always be between real tokens and not inside an actual token.
572572
return createEmptyToken(expectedKind);
573573
}
574574

575-
function getExpectedTokenDiagnostic(expectedKind: SyntaxKind, actual?: ISyntaxToken, diagnosticCode?: string): Diagnostic {
575+
function getExpectedTokenDiagnostic(expectedKind: SyntaxKind, actual?: ISyntaxToken, diagnosticCode?: string, args?: any[]): Diagnostic {
576576
var token = currentToken();
577577

578-
var args: any[] = undefined;
579578
// If a specialized diagnostic message was provided, just use that.
580579
if (!diagnosticCode) {
581580
// They wanted something specific, just report that that token was missing.
@@ -3094,9 +3093,7 @@ module TypeScript.Parser {
30943093
token = consumeToken(token);
30953094
}
30963095
else {
3097-
var diagnostic = getExpectedTokenDiagnostic(SyntaxKind.CloseBraceToken);
3098-
addDiagnostic(diagnostic);
3099-
token = createEmptyToken(SyntaxKind.TemplateEndToken);
3096+
token = createMissingToken(SyntaxKind.TemplateEndToken, undefined, DiagnosticCode._0_expected, ["{"]);
31003097
}
31013098

31023099
return new TemplateClauseSyntax(parseNodeData, expression, token);

0 commit comments

Comments
 (0)