C#: Get rid of the isOwnInstanceAccess based on ReturnStmt.

This commit is contained in:
Michael Nebel
2022-03-09 14:59:13 +01:00
parent 34a91f1aac
commit cd03af3be4
4 changed files with 12 additions and 8 deletions

View File

@@ -9,9 +9,9 @@ import CaptureSummaryModelsSpecific
* Gets the summary model of `api`, if it follows the `fluent` programming pattern (returns `this`).
*/
string captureQualifierFlow(TargetAPI api) {
exists(ReturnStmt rtn |
rtn.getEnclosingCallable() = api and
isOwnInstanceAccess(rtn)
exists(ReturnNodeExt ret |
api = returnNodeEnclosingCallable(ret) and
isOwnInstanceAccessNode(ret)
) and
result = asValueModel(api, qualifierString(), "ReturnValue")
}

View File

@@ -8,7 +8,8 @@ import semmle.code.csharp.dataflow.internal.DataFlowImplCommon
import semmle.code.csharp.dataflow.internal.DataFlowPrivate
import ModelGeneratorUtils
predicate isOwnInstanceAccess(ReturnStmt rtn) { rtn.getExpr() instanceof ThisAccess }
pragma[inline]
Callable returnNodeEnclosingCallable(ReturnNodeExt ret) { result = getNodeEnclosingCallable(ret) }
predicate isOwnInstanceAccessNode(ReturnNode node) { node.asExpr() instanceof ThisAccess }