We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba67ea0 commit 138eb48Copy full SHA for 138eb48
csharp/ql/src/Language Abuse/MissedTernaryOpportunity.ql
@@ -16,18 +16,14 @@ private Expr getAssignedExpr(Stmt stmt) {
16
result = stmt.stripSingletonBlocks().(ExprStmt).getExpr().(AssignExpr).getLValue()
17
}
18
19
-private predicate ifStmt(IfStmt is) {
20
- sameGvn(getAssignedExpr(is.getThen()), getAssignedExpr(is.getElse()))
21
-}
22
-
23
from IfStmt is, string what
24
where
25
(
26
is.getThen().stripSingletonBlocks() instanceof ReturnStmt and
27
is.getElse().stripSingletonBlocks() instanceof ReturnStmt and
28
what = "return"
29
or
30
- ifStmt(is) and
+ sameGvn(getAssignedExpr(is.getThen()), getAssignedExpr(is.getElse())) and
31
what = "write to the same variable"
32
) and
33
not exists(IfStmt other | is = other.getElse())
0 commit comments