Skip to content

Commit cdede87

Browse files
committed
C#/C++/Java: Prettier PartialAccessPath.toString
1 parent c3bc9f8 commit cdede87

File tree

20 files changed

+86
-48
lines changed

20 files changed

+86
-48
lines changed

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,7 @@ private module FlowExploration {
20812081

20822082
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20832083
override string toString() {
2084-
exists(DataFlowType t | this = TPartialNil(t) | result = ppReprType(t))
2084+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(ppReprType(t)))
20852085
}
20862086

20872087
override AccessPathFront getFront() {
@@ -2092,7 +2092,9 @@ private module FlowExploration {
20922092
private class PartialAccessPathCons extends PartialAccessPath, TPartialCons {
20932093
override string toString() {
20942094
exists(Content f, int len | this = TPartialCons(f, len) |
2095-
result = f.toString() + ", ... (" + len.toString() + ")"
2095+
if len = 1
2096+
then result = f.toString()
2097+
else result = f.toString() + ", ... (" + len.toString() + ")"
20962098
)
20972099
}
20982100

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,7 @@ private module FlowExploration {
20812081

20822082
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20832083
override string toString() {
2084-
exists(DataFlowType t | this = TPartialNil(t) | result = ppReprType(t))
2084+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(ppReprType(t)))
20852085
}
20862086

20872087
override AccessPathFront getFront() {
@@ -2092,7 +2092,9 @@ private module FlowExploration {
20922092
private class PartialAccessPathCons extends PartialAccessPath, TPartialCons {
20932093
override string toString() {
20942094
exists(Content f, int len | this = TPartialCons(f, len) |
2095-
result = f.toString() + ", ... (" + len.toString() + ")"
2095+
if len = 1
2096+
then result = f.toString()
2097+
else result = f.toString() + ", ... (" + len.toString() + ")"
20962098
)
20972099
}
20982100

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,7 @@ private module FlowExploration {
20812081

20822082
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20832083
override string toString() {
2084-
exists(DataFlowType t | this = TPartialNil(t) | result = ppReprType(t))
2084+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(ppReprType(t)))
20852085
}
20862086

20872087
override AccessPathFront getFront() {
@@ -2092,7 +2092,9 @@ private module FlowExploration {
20922092
private class PartialAccessPathCons extends PartialAccessPath, TPartialCons {
20932093
override string toString() {
20942094
exists(Content f, int len | this = TPartialCons(f, len) |
2095-
result = f.toString() + ", ... (" + len.toString() + ")"
2095+
if len = 1
2096+
then result = f.toString()
2097+
else result = f.toString() + ", ... (" + len.toString() + ")"
20962098
)
20972099
}
20982100

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,7 @@ private module FlowExploration {
20812081

20822082
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20832083
override string toString() {
2084-
exists(DataFlowType t | this = TPartialNil(t) | result = ppReprType(t))
2084+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(ppReprType(t)))
20852085
}
20862086

20872087
override AccessPathFront getFront() {
@@ -2092,7 +2092,9 @@ private module FlowExploration {
20922092
private class PartialAccessPathCons extends PartialAccessPath, TPartialCons {
20932093
override string toString() {
20942094
exists(Content f, int len | this = TPartialCons(f, len) |
2095-
result = f.toString() + ", ... (" + len.toString() + ")"
2095+
if len = 1
2096+
then result = f.toString()
2097+
else result = f.toString() + ", ... (" + len.toString() + ")"
20962098
)
20972099
}
20982100

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,7 @@ private module FlowExploration {
20812081

20822082
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20832083
override string toString() {
2084-
exists(DataFlowType t | this = TPartialNil(t) | result = ppReprType(t))
2084+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(ppReprType(t)))
20852085
}
20862086

20872087
override AccessPathFront getFront() {
@@ -2092,7 +2092,9 @@ private module FlowExploration {
20922092
private class PartialAccessPathCons extends PartialAccessPath, TPartialCons {
20932093
override string toString() {
20942094
exists(Content f, int len | this = TPartialCons(f, len) |
2095-
result = f.toString() + ", ... (" + len.toString() + ")"
2095+
if len = 1
2096+
then result = f.toString()
2097+
else result = f.toString() + ", ... (" + len.toString() + ")"
20962098
)
20972099
}
20982100

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,7 @@ private module FlowExploration {
20812081

20822082
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20832083
override string toString() {
2084-
exists(DataFlowType t | this = TPartialNil(t) | result = ppReprType(t))
2084+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(ppReprType(t)))
20852085
}
20862086

20872087
override AccessPathFront getFront() {
@@ -2092,7 +2092,9 @@ private module FlowExploration {
20922092
private class PartialAccessPathCons extends PartialAccessPath, TPartialCons {
20932093
override string toString() {
20942094
exists(Content f, int len | this = TPartialCons(f, len) |
2095-
result = f.toString() + ", ... (" + len.toString() + ")"
2095+
if len = 1
2096+
then result = f.toString()
2097+
else result = f.toString() + ", ... (" + len.toString() + ")"
20962098
)
20972099
}
20982100

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,7 @@ private module FlowExploration {
20812081

20822082
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20832083
override string toString() {
2084-
exists(DataFlowType t | this = TPartialNil(t) | result = ppReprType(t))
2084+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(ppReprType(t)))
20852085
}
20862086

20872087
override AccessPathFront getFront() {
@@ -2092,7 +2092,9 @@ private module FlowExploration {
20922092
private class PartialAccessPathCons extends PartialAccessPath, TPartialCons {
20932093
override string toString() {
20942094
exists(Content f, int len | this = TPartialCons(f, len) |
2095-
result = f.toString() + ", ... (" + len.toString() + ")"
2095+
if len = 1
2096+
then result = f.toString()
2097+
else result = f.toString() + ", ... (" + len.toString() + ")"
20962098
)
20972099
}
20982100

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,7 @@ private module FlowExploration {
20812081

20822082
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20832083
override string toString() {
2084-
exists(DataFlowType t | this = TPartialNil(t) | result = ppReprType(t))
2084+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(ppReprType(t)))
20852085
}
20862086

20872087
override AccessPathFront getFront() {
@@ -2092,7 +2092,9 @@ private module FlowExploration {
20922092
private class PartialAccessPathCons extends PartialAccessPath, TPartialCons {
20932093
override string toString() {
20942094
exists(Content f, int len | this = TPartialCons(f, len) |
2095-
result = f.toString() + ", ... (" + len.toString() + ")"
2095+
if len = 1
2096+
then result = f.toString()
2097+
else result = f.toString() + ", ... (" + len.toString() + ")"
20962098
)
20972099
}
20982100

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,7 @@ private module FlowExploration {
20812081

20822082
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20832083
override string toString() {
2084-
exists(DataFlowType t | this = TPartialNil(t) | result = ppReprType(t))
2084+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(ppReprType(t)))
20852085
}
20862086

20872087
override AccessPathFront getFront() {
@@ -2092,7 +2092,9 @@ private module FlowExploration {
20922092
private class PartialAccessPathCons extends PartialAccessPath, TPartialCons {
20932093
override string toString() {
20942094
exists(Content f, int len | this = TPartialCons(f, len) |
2095-
result = f.toString() + ", ... (" + len.toString() + ")"
2095+
if len = 1
2096+
then result = f.toString()
2097+
else result = f.toString() + ", ... (" + len.toString() + ")"
20962098
)
20972099
}
20982100

csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,7 @@ private module FlowExploration {
20812081

20822082
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20832083
override string toString() {
2084-
exists(DataFlowType t | this = TPartialNil(t) | result = ppReprType(t))
2084+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(ppReprType(t)))
20852085
}
20862086

20872087
override AccessPathFront getFront() {
@@ -2092,7 +2092,9 @@ private module FlowExploration {
20922092
private class PartialAccessPathCons extends PartialAccessPath, TPartialCons {
20932093
override string toString() {
20942094
exists(Content f, int len | this = TPartialCons(f, len) |
2095-
result = f.toString() + ", ... (" + len.toString() + ")"
2095+
if len = 1
2096+
then result = f.toString()
2097+
else result = f.toString() + ", ... (" + len.toString() + ")"
20962098
)
20972099
}
20982100

0 commit comments

Comments
 (0)