File tree Expand file tree Collapse file tree
src/experimental/dataflow/internal
test/experimental/dataflow Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -122,11 +122,19 @@ class ReturnKind extends TReturnKind {
122122
123123/** A data flow node that represents a value returned by a callable. */
124124class ReturnNode extends Node {
125+ Return ret ;
126+
125127 // See `TaintTrackingImplementation::returnFlowStep`
126- ReturnNode ( ) { this .asCfgNode ( ) = any ( Return r ) .getValue ( ) .getAFlowNode ( ) }
128+ ReturnNode ( ) {
129+ this .asCfgNode ( ) = ret .getValue ( ) .getAFlowNode ( )
130+ }
127131
128132 /** Gets the kind of this return node. */
129133 ReturnKind getKind ( ) { result = TNormalReturnKind ( ) }
134+
135+ override DataFlowCallable getEnclosingCallable ( ) {
136+ result .getScope ( ) .getAStmt ( ) = ret // TODO: check nested function definitions
137+ }
130138}
131139
132140/** A data flow node that represents the output of a call. */
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ class Node extends TNode {
4848 }
4949
5050 /** Gets the enclosing callable of this node. */
51- final DataFlowCallable getEnclosingCallable ( ) {
51+ DataFlowCallable getEnclosingCallable ( ) {
5252 none ( )
5353 }
5454
@@ -99,13 +99,17 @@ class ParameterNode extends Node {
9999 this .asEssaNode ( ) instanceof ParameterDefinition
100100 }
101101
102- /**
102+ /**
103103 * Holds if this node is the parameter of callable `c` at the specified
104104 * (zero-based) position.
105105 */
106106 predicate isParameterOf ( DataFlowCallable c , int i ) {
107107 this .asEssaNode ( ) .( ParameterDefinition ) .getDefiningNode ( ) = c .getParameter ( i )
108108 }
109+
110+ override DataFlowCallable getEnclosingCallable ( ) {
111+ this .isParameterOf ( result , _)
112+ }
109113}
110114
111115/**
Original file line number Diff line number Diff line change 1+ | test.py:4:10:4:10 | ControlFlowNode for z | test.py:7:5:7:20 | ControlFlowNode for obfuscated_id() |
You can’t perform that action at this time.
0 commit comments