@@ -42,35 +42,23 @@ final class DataFlowCallable extends TDataFlowCallable {
4242 Location getLocation ( ) { result = this .asCfgScope ( ) .getLocation ( ) }
4343}
4444
45- abstract class DataFlowCall extends TDataFlowCall {
46- /** Gets the enclosing callable. */
47- abstract DataFlowCallable getEnclosingCallable ( ) ;
48-
49- /** Gets the underlying source code call, if any. */
50- abstract CallCfgNode asCall ( ) ;
51-
52- /** Gets a textual representation of this call. */
53- abstract string toString ( ) ;
54-
55- /** Gets the location of this call. */
56- abstract Location getLocation ( ) ;
57- }
58-
59- final class NormalCall extends DataFlowCall , TNormalCall {
60- private CallCfgNode c ;
45+ final class DataFlowCall extends TDataFlowCall {
46+ /** Gets the underlying call in the CFG, if any. */
47+ CallExprCfgNode asCallExprCfgNode ( ) { this = TNormalCall ( result ) }
6148
62- NormalCall ( ) { this = TNormalCall ( c ) }
49+ MethodCallExprCfgNode asMethodCallExprCfgNode ( ) { this = TMethodCall ( result ) }
6350
64- /** Gets the underlying call in the CFG, if any. */
65- override CallCfgNode asCall ( ) { result = c }
51+ ExprCfgNode asExprCfgNode ( ) {
52+ result = this .asCallExprCfgNode ( ) or result = this .asMethodCallExprCfgNode ( )
53+ }
6654
67- override DataFlowCallable getEnclosingCallable ( ) {
68- result = TCfgScope ( c .getExpr ( ) .getEnclosingCfgScope ( ) )
55+ DataFlowCallable getEnclosingCallable ( ) {
56+ result = TCfgScope ( this . asExprCfgNode ( ) .getExpr ( ) .getEnclosingCfgScope ( ) )
6957 }
7058
71- override string toString ( ) { result = c .toString ( ) }
59+ string toString ( ) { result = this . asExprCfgNode ( ) .toString ( ) }
7260
73- override Location getLocation ( ) { result = c .getLocation ( ) }
61+ Location getLocation ( ) { result = this . asExprCfgNode ( ) .getLocation ( ) }
7462}
7563
7664module Node {
@@ -204,7 +192,7 @@ module Node {
204192 ExprOutNode ( ) { this .asExpr ( ) instanceof CallExpr }
205193
206194 /** Gets the underlying call CFG node that includes this out node. */
207- override DataFlowCall getCall ( ) { result .( NormalCall ) . asCall ( ) = this .getCfgNode ( ) }
195+ override DataFlowCall getCall ( ) { result .asExprCfgNode ( ) = this .getCfgNode ( ) }
208196 }
209197
210198 /**
@@ -331,7 +319,15 @@ module RustDataFlow implements InputSig<Location> {
331319 final class ReturnKind = ReturnKindAlias ;
332320
333321 /** Gets a viable implementation of the target of the given `Call`. */
334- DataFlowCallable viableCallable ( DataFlowCall c ) { none ( ) }
322+ DataFlowCallable viableCallable ( DataFlowCall c ) {
323+ exists ( Function f , string name | result .asCfgScope ( ) = f and name = f .getName ( ) .toString ( ) |
324+ if f .getParamList ( ) .hasSelfParam ( )
325+ then name = c .asMethodCallExprCfgNode ( ) .getMethodCallExpr ( ) .getNameRef ( ) .getText ( )
326+ else
327+ name =
328+ c .asCallExprCfgNode ( ) .getCallExpr ( ) .getExpr ( ) .( PathExpr ) .getPath ( ) .getPart ( ) .toString ( )
329+ )
330+ }
335331
336332 /**
337333 * Gets a node that can read the value returned from `call` with return kind
@@ -488,7 +484,9 @@ private module Cached {
488484 TSsaNode ( SsaImpl:: DataFlowIntegration:: SsaNode node )
489485
490486 cached
491- newtype TDataFlowCall = TNormalCall ( CallCfgNode c )
487+ newtype TDataFlowCall =
488+ TNormalCall ( CallExprCfgNode c ) or
489+ TMethodCall ( MethodCallExprCfgNode c )
492490
493491 cached
494492 newtype TOptionalContentSet =
0 commit comments