8000 Fix for crash in QuickInfo on module path in import statement. · rbuckton/TypeScript@c2f253f · GitHub
[go: up one dir, main page]

Skip to content

Commit c2f253f

Browse files
author
unknown
committed
Fix for crash in QuickInfo on module path in import statement.
1 parent 80abd1e commit c2f253f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/services/services.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,7 +2751,7 @@ module ts {
27512751
while (true) {
27522752
node = node.parent;
27532753
if (!node) {
2754-
return node;
2754+
return undefined;
27552755
}
27562756
switch (node.kind) {
27572757
case SyntaxKind.SourceFile:
@@ -3966,6 +3966,10 @@ module ts {
39663966
for (var i = 0, n = declarations.length; i < n; i++) {
39673967
var container = getContainerNode(declarations[i]);
39683968

3969+
if (!container) {
3970+
return undefined;
3971+
}
3972+
39693973
if (scope && scope !== container) {
39703974
// Different declarations have different containers, bail out
39713975
return undefined;
@@ -4530,8 +4534,8 @@ module ts {
45304534
fileName: filename,
45314535
textSpan: TextSpan.fromBounds(declaration.getStart(), declaration.getEnd()),
45324536
// TODO(jfreeman): What should be the containerName when the container has a computed name?
4533-
containerName: container.name ? (<Identifier>container.name).text : "",
4534-
containerKind: container.name ? getNodeKind(container) : ""
4537+
containerName: container && container.name ? (<Identifier>container.name).text : "",
4538+
containerKind: container && container.name ? getNodeKind(container) : ""
45354539
});
45364540
}
45374541
}
@@ -4685,10 +4689,12 @@ module ts {
46854689
else {
46864690
return SemanticMeaning.Namespace;
46874691
}
4688-
break;
46894692

46904693
case SyntaxKind.ImportDeclaration:
46914694
return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace;
4695+
4696+
case SyntaxKind.SourceFile:
4697+
return SemanticMeaning.Namespace | SemanticMeaning.Value;
46924698
}
46934699
Debug.fail("Unknown declaration type");
46944700
}

0 commit comments

Comments
 (0)
0