Check binding initialisers in parameters as well

This commit is contained in:
Nathan Shively-Sanders 2016-12-06 13:04:45 -08:00
parent 92f2721b46
commit 72a1e85cd7

View File

@ -17041,7 +17041,8 @@ namespace ts {
// so we need to do a bit of extra work to check if reference is legal
const enclosingContainer = getEnclosingBlockScopeContainer(symbol.valueDeclaration);
if (enclosingContainer === func) {
if (symbol.valueDeclaration.kind === SyntaxKind.Parameter) {
if (symbol.valueDeclaration.kind === SyntaxKind.Parameter ||
symbol.valueDeclaration.kind === SyntaxKind.BindingElement) {
// it is ok to reference parameter in initializer if either
// - parameter is located strictly on the left of current parameter declaration
if (symbol.valueDeclaration.pos < node.pos) {