Skip to content

Commit b76a27b

Browse files
committed
C#: Make a store step from explicit parameter nodes on primary constructors to the property of the same name for record types.
1 parent 132b8ba commit b76a27b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2074,7 +2074,13 @@ predicate storeStep(Node node1, ContentSet c, Node node2) {
20742074
exists(Parameter p |
20752075
node1 = TExplicitParameterNode(p) and
20762076
node2 = TPrimaryConstructorThisAccessNode(p, true) and
2077-
c.(PrimaryConstructorParameterContent).getParameter() = p
2077+
exists(Type t | t = p.getCallable().getDeclaringType() |
2078+
not t instanceof RecordType and
2079+
c.(PrimaryConstructorParameterContent).getParameter() = p
2080+
or
2081+
t instanceof RecordType and
2082+
c.(PropertyContent).getProperty().getName() = p.getName()
2083+
)
20782084
)
20792085
or
20802086
FlowSummaryImpl::Private::Steps::summaryStoreStep(node1.(FlowSummaryNode).getSummaryNode(), c,

0 commit comments

Comments
 (0)