File tree 1 file changed +4
-15
lines changed
1 file changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -390,29 +390,18 @@ namespace ts {
390
390
let referenceDeclarationFile = getSourceFileOfNode(referenceDeclaration);
391
391
let locationNodeFile = getSourceFileOfNode(locationNode);
392
392
if (referenceDeclarationFile === locationNodeFile) {
393
- return referenceDeclaration.pos <= locationNode.pos || !isInSameLexicalScope ();
393
+ return referenceDeclaration.pos <= locationNode.pos || !isInSameContainingFunction ();
394
394
}
395
395
396
396
if (!compilerOptions.outFile && !compilerOptions.out) {
397
397
return true;
398
398
}
399
399
400
400
let sourceFiles = host.getSourceFiles();
401
- return indexOf(sourceFiles, referenceDeclarationFile) <= indexOf(sourceFiles, locationNodeFile) || !isInSameLexicalScope ();
401
+ return indexOf(sourceFiles, referenceDeclarationFile) <= indexOf(sourceFiles, locationNodeFile) || !isInSameContainingFunction ();
402
402
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);
416
405
}
417
406
}
418
407
You can’t perform that action at this time.
0 commit comments