@@ -2755,7 +2755,7 @@ namespace ts {
2755
2755
}
2756
2756
2757
2757
function hasVisibleDeclarations(symbol: Symbol, shouldComputeAliasToMakeVisible: boolean): SymbolVisibilityResult {
2758
- let aliasesToMakeVisible: AnyImportSyntax [];
2758
+ let aliasesToMakeVisible: LateVisibilityPaintedStatement [];
2759
2759
if (forEach(symbol.declarations, declaration => !getIsDeclarationVisible(declaration))) {
2760
2760
return undefined;
2761
2761
}
@@ -2769,15 +2769,13 @@ namespace ts {
2769
2769
const anyImportSyntax = getAnyImportSyntax(declaration);
2770
2770
if (anyImportSyntax &&
2771
2771
!hasModifier(anyImportSyntax, ModifierFlags.Export) && // import clause without export
2772
- isDeclarationVisible(<Declaration>anyImportSyntax.parent)) {
2773
- // In function "buildTypeDisplay" where we decide whether to write type-alias or serialize types,
2774
- // we want to just check if type- alias is accessible or not but we don't care about emitting those alias at that time
2775
- // since we will do the emitting later in trackSymbol.
2776
- if (shouldComputeAliasToMakeVisible) {
2777
- getNodeLinks(declaration).isVisible = true;
2778
- aliasesToMakeVisible = appendIfUnique(aliasesToMakeVisible, anyImportSyntax);
2779
- }
2780
- return true;
2772
+ isDeclarationVisible(anyImportSyntax.parent)) {
2773
+ return addVisibleAlias(declaration, anyImportSyntax);
2774
+ }
2775
+ else if (isVariableDeclaration(declaration) && isVariableStatement(declaration.parent.parent) &&
2776
+ !hasModifier(declaration.parent.parent, ModifierFlags.Export) && // unexported variable statement
2777
+ isDeclarationVisible(declaration.parent.parent.parent)) {
2778
+ return addVisibleAlias(declaration, declaration.parent.parent);
2781
2779
}
2782
2780
2783
2781
// Declaration is not visible
@@ -2786,6 +2784,17 @@ namespace ts {
2786
2784
2787
2785
return true;
2788
2786
}
2787
+
2788
+ function addVisibleAlias(declaration: Declaration, aliasingStatement: LateVisibilityPaintedStatement) {
2789
+ // In function "buildTypeDisplay" where we decide whether to write type-alias or serialize types,
2790
+ // we want to just check if type- alias is accessible or not but we don't care about emitting those alias at that time
2791
+ // since we will do the emitting later in trackSymbol.
2792
+ if (shouldComputeAliasToMakeVisible) {
2793
+ getNodeLinks(declaration).isVisible = true;
2794
+ aliasesToMakeVisible = appendIfUnique(aliasesToMakeVisible, aliasingStatement);
2795
+ }
2796
+ return true;
2797
+ }
2789
2798
}
2790
2799
2791
2800
function isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult {
@@ -3850,7 +3859,7 @@ namespace ts {
3850
3859
return symbolName(symbol);
3851
3860
}
3852
3861
3853
- function isDeclarationVisible(node: Declaration | AnyImportSyntax ): boolean {
3862
+ function isDeclarationVisible(node: Node ): boolean {
3854
3863
if (node) {
3855
3864
const links = getNodeLinks(node);
3856
3865
if (links.isVisible === undefined) {
@@ -3864,7 +3873,7 @@ namespace ts {
3864
3873
function determineIfDeclarationIsVisible() {
3865
3874
switch (node.kind) {
3866
3875
case SyntaxKind.BindingElement:
3867
- return isDeclarationVisible(<Declaration> node.parent.parent);
3876
+ return isDeclarationVisible(node.parent.parent);
3868
3877
case SyntaxKind.VariableDeclaration:
3869
3878
if (isBindingPattern((node as VariableDeclaration).name) &&
3870
3879
!((node as VariableDeclaration).name as BindingPattern).elements.length) {
@@ -3890,7 +3899,7 @@ namespace ts {
3890
3899
return isGlobalSourceFile(parent);
3891
3900
}
3892
3901
// Exported members/ambient module elements (exception import declaration) are visible if parent is visible
3893
- return isDeclarationVisible(<Declaration> parent);
3902
+ return isDeclarationVisible(parent);
3894
3903
3895
3904
case SyntaxKind.PropertyDeclaration:
3896
3905
case SyntaxKind.PropertySignature:
@@ -3920,7 +3929,7 @@ namespace ts {
3920
3929
case SyntaxKind.UnionType:
3921
3930
case SyntaxKind.IntersectionType:
3922
3931
case SyntaxKind.ParenthesizedType:
3923
- return isDeclarationVisible(<Declaration> node.parent);
3932
+ return isDeclarationVisible(node.parent);
3924
3933
3925
3934
// Default binding, import specifier and namespace import is visible
3926
3935
// only on demand so by default it is not visible
0 commit comments