@@ -44,9 +44,7 @@ class DataFlowCallable extends TDataFlowCallable {
44
44
* inside library callables with a flow summary.
45
45
*/
46
46
class DataFlowCall extends ExprNode {
47
- DataFlowCall ( ) {
48
- this .asExpr ( ) instanceof CallExpr
49
- }
47
+ DataFlowCall ( ) { this .asExpr ( ) instanceof CallExpr }
50
48
51
49
/** Gets the enclosing callable. */
52
50
DataFlowCallable getEnclosingCallable ( ) { none ( ) }
@@ -59,19 +57,20 @@ private module Cached {
59
57
60
58
/** Gets a viable run-time target for the call `call`. */
61
59
cached
62
- DataFlowCallable viableCallable ( DataFlowCall call ) {
60
+ DataFlowCallable viableCallable ( DataFlowCall call ) {
63
61
result = TDataFlowFunc ( call .asExpr ( ) .( CallExpr ) .getStaticTarget ( ) )
64
62
}
65
63
66
64
cached
67
65
newtype TArgumentPosition =
68
66
TThisArgument ( ) or
69
- TPositionalArgument ( int n ) { n in [ 0 .. 100 ] } // we rely on default exprs generated in the caller for ordering. TODO: compute range properly. TODO: varargs?
67
+ // we rely on default exprs generated in the caller for ordering
68
+ TPositionalArgument ( int n ) { n = any ( Argument arg ) .getIndex ( ) }
70
69
71
70
cached
72
- newtype TParameterPosition =
73
- TThisParameter ( ) or
74
- TPositionalParameter ( int n ) { n in [ 0 .. 100 ] } // TODO: compute range properly
71
+ newtype TParameterPosition =
72
+ TThisParameter ( ) or
73
+ TPositionalParameter ( int n ) { n = any ( Argument arg ) . getIndex ( ) }
75
74
}
76
75
77
76
import Cached
@@ -95,22 +94,17 @@ class ParameterPosition extends TParameterPosition {
95
94
}
96
95
97
96
class PositionalParameterPosition extends ParameterPosition , TPositionalParameter {
98
- int getIndex ( ) {
99
- this = TPositionalParameter ( result )
100
- }
97
+ int getIndex ( ) { this = TPositionalParameter ( result ) }
101
98
}
102
99
103
-
104
100
/** An argument position. */
105
101
class ArgumentPosition extends TArgumentPosition {
106
102
/** Gets a textual representation of this position. */
107
103
string toString ( ) { none ( ) }
108
104
}
109
105
110
106
class PositionalArgumentPosition extends ArgumentPosition , TPositionalArgument {
111
- int getIndex ( ) {
112
- this = TPositionalArgument ( result )
113
- }
107
+ int getIndex ( ) { this = TPositionalArgument ( result ) }
114
108
}
115
109
116
110
/** Holds if arguments at position `apos` match parameters at position `ppos`. */
0 commit comments