Skip to content

Commit 2ecce57

Browse files
committed
C#: Fix types of summary parameter nodes.
1 parent 98f51d7 commit 2ecce57

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,16 +1136,6 @@ private module ParameterNodes {
11361136
override predicate isParameterOf(DataFlowCallable c, ParameterPosition pos) {
11371137
this.getSummarizedCallable() = c.asSummarizedCallable() and pos = this.getPosition()
11381138
}
1139-
1140-
override Type getTypeImpl() {
1141-
exists(int i |
1142-
this.getPosition().getPosition() = i and
1143-
result = this.getSummarizedCallable().getParameter(i).getType()
1144-
)
1145-
or
1146-
this.getPosition().isThisParameter() and
1147-
result = this.getSummarizedCallable().getDeclaringType()
1148-
}
11491139
}
11501140
}
11511141

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ DataFlowType getContentType(Content c) {
4141
)
4242
}
4343

44+
/** Gets the type of the parameter at the given position. */
45+
DataFlowType getParameterType(SummarizedCallable c, ParameterPosition pos) {
46+
exists(Type t | result = Gvn::getGlobalValueNumber(t) |
47+
exists(int i |
48+
pos.getPosition() = i and
49+
t = c.getParameter(i).getType()
50+
)
51+
or
52+
pos.isThisParameter() and
53+
t = c.getDeclaringType()
54+
)
55+
}
56+
4457
private DataFlowType getReturnTypeBase(DotNet::Callable c, ReturnKind rk) {
4558
exists(Type t | result = Gvn::getGlobalValueNumber(t) |
4659
rk instanceof NormalReturnKind and

0 commit comments

Comments
 (0)