diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 170f3d3c830..12c8b3e409c 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -440,6 +440,15 @@ module ts { else if (isBlockOrCatchScoped(node)) { bindBlockScopedVariableDeclaration(node); } + else if (isParameterDeclaration(node)) { + // If node is a binding element in parameter declaration, we need to use ParameterExcludes. + // Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration + // For example: + // function foo([a,a]) {} // Duplicate Identifier error + // function bar(a,a) {} // Duplicate Identifier error, binding parameter declaration in this case is handled in bindParameter + // // which correctly set excluded symbols + bindDeclaration(node, SymbolFlags.FunctionScopedVariable, SymbolFlags.ParameterExcludes, /*isBlockScopeContainer*/ false); + } else { bindDeclaration(node, SymbolFlags.FunctionScopedVariable, SymbolFlags.FunctionScopedVariableExcludes, /*isBlockScopeContainer*/ false); }