File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9158,6 +9158,15 @@ module ts {
91589158 grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, Diagnostics.Catch_clause_variable_cannot_have_an_initializer);
91599159 }
91609160 else {
9161+ var identifierName = (<Identifier>catchClause.variableDeclaration.name).text;
9162+ var locals = catchClause.block.locals;
9163+ if (locals && locals[identifierName]) {
9164+ var localSymbol = locals[identifierName]
9165+ if (localSymbol && (localSymbol.flags & SymbolFlags.BlockScopedVariable) !== 0) {
9166+ grammarErrorOnNode(localSymbol.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, identifierName);
9167+ }
9168+ }
9169+
91619170 // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the
91629171 // Catch production is eval or arguments
91639172 checkGrammarEvalOrArgumentsInStrictMode(node, <Identifier>catchClause.variableDeclaration.name);
You can’t perform that action at this time.
0 commit comments