Skip to content

Commit 7690625

Browse files
committed
C#: Replace 'if p() then q() else none()' with a conjunction.
1 parent ba981c5 commit 7690625

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

csharp/ql/src/experimental/ir/internal/IntegerInterval.qll

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ Overlap getOverlap(IntValue defStart, IntValue defEnd, IntValue useStart, IntVal
1818
else
1919
if isLE(defStart, useStart) and isGE(defEnd, useEnd)
2020
then result instanceof MustTotallyOverlap
21-
else
22-
if isLE(defEnd, useStart) or isGE(defStart, useEnd)
23-
then none()
24-
else result instanceof MayPartiallyOverlap
21+
else (
22+
not isLE(defEnd, useStart) and
23+
not isGE(defStart, useEnd) and
24+
result instanceof MayPartiallyOverlap
25+
)
2526
}
2627

2728
/**

csharp/ql/src/experimental/ir/rangeanalysis/RangeUtils.qll

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ IntValue getArrayDim(Variable arr) {
5252
arr.getInitializer() = ac and
5353
if exists(ac.getLengthArgument(0))
5454
then result = ac.getLengthArgument(0).getValue().toInt()
55-
else
56-
if exists(ac.getInitializer())
57-
then result = ac.getInitializer().getNumberOfElements()
58-
else none()
55+
else result = ac.getInitializer().getNumberOfElements()
5956
)
6057
}
6158

0 commit comments

Comments
 (0)