Skip to content

Commit f668453

Browse files
committed
Python: move things around
1 parent 739b839 commit f668453

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -388,23 +388,27 @@ module LocalFlow {
388388
module VariableCapture {
389389
private import codeql.dataflow.VariableCapture as Shared
390390

391-
class ExprCfgNode extends ControlFlowNode {
392-
ExprCfgNode() { isExpressionNode(this) }
393-
}
394-
395-
private predicate closureFlowStep(ExprCfgNode nodeFrom, ExprCfgNode nodeTo) {
396-
// TODO: Other languages have an extra case here looking like
397-
// simpleAstFlowStep(nodeFrom, nodeTo)
398-
// we should investigate the potential benefit of adding that.
399-
exists(SsaVariable def |
400-
def.getAUse() = nodeTo and
401-
def.getAnUltimateDefinition().getDefinition().(DefinitionNode).getValue() = nodeFrom
402-
)
403-
}
404-
405391
private module CaptureInput implements Shared::InputSig<Location> {
406392
private import python as PY
407393

394+
additional class ExprCfgNode extends ControlFlowNode {
395+
ExprCfgNode() { isExpressionNode(this) }
396+
}
397+
398+
private predicate closureFlowStep(ExprCfgNode nodeFrom, ExprCfgNode nodeTo) {
399+
// TODO: Other languages have an extra case here looking like
400+
// simpleAstFlowStep(nodeFrom, nodeTo)
401+
// we should investigate the potential benefit of adding that.
402+
exists(SsaVariable def |
403+
def.getAUse() = nodeTo and
404+
def.getAnUltimateDefinition().getDefinition().(DefinitionNode).getValue() = nodeFrom
405+
)
406+
}
407+
408+
class Callable extends Scope {
409+
predicate isConstructor() { none() }
410+
}
411+
408412
class BasicBlock extends PY::BasicBlock {
409413
Callable getEnclosingCallable() { result = this.getScope() }
410414

@@ -482,10 +486,6 @@ module VariableCapture {
482486

483487
predicate hasAliasedAccess(Expr f) { closureFlowStep+(this, f) and not closureFlowStep(f, _) }
484488
}
485-
486-
class Callable extends Scope {
487-
predicate isConstructor() { none() }
488-
}
489489
}
490490

491491
class CapturedVariable = CaptureInput::CapturedVariable;

0 commit comments

Comments
 (0)