From 1ce105ae4ba282e71bb3069746ca6d0088da4e25 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 12 Mar 2015 13:03:40 -0700 Subject: [PATCH] addressed PR feedback --- src/compiler/checker.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2541be0d79e..be623d3b188 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -466,13 +466,13 @@ module ts { variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement) { // variable statement/for statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) - isUsedBeforeDeclaration = isDescendentOf(errorLocation, variableDeclaration, container); + isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } else if (variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement || variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement) { // ForIn/ForOf case - use site should not be used in expression part - var expression = (variableDeclaration.parent.parent).expression; - isUsedBeforeDeclaration = isDescendentOf(errorLocation, expression, container); + var expression = (variableDeclaration.parent.parent).expression; + isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } } if (isUsedBeforeDeclaration) { @@ -484,7 +484,7 @@ module ts { * If at any point current node is equal to 'parent' node - return true. * Return false if 'stopAt' node is reached or isFunctionLike(current) === true. */ - function isDescendentOf(initial: Node, parent: Node, stopAt: Node): boolean { + function isSameScopeDescendentOf(initial: Node, parent: Node, stopAt: Node): boolean { if (!parent) { return false; }