Skip to content

Commit d2fe4d2

Browse files
committed
Java: Inline VariableWrite.getSource()
1 parent f17518a commit d2fe4d2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,6 @@ private module CaptureInput implements VariableCapture::InputSig {
113113
VariableWrite() { super.getDestVar() = v }
114114

115115
CapturedVariable getVariable() { result = v }
116-
117-
Node getSource() {
118-
result.asExpr() = this.(VariableAssign).getSource() or
119-
result.asExpr() = this.(AssignOp)
120-
}
121116
}
122117

123118
class VariableRead extends Expr instanceof RValue {
@@ -163,7 +158,13 @@ private CaptureFlow::ClosureNode asClosureNode(Node n) {
163158
result.(CaptureFlow::ThisParameterNode).getCallable() = n.(InstanceParameterNode).getCallable() or
164159
exprNode(result.(CaptureFlow::MallocNode).getClosureExpr()).(PostUpdateNode).getPreUpdateNode() =
165160
n or
166-
result.(CaptureFlow::VariableWriteSourceNode).getVariableWrite().getSource() = n
161+
exists(CaptureInput::VariableWrite write |
162+
result.(CaptureFlow::VariableWriteSourceNode).getVariableWrite() = write
163+
|
164+
n.asExpr() = write.(VariableAssign).getSource()
165+
or
166+
n.asExpr() = write.(AssignOp)
167+
)
167168
}
168169

169170
private predicate captureStoreStep(Node node1, CapturedVariableContent c, Node node2) {

0 commit comments

Comments
 (0)