@@ -57,8 +57,8 @@ final class DataFlowCallable extends TDataFlowCallable {
5757}
5858
5959final class DataFlowCall extends TDataFlowCall {
60- /** Gets the underlying call in the CFG , if any. */
61- Call asCall ( ) { this = TCall ( result ) }
60+ /** Gets the underlying function call , if any. */
61+ FunctionCall asFunctionCall ( ) { this = TFunctionCall ( result ) }
6262
6363 predicate isSummaryCall (
6464 FlowSummaryImpl:: Public:: SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNode receiver
@@ -67,13 +67,13 @@ final class DataFlowCall extends TDataFlowCall {
6767 }
6868
6969 DataFlowCallable getEnclosingCallable ( ) {
70- result .asCfgScope ( ) = this .asCall ( ) .getEnclosingCfgScope ( )
70+ result .asCfgScope ( ) = this .asFunctionCall ( ) .getEnclosingCfgScope ( )
7171 or
7272 this .isSummaryCall ( result .asSummarizedCallable ( ) , _)
7373 }
7474
7575 string toString ( ) {
76- result = this .asCall ( ) .toString ( )
76+ result = this .asFunctionCall ( ) .toString ( )
7777 or
7878 exists (
7979 FlowSummaryImpl:: Public:: SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNode receiver
@@ -83,7 +83,7 @@ final class DataFlowCall extends TDataFlowCall {
8383 )
8484 }
8585
86- Location getLocation ( ) { result = this .asCall ( ) .getLocation ( ) }
86+ Location getLocation ( ) { result = this .asFunctionCall ( ) .getLocation ( ) }
8787}
8888
8989/**
@@ -141,13 +141,8 @@ final class ArgumentPosition extends ParameterPosition {
141141
142142/**
143143 * Holds if `arg` is an argument of `call` at the position `pos`.
144- *
145- * Note that this does not hold for the receiever expression of a method call
146- * as the synthetic `ReceiverNode` is the argument for the `self` parameter.
147144 */
148- predicate isArgumentForCall ( Expr arg , Call call , ArgumentPosition pos ) {
149- // TODO: Handle index expressions as calls in data flow.
150- not call instanceof IndexExpr and
145+ predicate isArgumentForCall ( Expr arg , FunctionCall call , ArgumentPosition pos ) {
151146 arg = pos .getArgument ( call )
152147}
153148
@@ -408,7 +403,7 @@ module RustDataFlow implements InputSig<Location> {
408403
409404 /** Gets a viable implementation of the target of the given `Call`. */
410405 DataFlowCallable viableCallable ( DataFlowCall call ) {
411- exists ( Call c | c = call .asCall ( ) |
406+ exists ( FunctionCall c | c = call .asFunctionCall ( ) |
412407 result .asCfgScope ( ) = c .getARuntimeTarget ( )
413408 or
414409 exists ( SummarizedCallable sc , Function staticTarget |
@@ -831,11 +826,7 @@ module RustDataFlow implements InputSig<Location> {
831826 */
832827 predicate lambdaCall ( DataFlowCall call , LambdaCallKind kind , Node receiver ) {
833828 (
834- receiver .asExpr ( ) = call .asCall ( ) .( CallExpr ) .getFunction ( ) and
835- // All calls to complex expressions and local variable accesses are lambda call.
836- exists ( Expr f | f = receiver .asExpr ( ) |
837- f instanceof PathExpr implies f = any ( Variable v ) .getAnAccess ( )
838- )
829+ receiver .asExpr ( ) = call .asFunctionCall ( ) .( ClosureCall ) .getFunction ( )
839830 or
840831 call .isSummaryCall ( _, receiver .( FlowSummaryNode ) .getSummaryNode ( ) )
841832 ) and
@@ -997,11 +988,9 @@ private module Cached {
997988
998989 cached
999990 newtype TDataFlowCall =
1000- TCall ( Call call ) {
991+ TFunctionCall ( FunctionCall call ) {
1001992 Stages:: DataFlowStage:: ref ( ) and
1002- call .hasEnclosingCfgScope ( ) and
1003- // TODO: Handle index expressions as calls in data flow.
1004- not call instanceof IndexExpr
993+ call .hasEnclosingCfgScope ( )
1005994 } or
1006995 TSummaryCall (
1007996 FlowSummaryImpl:: Public:: SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNode receiver
0 commit comments