C#: Simplify the ForEachCapture query.

Co-authored-by: Tom Hvitved <hvitved@github.com>
This commit is contained in:
Michael Nebel
2021-12-22 13:34:44 +01:00
parent fef6770a21
commit 748b2d2507

View File

@@ -75,10 +75,9 @@ Element getAssignmentTarget(Expr e) {
Element getCollectionAssignmentTarget(Expr e) {
// Store into collection via method
exists(DataFlow::Node postNode, Expr nodeExp |
exists(DataFlowPrivate::PostUpdateNode postNode |
FlowSummaryImpl::Private::Steps::summarySetterStep(DataFlow::exprNode(e), _, postNode) and
nodeExp = postNode.(DataFlowPrivate::PostUpdateNode).getPreUpdateNode().asExpr() and
result.(Variable).getAnAccess() = nodeExp
result.(Variable).getAnAccess() = postNode.getPreUpdateNode().asExpr()
)
or
// Array initializer