From 0fa240d232ceadc5c265aa93c2f41c72919446a8 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 5 May 2015 15:00:01 -0700 Subject: [PATCH] Check that bindingElement is in parameter declaration and pass in correct symbol exclusion flag --- src/compiler/binder.ts | 9 +++++++++ 1 file changed, 9 insertions(+) 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); }