mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Don't directly produce errors while parsing 'try' statements.
This commit is contained in:
parent
f404212793
commit
7eb4e742d1
@ -106,7 +106,6 @@ 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." },
|
||||
catch_or_finally_expected: { code: 1143, category: DiagnosticCategory.Error, key: "'catch' or 'finally' expected." },
|
||||
Block_or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "Block 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." },
|
||||
|
||||
@ -415,10 +415,6 @@
|
||||
"category": "Error",
|
||||
"code": 1142
|
||||
},
|
||||
"'catch' or 'finally' expected.": {
|
||||
"category": "Error",
|
||||
"code": 1143
|
||||
},
|
||||
"Block or ';' expected.": {
|
||||
"category": "Error",
|
||||
"code": 1144
|
||||
|
||||
@ -3397,12 +3397,13 @@ module ts {
|
||||
if (token === SyntaxKind.CatchKeyword) {
|
||||
node.catchBlock = parseCatchBlock();
|
||||
}
|
||||
if (token === SyntaxKind.FinallyKeyword) {
|
||||
|
||||
// If we don't have a catch clause, then we must have a finally clause. Try to parse
|
||||
// one out no matter what.
|
||||
if (!node.catchBlock || token === SyntaxKind.FinallyKeyword) {
|
||||
node.finallyBlock = parseTokenAndBlock(SyntaxKind.FinallyKeyword, SyntaxKind.FinallyBlock);
|
||||
}
|
||||
if (!(node.catchBlock || node.finallyBlock)) {
|
||||
error(Diagnostics.catch_or_finally_expected);
|
||||
}
|
||||
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user