@@ -103,10 +103,10 @@ module ArgumentPassing {
103
103
* Used to limit the size of predicates.
104
104
*/
105
105
predicate connects ( CallNode call , CallableValue callable ) {
106
- exists ( NonLibraryNormalCall c , NonLibraryDataFlowCallable k |
106
+ exists ( NormalCall c , NonLibraryDataFlowCallable k |
107
107
call = c .getNode ( ) and
108
108
callable = k .getCallableValue ( ) and
109
- k = c .getNonLibraryCallable ( )
109
+ k = c .getCallable ( )
110
110
)
111
111
}
112
112
@@ -511,81 +511,64 @@ class NormalCall extends DataFlowSourceCall, TNormalCall {
511
511
512
512
abstract override Node getArg ( int n ) ;
513
513
514
- override ControlFlowNode getNode ( ) { result = call }
514
+ override CallNode getNode ( ) { result = call }
515
515
516
516
abstract override DataFlowCallable getCallable ( ) ;
517
517
518
518
override DataFlowCallable getEnclosingCallable ( ) { result .getScope ( ) = call .getNode ( ) .getScope ( ) }
519
519
}
520
520
521
- /** A (non-special) call that does not go to a library callable. */
522
- abstract class NonLibraryNormalCall extends NormalCall {
523
- abstract Node getNonLibraryArg ( int n ) ;
524
-
525
- final override Node getArg ( int n ) { result = this .getNonLibraryArg ( n ) }
526
-
527
- abstract DataFlowCallable getNonLibraryCallable ( ) ;
528
-
529
- final override DataFlowCallable getCallable ( ) { result = this .getNonLibraryCallable ( ) }
530
- }
531
-
532
521
/**
533
522
* A call to a function.
534
523
* This excludes calls to bound methods, classes, and special methods.
535
524
* Bound method calls and class calls insert an argument for the explicit
536
525
* `self` parameter, and special method calls have special argument passing.
537
526
*/
538
- class FunctionCall extends NonLibraryNormalCall {
527
+ class FunctionCall extends NormalCall {
539
528
NonLibraryDataFlowCallable callable ;
540
529
541
530
FunctionCall ( ) {
542
531
call = any ( FunctionValue f ) .getAFunctionCall ( ) and
543
532
call = callable .getACall ( )
544
533
}
545
534
546
- override Node getNonLibraryArg ( int n ) {
547
- result = getArg ( call , TNoShift ( ) , callable .getCallableValue ( ) , n )
548
- }
535
+ override Node getArg ( int n ) { result = getArg ( call , TNoShift ( ) , callable .getCallableValue ( ) , n ) }
549
536
550
- override DataFlowCallable getNonLibraryCallable ( ) { result = callable }
537
+ override DataFlowCallable getCallable ( ) { result = callable }
551
538
}
552
539
553
540
/** A call to a lambda. */
554
- class LambdaCall extends NonLibraryNormalCall {
541
+ class LambdaCall extends NormalCall {
555
542
NonLibraryDataFlowCallable callable ;
556
543
557
544
LambdaCall ( ) {
558
545
call = callable .getACall ( ) and
559
546
callable = TLambda ( any ( Function f ) )
560
547
}
561
548
562
- override Node getNonLibraryArg ( int n ) {
563
- result = getArg ( call , TNoShift ( ) , callable .getCallableValue ( ) , n )
564
- }
549
+ override Node getArg ( int n ) { result = getArg ( call , TNoShift ( ) , callable .getCallableValue ( ) , n ) }
565
550
566
- override DataFlowCallable getNonLibraryCallable ( ) { result = callable }
551
+ override DataFlowCallable getCallable ( ) { result = callable }
567
552
}
568
553
569
554
/**
570
555
* Represents a call to a bound method call.
571
556
* The node representing the instance is inserted as argument to the `self` parameter.
572
557
*/
573
- class MethodCall extends NonLibraryNormalCall {
558
+ class MethodCall extends NormalCall {
574
559
FunctionValue bm ;
575
560
576
561
MethodCall ( ) { call = bm .getAMethodCall ( ) }
577
562
578
563
private CallableValue getCallableValue ( ) { result = bm }
579
564
580
- override Node getNonLibraryArg ( int n ) {
565
+ override Node getArg ( int n ) {
581
566
n > 0 and result = getArg ( call , TShiftOneUp ( ) , this .getCallableValue ( ) , n )
582
567
or
583
568
n = 0 and result = TCfgNode ( call .getFunction ( ) .( AttrNode ) .getObject ( ) )
584
569
}
585
570
586
- override DataFlowCallable getNonLibraryCallable ( ) {
587
- result = TCallableValue ( this .getCallableValue ( ) )
588
- }
571
+ override DataFlowCallable getCallable ( ) { result = TCallableValue ( this .getCallableValue ( ) ) }
589
572
}
590
573
591
574
/**
@@ -594,7 +577,7 @@ class MethodCall extends NonLibraryNormalCall {
594
577
* That makes the call node be the post-update node holding the value of the object
595
578
* after the constructor has run.
596
579
*/
597
- class ClassCall extends NonLibraryNormalCall {
580
+ class ClassCall extends NormalCall {
598
581
ClassValue c ;
599
582
600
583
ClassCall ( ) {
@@ -604,15 +587,13 @@ class ClassCall extends NonLibraryNormalCall {
604
587
605
588
private CallableValue getCallableValue ( ) { c .getScope ( ) .getInitMethod ( ) = result .getScope ( ) }
606
589
607
- override Node getNonLibraryArg ( int n ) {
590
+ override Node getArg ( int n ) {
608
591
n > 0 and result = getArg ( call , TShiftOneUp ( ) , this .getCallableValue ( ) , n )
609
592
or
610
593
n = 0 and result = TSyntheticPreUpdateNode ( TCfgNode ( call ) )
611
594
}
612
595
613
- override DataFlowCallable getNonLibraryCallable ( ) {
614
- result = TCallableValue ( this .getCallableValue ( ) )
615
- }
596
+ override DataFlowCallable getCallable ( ) { result = TCallableValue ( this .getCallableValue ( ) ) }
616
597
}
617
598
618
599
/** A call to a special method. */
0 commit comments