mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
C#: Remove YieldReturnKind
This commit is contained in:
@@ -82,7 +82,6 @@ private module Cached {
|
||||
cached
|
||||
newtype TReturnKind =
|
||||
TNormalReturnKind() { Stages::DataFlowStage::forceCachingInSameStage() } or
|
||||
TYieldReturnKind() or
|
||||
TOutReturnKind(int i) {
|
||||
exists(Parameter p | callableReturnsOutOrRef(_, p, _) and p.isOut() | i = p.getPosition())
|
||||
} or
|
||||
@@ -200,11 +199,6 @@ class NormalReturnKind extends ReturnKind, TNormalReturnKind {
|
||||
override string toString() { result = "return" }
|
||||
}
|
||||
|
||||
/** A value returned from a callable using a `yield return` statement. */
|
||||
class YieldReturnKind extends ReturnKind, TYieldReturnKind {
|
||||
override string toString() { result = "yield return" }
|
||||
}
|
||||
|
||||
/** A value returned from a callable using an `out` or a `ref` parameter. */
|
||||
abstract class OutRefReturnKind extends ReturnKind {
|
||||
/** Gets the position of the `out`/`ref` parameter. */
|
||||
|
||||
@@ -1393,7 +1393,7 @@ private module ReturnNodes {
|
||||
|
||||
YieldReturnStmt getYieldReturnStmt() { result = yrs }
|
||||
|
||||
override YieldReturnKind getKind() { any() }
|
||||
override NormalReturnKind getKind() { any() }
|
||||
|
||||
override Callable getEnclosingCallableImpl() { result = yrs.getEnclosingCallable() }
|
||||
|
||||
@@ -1516,21 +1516,6 @@ private module OutNodes {
|
||||
result = TExplicitDelegateLikeCall(cfn, e)
|
||||
}
|
||||
|
||||
/** A valid return type for a method that uses `yield return`. */
|
||||
private class YieldReturnType extends Type {
|
||||
YieldReturnType() {
|
||||
exists(Type t | t = this.getUnboundDeclaration() |
|
||||
t instanceof SystemCollectionsIEnumerableInterface
|
||||
or
|
||||
t instanceof SystemCollectionsIEnumeratorInterface
|
||||
or
|
||||
t instanceof SystemCollectionsGenericIEnumerableTInterface
|
||||
or
|
||||
t instanceof SystemCollectionsGenericIEnumeratorInterface
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A data-flow node that reads a value returned directly by a callable,
|
||||
* either via a C# call or a CIL call.
|
||||
@@ -1551,9 +1536,6 @@ private module OutNodes {
|
||||
(
|
||||
kind instanceof NormalReturnKind and
|
||||
not call.getExpr().getType() instanceof VoidType
|
||||
or
|
||||
kind instanceof YieldReturnKind and
|
||||
call.getExpr().getType() instanceof YieldReturnType
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user