mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Merge pull request #3023 from erik-krogh/RedundantUpdate
Approved by esbena
This commit is contained in:
@@ -64,7 +64,10 @@ class RedundantIdemnecantOperand extends RedundantOperand {
|
||||
* arguments to integers. For example, `x&x` is a common idiom for converting `x` to an integer.
|
||||
*/
|
||||
class RedundantIdempotentOperand extends RedundantOperand {
|
||||
RedundantIdempotentOperand() { getParent() instanceof LogicalBinaryExpr }
|
||||
RedundantIdempotentOperand() {
|
||||
getParent() instanceof LogicalBinaryExpr and
|
||||
not exists(UpdateExpr e | e.getParentExpr+() = this)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,4 +6,6 @@ x == 23 || x == 23;
|
||||
x & x;
|
||||
|
||||
// this may actually be OK, but it's not good style
|
||||
pop() && pop();
|
||||
pop() && pop();
|
||||
|
||||
foo[bar++] && foo[bar++] // OK
|
||||
Reference in New Issue
Block a user