mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-21 08:25:43 -05:00
Don't report an error directly when parsing a function body.
This commit is contained in:
@@ -106,7 +106,7 @@ module ts {
|
||||
Type_argument_expected: { code: 1140, category: DiagnosticCategory.Error, key: "Type argument expected." },
|
||||
String_literal_expected: { code: 1141, category: DiagnosticCategory.Error, key: "String literal expected." },
|
||||
Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here." },
|
||||
Block_or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "Block or ';' expected." },
|
||||
or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "'{' or ';' expected." },
|
||||
Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." },
|
||||
Declaration_expected: { code: 1146, category: DiagnosticCategory.Error, key: "Declaration expected." },
|
||||
Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in an internal module cannot reference an external module." },
|
||||
|
||||
@@ -415,7 +415,7 @@
|
||||
"category": "Error",
|
||||
"code": 1142
|
||||
},
|
||||
"Block or ';' expected.": {
|
||||
"'{' or ';' expected.": {
|
||||
"category": "Error",
|
||||
"code": 1144
|
||||
},
|
||||
|
||||
@@ -1226,7 +1226,7 @@ module ts {
|
||||
return token === SyntaxKind.CloseBraceToken || token === SyntaxKind.EndOfFileToken || scanner.hasPrecedingLineBreak();
|
||||
}
|
||||
|
||||
function parseSemicolon(): void {
|
||||
function parseSemicolon(diagnosticMessage?: DiagnosticMessage): void {
|
||||
if (canParseSemicolon()) {
|
||||
if (token === SyntaxKind.SemicolonToken) {
|
||||
// consume the semicolon if it was explicitly provided.
|
||||
@@ -1234,7 +1234,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
parseExpected(SyntaxKind.SemicolonToken);
|
||||
parseExpected(SyntaxKind.SemicolonToken, diagnosticMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3572,12 +3572,8 @@ module ts {
|
||||
return parseFunctionBlock(isGenerator, /* ignoreMissingOpenBrace */ false);
|
||||
}
|
||||
|
||||
if (canParseSemicolon()) {
|
||||
parseSemicolon();
|
||||
return undefined;
|
||||
}
|
||||
|
||||
error(Diagnostics.Block_or_expected); // block or ';' expected
|
||||
parseSemicolon(Diagnostics.or_expected);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// DECLARATIONS
|
||||
|
||||
Reference in New Issue
Block a user