Skip to content

Commit ecb3efb

Browse files
committed
C#: Fix merge conflicts.
1 parent 9ec2172 commit ecb3efb

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

csharp/ql/src/semmle/code/csharp/controlflow/ControlFlowGraph.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,7 @@ module ControlFlow {
950950
not this instanceof CastExpr and
951951
not this instanceof AnonymousFunctionExpr and
952952
not this instanceof DelegateCall and
953+
not this instanceof @unknown_expr and
953954
result = this.getChild(i)
954955
or
955956
this = any(ExtensionMethodCall emc |
@@ -967,6 +968,8 @@ module ControlFlow {
967968
result = getCastExprChild(this, i)
968969
or
969970
result = this.(DelegateCall).getChild(i - 1)
971+
or
972+
result = getUnknownExprChild(this, i)
970973
}
971974
}
972975

@@ -1001,6 +1004,13 @@ module ControlFlow {
10011004
i = 0 and result = ae.getExpr()
10021005
}
10031006

1007+
private ControlFlowElement getUnknownExprChild(@unknown_expr e, int i) {
1008+
exists(int c |
1009+
result = e.(Expr).getChild(c) |
1010+
c = rank[i+1](int j | exists(e.(Expr).getChild(j)))
1011+
)
1012+
}
1013+
10041014
private ControlFlowElement getCastExprChild(CastExpr ce, int i) {
10051015
// The type access at index 1 is not evaluated at run-time
10061016
i = 0 and result = ce.getExpr()

csharp/ql/test/library-tests/standalone/controlflow/cfg.ql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ import semmle.code.csharp.controlflow.ControlFlowGraph
66
* The purpose of this is to ensure that all MethodCall expressions
77
* have a valid `toString()`.
88
*/
9-
class UnknownCall extends MethodCall
10-
{
9+
class UnknownCall extends MethodCall {
1110
UnknownCall() { not exists(this.getTarget()) }
1211

1312
override string toString() { result = "Call to unknown method" }
1413
}
1514

16-
query predicate edges(ControlFlowNode n1, ControlFlowNode n2) {
15+
query predicate edges(ControlFlow::Node n1, ControlFlow::Node n2) {
1716
n2 = n1.getASuccessor()
1817
}

0 commit comments

Comments
 (0)