Skip to content

Commit 13e503a

Browse files
committed
Switches to decl.node inside isDefinition switch
1 parent ec2fdbb commit 13e503a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/pyright-scip/src/treeVisitor.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,8 @@ export class TreeVisitor extends ParseTreeWalker {
719719
}
720720

721721
if (isDefinition) {
722-
switch (parent.nodeType) {
722+
// In this case, decl.node == node.parent
723+
switch (decl.node.nodeType) {
723724
case ParseNodeType.Class: {
724725
const symbol = this.getScipSymbol(parent);
725726

@@ -729,7 +730,7 @@ export class TreeVisitor extends ParseTreeWalker {
729730
documentation.push('```python\n' + stub.join('\n') + '\n```');
730731
}
731732

732-
const doc = ParseTreeUtils.getDocString(parent.suite.statements)?.trim();
733+
const doc = ParseTreeUtils.getDocString(decl.node.suite.statements)?.trim();
733734
if (doc) {
734735
documentation.push(convertDocStringToMarkdown(doc));
735736
}
@@ -787,7 +788,7 @@ export class TreeVisitor extends ParseTreeWalker {
787788
})
788789
);
789790

790-
this.pushNewOccurrence(node, this.getScipSymbol(decl.node), scip.SymbolRole.Definition, parent);
791+
this.pushNewOccurrence(node, this.getScipSymbol(decl.node), scip.SymbolRole.Definition, decl.node);
791792
}
792793
default: {
793794
this.pushNewOccurrence(node, this.getScipSymbol(decl.node), scip.SymbolRole.Definition);

0 commit comments

Comments
 (0)