mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Merge pull request #6865 from MathiasVP/fix-if-none
C++/C#/JS/Python: Replace 'if p() then q() else none()' with a conjunction
This commit is contained in:
@@ -18,10 +18,11 @@ Overlap getOverlap(IntValue defStart, IntValue defEnd, IntValue useStart, IntVal
|
||||
else
|
||||
if isLE(defStart, useStart) and isGE(defEnd, useEnd)
|
||||
then result instanceof MustTotallyOverlap
|
||||
else
|
||||
if isLE(defEnd, useStart) or isGE(defStart, useEnd)
|
||||
then none()
|
||||
else result instanceof MayPartiallyOverlap
|
||||
else (
|
||||
not isLE(defEnd, useStart) and
|
||||
not isGE(defStart, useEnd) and
|
||||
result instanceof MayPartiallyOverlap
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,10 +52,7 @@ IntValue getArrayDim(Variable arr) {
|
||||
arr.getInitializer() = ac and
|
||||
if exists(ac.getLengthArgument(0))
|
||||
then result = ac.getLengthArgument(0).getValue().toInt()
|
||||
else
|
||||
if exists(ac.getInitializer())
|
||||
then result = ac.getInitializer().getNumberOfElements()
|
||||
else none()
|
||||
else result = ac.getInitializer().getNumberOfElements()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user