Java: Rename UnaryExpr.getExpr to getOperand.

This commit is contained in:
Anders Schack-Mulligen
2026-02-04 10:50:49 +01:00
parent 6fbf727309
commit 5e6e64b2b7
26 changed files with 67 additions and 62 deletions

View File

@@ -32,7 +32,7 @@ class AnyAssignment extends Expr {
/** The expression modified by this assignment. */
Expr getDest() {
this.(Assignment).getDest() = result or
this.(UnaryAssignExpr).getExpr() = result
this.(UnaryAssignExpr).getOperand() = result
}
}

View File

@@ -49,7 +49,7 @@ predicate subCondition(Expr cond, Expr subcond, boolean negated) {
or
subCondition(cond.(OrLogicalExpr).getAnOperand(), subcond, negated)
or
subCondition(cond.(LogNotExpr).getExpr(), subcond, negated.booleanNot())
subCondition(cond.(LogNotExpr).getOperand(), subcond, negated.booleanNot())
}
from

View File

@@ -98,9 +98,9 @@ where
or
conditionalWithBool(e, pattern, rewrite)
or
e.(LogNotExpr).getExpr().(ComparisonOrEquality).negate(pattern, rewrite)
e.(LogNotExpr).getOperand().(ComparisonOrEquality).negate(pattern, rewrite)
or
e.(LogNotExpr).getExpr() instanceof LogNotExpr and
e.(LogNotExpr).getOperand() instanceof LogNotExpr and
pattern = "!!A" and
rewrite = "A"
)

View File

@@ -15,7 +15,7 @@
import java
import DeadLocals
predicate minusOne(MinusExpr e) { e.getExpr().(Literal).getValue() = "1" }
predicate minusOne(MinusExpr e) { e.getOperand().(Literal).getValue() = "1" }
predicate flowStep(Expr decl, Expr init) {
decl = init

View File

@@ -66,7 +66,7 @@ where
fr.getField() = f and
not f.getDeclaringType() instanceof EnumType and
forall(Assignment ae | ae.getDest() = f.getAnAccess() | ae.getSource() instanceof NullLiteral) and
not exists(UnaryAssignExpr ua | ua.getExpr() = f.getAnAccess()) and
not exists(UnaryAssignExpr ua | ua.getOperand() = f.getAnAccess()) and
not f.isFinal() and
// Exclude fields that may be accessed reflectively.
not reflectivelyWritten(f) and