Skip to content

Commit a116463

Browse files
committed
Split out ArgumentNode inheritance
Overriding both `argumentOf` and `toString` was causing sadness for the local annotations. Easiest fix was to split these out into their own subclasses. The names are perhaps a bit too verbose now (alternative suggestions are welcomed).
1 parent b0e94e8 commit a116463

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,7 @@ private class SummaryPostUpdateNode extends FlowSummaryNode, PostUpdateNodeImpl
17221722
* `CallGraphConstruction::Make` in stead of
17231723
* `CallGraphConstruction::Simple::Make` appropriately.
17241724
*/
1725-
class CapturedVariablesArgumentNode extends CfgNode, ArgumentNode {
1725+
class CapturedVariablesArgumentNode extends CfgNode {
17261726
CallNode callNode;
17271727

17281728
CapturedVariablesArgumentNode() {
@@ -1733,17 +1733,19 @@ class CapturedVariablesArgumentNode extends CfgNode, ArgumentNode {
17331733
}
17341734

17351735
override string toString() { result = "Capturing closure argument" }
1736+
}
17361737

1738+
class CapturedVariablesArgumentNodeAsArgumentNode extends CapturedVariablesArgumentNode,
1739+
ArgumentNode
1740+
{
17371741
override predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
17381742
callNode = call.getNode() and
17391743
pos.isLambdaSelf()
17401744
}
17411745
}
17421746

17431747
/** A synthetic node representing the values of variables captured by a comprehension. */
1744-
class SynthCompCapturedVariablesArgumentNode extends Node, TSynthCompCapturedVariablesArgumentNode,
1745-
ArgumentNode
1746-
{
1748+
class SynthCompCapturedVariablesArgumentNode extends Node, TSynthCompCapturedVariablesArgumentNode {
17471749
Comp comp;
17481750

17491751
SynthCompCapturedVariablesArgumentNode() { this = TSynthCompCapturedVariablesArgumentNode(comp) }
@@ -1755,7 +1757,11 @@ class SynthCompCapturedVariablesArgumentNode extends Node, TSynthCompCapturedVar
17551757
override Location getLocation() { result = comp.getLocation() }
17561758

17571759
Comp getComprehension() { result = comp }
1760+
}
17581761

1762+
class SynthCompCapturedVariablesArgumentNodeAsArgumentNode extends SynthCompCapturedVariablesArgumentNode,
1763+
ArgumentNode
1764+
{
17591765
override predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
17601766
call.(ComprehensionCall).getComprehension() = comp and
17611767
pos.isLambdaSelf()

0 commit comments

Comments
 (0)