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:
Mathias Vorreiter Pedersen
2021-10-13 19:47:55 +01:00
committed by GitHub
10 changed files with 36 additions and 44 deletions

View File

@@ -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
)
}
/**

View File

@@ -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()
)
}