Shared/Java: Make the 'isNull' interface slightly prettier.

This commit is contained in:
Mathias Vorreiter Pedersen
2024-04-05 11:58:43 +01:00
parent ebac171b2b
commit 1acbb84444
3 changed files with 13 additions and 3 deletions

View File

@@ -42,6 +42,12 @@ signature module TypeFlowInput<LocationSig Location> {
/** Holds if `n` represents a `null` value. */
predicate isNullValue(TypeFlowNode n);
/**
* Holds if `n` should be excluded from the set of null values even if
* the null analysis determines that `n` is always null.
*/
default predicate isExcludedFromNullAnalysis(TypeFlowNode n) { none() }
/** A type. */
class Type {
/** Gets a textual representation of this type. */

View File

@@ -10,6 +10,9 @@ module TypeFlow<LocationSig Location, TypeFlowInput<Location> I> {
isNullValue(n)
or
exists(TypeFlowNode mid | isNull(mid) and step(mid, n))
or
forex(TypeFlowNode mid | I::joinStep(mid, n) | isNull(mid)) and
not isExcludedFromNullAnalysis(n)
}
/**