Skip to content

Commit 048c72a

Browse files
committed
C#: Remove YieldReturnKind
1 parent aa2abf7 commit 048c72a

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowDispatch.qll

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ private module Cached {
8282
cached
8383
newtype TReturnKind =
8484
TNormalReturnKind() { Stages::DataFlowStage::forceCachingInSameStage() } or
85-
TYieldReturnKind() or
8685
TOutReturnKind(int i) {
8786
exists(Parameter p | callableReturnsOutOrRef(_, p, _) and p.isOut() | i = p.getPosition())
8887
} or
@@ -200,11 +199,6 @@ class NormalReturnKind extends ReturnKind, TNormalReturnKind {
200199
override string toString() { result = "return" }
201200
}
202201

203-
/** A value returned from a callable using a `yield return` statement. */
204-
class YieldReturnKind extends ReturnKind, TYieldReturnKind {
205-
override string toString() { result = "yield return" }
206-
}
207-
208202
/** A value returned from a callable using an `out` or a `ref` parameter. */
209203
abstract class OutRefReturnKind extends ReturnKind {
210204
/** Gets the position of the `out`/`ref` parameter. */

csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,7 @@ private module ReturnNodes {
13931393

13941394
YieldReturnStmt getYieldReturnStmt() { result = yrs }
13951395

1396-
override YieldReturnKind getKind() { any() }
1396+
override NormalReturnKind getKind() { any() }
13971397

13981398
override Callable getEnclosingCallableImpl() { result = yrs.getEnclosingCallable() }
13991399

@@ -1516,21 +1516,6 @@ private module OutNodes {
15161516
result = TExplicitDelegateLikeCall(cfn, e)
15171517
}
15181518

1519-
/** A valid return type for a method that uses `yield return`. */
1520-
private class YieldReturnType extends Type {
1521-
YieldReturnType() {
1522-
exists(Type t | t = this.getUnboundDeclaration() |
1523-
t instanceof SystemCollectionsIEnumerableInterface
1524-
or
1525-
t instanceof SystemCollectionsIEnumeratorInterface
1526-
or
1527-
t instanceof SystemCollectionsGenericIEnumerableTInterface
1528-
or
1529-
t instanceof SystemCollectionsGenericIEnumeratorInterface
1530-
)
1531-
}
1532-
}
1533-
15341519
/**
15351520
* A data-flow node that reads a value returned directly by a callable,
15361521
* either via a C# call or a CIL call.
@@ -1551,9 +1536,6 @@ private module OutNodes {
15511536
(
15521537
kind instanceof NormalReturnKind and
15531538
not call.getExpr().getType() instanceof VoidType
1554-
or
1555-
kind instanceof YieldReturnKind and
1556-
call.getExpr().getType() instanceof YieldReturnType
15571539
)
15581540
}
15591541
}

0 commit comments

Comments
 (0)