mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Python: move capture node to DataFlowPrivate
This commit is contained in:
@@ -688,6 +688,36 @@ predicate storeStep(Node nodeFrom, ContentSet c, Node nodeTo) {
|
||||
VariableCapture::storeStep(nodeFrom, c, nodeTo)
|
||||
}
|
||||
|
||||
/**
|
||||
* A synthesized data flow node representing a closure object that tracks
|
||||
* captured variables.
|
||||
*/
|
||||
class SynthCaptureNode extends Node, TSynthCaptureNode {
|
||||
private VariableCapture::Flow::SynthesizedCaptureNode cn;
|
||||
|
||||
SynthCaptureNode() { this = TSynthCaptureNode(cn) }
|
||||
|
||||
/** Gets the `SynthesizedCaptureNode` that this node represents. */
|
||||
VariableCapture::Flow::SynthesizedCaptureNode getSynthesizedCaptureNode() { result = cn }
|
||||
|
||||
override Scope getScope() { result = cn.getEnclosingCallable() }
|
||||
|
||||
override Location getLocation() { result = cn.getLocation() }
|
||||
|
||||
override string toString() { result = cn.toString() }
|
||||
}
|
||||
|
||||
private class SynthCapturePostUpdateNode extends PostUpdateNodeImpl, SynthCaptureNode {
|
||||
private SynthCaptureNode pre;
|
||||
|
||||
SynthCapturePostUpdateNode() {
|
||||
VariableCapture::Flow::capturePostUpdateNode(this.getSynthesizedCaptureNode(),
|
||||
pre.getSynthesizedCaptureNode())
|
||||
}
|
||||
|
||||
override Node getPreUpdateNode() { result = pre }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*
|
||||
|
||||
@@ -504,36 +504,6 @@ class StarPatternElementNode extends Node, TStarPatternElementNode {
|
||||
override Location getLocation() { result = consumer.getLocation() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A synthesized data flow node representing a closure object that tracks
|
||||
* captured variables.
|
||||
*/
|
||||
class SynthCaptureNode extends Node, TSynthCaptureNode {
|
||||
private VariableCapture::Flow::SynthesizedCaptureNode cn;
|
||||
|
||||
SynthCaptureNode() { this = TSynthCaptureNode(cn) }
|
||||
|
||||
/** Gets the `SynthesizedCaptureNode` that this node represents. */
|
||||
VariableCapture::Flow::SynthesizedCaptureNode getSynthesizedCaptureNode() { result = cn }
|
||||
|
||||
override Scope getScope() { result = cn.getEnclosingCallable() }
|
||||
|
||||
override Location getLocation() { result = cn.getLocation() }
|
||||
|
||||
override string toString() { result = cn.toString() }
|
||||
}
|
||||
|
||||
private class SynthCapturePostUpdateNode extends PostUpdateNodeImpl, SynthCaptureNode {
|
||||
private SynthCaptureNode pre;
|
||||
|
||||
SynthCapturePostUpdateNode() {
|
||||
VariableCapture::Flow::capturePostUpdateNode(this.getSynthesizedCaptureNode(),
|
||||
pre.getSynthesizedCaptureNode())
|
||||
}
|
||||
|
||||
override Node getPreUpdateNode() { result = pre }
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a node that controls whether other nodes are evaluated.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user