Skip to content

Commit

Permalink
fix(control-flow): Process constructor call in control flow graph (#5738
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Mr-Pine authored Apr 20, 2024
1 parent 95460ea commit 2c30f68
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,8 @@ public <T> void visitCtNewArray(CtNewArray<T> newArray) {
}

@Override
public <T> void visitCtConstructorCall(CtConstructorCall<T> ctConstructorCall) {

public <T> void visitCtConstructorCall(CtConstructorCall<T> constructorCall) {
defaultAction(BranchKind.STATEMENT, constructorCall);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ public void process(CtConstructor<?> element) {
assertFalse(graph.containsEdge(entryNode, exitNode), "Graph is missing statements");
}

@Test
public void testConstructorCall() throws Exception {
testMethod("constructorCall", true, 0, 1, 5);
}

@Test
public void testtestCase() throws Exception {
//branchCount, stmntCount, totalCount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ public int lastCaseFallThrough(int a) {
return b;
}

public void constructorCall() {
new Object();
}

//All lines will be tested in this method
public int simple(int a) {
a = a + a / 2;
Expand Down

0 comments on commit 2c30f68

Please sign in to comment.