Skip to content

Commit fac3cf8

Browse files
committed
addressed PR feedback
1 parent d163205 commit fac3cf8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8625,18 +8625,19 @@ module ts {
86258625
localDeclarationSymbol !== symbol &&
86268626
localDeclarationSymbol.flags & SymbolFlags.BlockScopedVariable) {
86278627
if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & NodeFlags.BlockScoped) {
8628-
86298628
let varDeclList = getAncestor(localDeclarationSymbol.valueDeclaration, SyntaxKind.VariableDeclarationList);
86308629
let container =
8631-
varDeclList.parent.kind === SyntaxKind.VariableStatement &&
8632-
varDeclList.parent.parent;
8630+
varDeclList.parent.kind === SyntaxKind.VariableStatement && varDeclList.parent.parent
8631+
? varDeclList.parent.parent
8632+
: undefined;
86338633

86348634
// names of block-scoped and function scoped variables can collide only
86358635
// if block scoped variable is defined in the function\module\source file scope (because of variable hoisting)
86368636
let namesShareScope =
86378637
container &&
86388638
(container.kind === SyntaxKind.Block && isFunctionLike(container.parent) ||
8639-
(container.kind === SyntaxKind.ModuleBlock && container.kind === SyntaxKind.ModuleDeclaration) ||
8639+
container.kind === SyntaxKind.ModuleBlock ||
8640+
container.kind === SyntaxKind.ModuleDeclaration ||
86408641
container.kind === SyntaxKind.SourceFile);
86418642

86428643
// here we know that function scoped variable is shadowed by block scoped one

0 commit comments

Comments
 (0)