mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
include read of superclass expression in control flow graph
This commit is contained in:
@@ -46,6 +46,9 @@ public class PyControlFlowBuilder extends PyRecursiveElementVisitor {
|
||||
public void visitPyClass(final PyClass node) {
|
||||
// Create node and stop here
|
||||
myBuilder.startNode(node);
|
||||
for (PsiElement element : node.getSuperClassExpressions()) {
|
||||
element.accept(this);
|
||||
}
|
||||
final ReadWriteInstruction instruction = ReadWriteInstruction.write(myBuilder, node, node.getName());
|
||||
myBuilder.addNode(instruction);
|
||||
myBuilder.checkPending(instruction);
|
||||
@@ -436,10 +439,10 @@ public class PyControlFlowBuilder extends PyRecursiveElementVisitor {
|
||||
pendingBackup.addAll(myBuilder.pending);
|
||||
myBuilder.pending = emptyMutableList();
|
||||
myBuilder.flowAbrupted();
|
||||
final Instruction exceptInstrcution = myBuilder.startNode(exceptPart);
|
||||
final Instruction exceptInstruction = myBuilder.startNode(exceptPart);
|
||||
exceptPart.accept(this);
|
||||
myBuilder.addPendingEdge(node, myBuilder.prevInstruction);
|
||||
exceptInstructions.add(exceptInstrcution);
|
||||
exceptInstructions.add(exceptInstruction);
|
||||
}
|
||||
for (Pair<PsiElement, Instruction> pair : pendingBackup) {
|
||||
myBuilder.addPendingEdge(pair.first, pair.second);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class Foo:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
class Bar(Foo):
|
||||
pass
|
||||
|
||||
Bar()
|
||||
#<ref>
|
||||
@@ -0,0 +1,9 @@
|
||||
0(1) element: null
|
||||
1(2) element: PyClass: Foo
|
||||
2(3) WRITE ACCESS: Foo
|
||||
3(4) element: PyClass: Bar
|
||||
4(5) READ ACCESS: Foo
|
||||
5(6) WRITE ACCESS: Bar
|
||||
6(7) element: PyExpressionStatement
|
||||
7(8) READ ACCESS: Bar
|
||||
8() element: null
|
||||
@@ -152,6 +152,10 @@ public class PyControlFlowBuilderTest extends LightMarkedTestCase {
|
||||
public void testManyIfs() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSuperclass() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testQualifiedSelfReference() {
|
||||
final String testName = getTestName(false).toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user