mirror of
https://github.com/github/codeql.git
synced 2026-04-25 00:35:20 +02:00
C#: Rename CollectionExpr to EnumerableCollectionExpr.
This commit is contained in:
@@ -480,12 +480,17 @@ class DereferenceableExpr extends Expr {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DEPRECATED: Use `EnumerableCollectionExpr` instead.
|
||||
*/
|
||||
deprecated class CollectionExpr = EnumerableCollectionExpr;
|
||||
|
||||
/**
|
||||
* An expression that evaluates to a collection. That is, an expression whose
|
||||
* (transitive, reflexive) base type is `IEnumerable`.
|
||||
*/
|
||||
class CollectionExpr extends Expr {
|
||||
CollectionExpr() {
|
||||
class EnumerableCollectionExpr extends Expr {
|
||||
EnumerableCollectionExpr() {
|
||||
this.getType().(ValueOrRefType).getABaseType*() instanceof SystemCollectionsIEnumerableInterface
|
||||
}
|
||||
|
||||
@@ -1431,7 +1436,7 @@ module Internal {
|
||||
or
|
||||
val.branch(_, _, e)
|
||||
or
|
||||
e instanceof CollectionExpr and
|
||||
e instanceof EnumerableCollectionExpr and
|
||||
val = TEmptyCollectionValue(_)
|
||||
) and
|
||||
not e = any(ExprStmt es).getExpr() and
|
||||
@@ -1570,7 +1575,9 @@ module Internal {
|
||||
(g1 != g2 or v1 != v2)
|
||||
)
|
||||
or
|
||||
exists(boolean isEmpty | g1 = g2.(CollectionExpr).getAnEmptinessCheck(v1, isEmpty) |
|
||||
exists(boolean isEmpty |
|
||||
g1 = g2.(EnumerableCollectionExpr).getAnEmptinessCheck(v1, isEmpty)
|
||||
|
|
||||
v2 =
|
||||
any(EmptyCollectionValue ecv | if ecv.isEmpty() then isEmpty = true else isEmpty = false) and
|
||||
g1 != g2
|
||||
|
||||
@@ -1162,7 +1162,8 @@ module LoopSplitting {
|
||||
|
||||
/** Holds if `ce` is guarded by a (non-)empty check, as specified by `v`. */
|
||||
private predicate emptinessGuarded(
|
||||
Guards::Guard g, Guards::CollectionExpr ce, Guards::AbstractValues::EmptyCollectionValue v
|
||||
Guards::Guard g, Guards::EnumerableCollectionExpr ce,
|
||||
Guards::AbstractValues::EmptyCollectionValue v
|
||||
) {
|
||||
exists(PreBasicBlock bb | Guards::Internal::preControls(g, bb, v) |
|
||||
PreSsa::adjacentReadPairSameVar(g, ce) and
|
||||
|
||||
@@ -2,7 +2,7 @@ import csharp
|
||||
private import semmle.code.csharp.controlflow.Guards
|
||||
|
||||
query predicate emptinessCheck(
|
||||
Expr check, CollectionExpr collection, AbstractValue v, boolean isEmpty
|
||||
Expr check, EnumerableCollectionExpr collection, AbstractValue v, boolean isEmpty
|
||||
) {
|
||||
check = collection.getAnEmptinessCheck(v, isEmpty)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user