File tree Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -390,29 +390,18 @@ namespace ts {
390390 let referenceDeclarationFile = getSourceFileOfNode(referenceDeclaration);
391391 let locationNodeFile = getSourceFileOfNode(locationNode);
392392 if (referenceDeclarationFile === locationNodeFile) {
393- return referenceDeclaration.pos <= locationNode.pos || !isInSameLexicalScope ();
393+ return referenceDeclaration.pos <= locationNode.pos || !isInSameContainingFunction ();
394394 }
395395
396396 if (!compilerOptions.outFile && !compilerOptions.out) {
397397 return true;
398398 }
399399
400400 let sourceFiles = host.getSourceFiles();
401- return indexOf(sourceFiles, referenceDeclarationFile) <= indexOf(sourceFiles, locationNodeFile) || !isInSameLexicalScope ();
401+ return indexOf(sourceFiles, referenceDeclarationFile) <= indexOf(sourceFiles, locationNodeFile) || !isInSameContainingFunction ();
402402
403- function isInSameLexicalScope() {
404- let referenceDeclarationScope = getEnclosingBlockScopeContainer(referenceDeclaration);
405- let locationNodeScope = getEnclosingBlockScopeContainer(locationNode);
406-
407- while (locationNodeScope && referenceDeclarationScope !== locationNodeScope) {
408- if (isFunctionLike(locationNodeScope)) {
409- return false;
410- }
411-
412- locationNodeScope = getEnclosingBlockScopeContainer(locationNodeScope);
413- }
414-
415- return true;
403+ function isInSameContainingFunction() {
404+ return getContainingFunction(referenceDeclaration) === getContainingFunction(locationNode);
416405 }
417406 }
418407
You can’t perform that action at this time.
0 commit comments