C#: Fix merge conflicts.

This commit is contained in:
calum
2018-09-07 18:12:28 +01:00
parent 9ec2172dca
commit ecb3efba34
2 changed files with 12 additions and 3 deletions

View File

@@ -950,6 +950,7 @@ module ControlFlow {
not this instanceof CastExpr and
not this instanceof AnonymousFunctionExpr and
not this instanceof DelegateCall and
not this instanceof @unknown_expr and
result = this.getChild(i)
or
this = any(ExtensionMethodCall emc |
@@ -967,6 +968,8 @@ module ControlFlow {
result = getCastExprChild(this, i)
or
result = this.(DelegateCall).getChild(i - 1)
or
result = getUnknownExprChild(this, i)
}
}
@@ -1001,6 +1004,13 @@ module ControlFlow {
i = 0 and result = ae.getExpr()
}
private ControlFlowElement getUnknownExprChild(@unknown_expr e, int i) {
exists(int c |
result = e.(Expr).getChild(c) |
c = rank[i+1](int j | exists(e.(Expr).getChild(j)))
)
}
private ControlFlowElement getCastExprChild(CastExpr ce, int i) {
// The type access at index 1 is not evaluated at run-time
i = 0 and result = ce.getExpr()

View File

@@ -6,13 +6,12 @@ import semmle.code.csharp.controlflow.ControlFlowGraph
* The purpose of this is to ensure that all MethodCall expressions
* have a valid `toString()`.
*/
class UnknownCall extends MethodCall
{
class UnknownCall extends MethodCall {
UnknownCall() { not exists(this.getTarget()) }
override string toString() { result = "Call to unknown method" }
}
query predicate edges(ControlFlowNode n1, ControlFlowNode n2) {
query predicate edges(ControlFlow::Node n1, ControlFlow::Node n2) {
n2 = n1.getASuccessor()
}