C#: Remove YieldReturnKind

This commit is contained in:
Tamas Vajk
2021-03-16 16:20:04 +01:00
parent aa2abf76ba
commit 048c72a0f2
2 changed files with 1 additions and 25 deletions

View File

@@ -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. */

View File

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