Skip to content

Commit b99b6b8

Browse files
authored
Merge pull request #13927 from hvitved/csharp/fix-bad-join
C#: Fix bad join order
2 parents a58aa17 + 7dac819 commit b99b6b8

File tree

1 file changed

+7
-2
lines changed
  • csharp/ql/lib/semmle/code/csharp

1 file changed

+7
-2
lines changed

csharp/ql/lib/semmle/code/csharp/Stmt.qll

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,12 @@ class YieldReturnStmt extends YieldStmt {
861861
override string getAPrimaryQlClass() { result = "YieldReturnStmt" }
862862
}
863863

864+
bindingset[cfe1, cfe2]
865+
pragma[inline_late]
866+
private predicate sameCallable(ControlFlowElement cfe1, ControlFlowElement cfe2) {
867+
cfe1.getEnclosingCallable() = cfe2.getEnclosingCallable()
868+
}
869+
864870
/**
865871
* A `try` statement, for example
866872
*
@@ -947,8 +953,7 @@ class TryStmt extends Stmt, @try_stmt {
947953
mid = this.getATriedElement() and
948954
not mid instanceof TryStmt and
949955
result = mid.getAChild() and
950-
pragma[only_bind_into](mid.getEnclosingCallable()) =
951-
pragma[only_bind_into](result.getEnclosingCallable())
956+
sameCallable(mid, result)
952957
)
953958
}
954959
}

0 commit comments

Comments
 (0)