@@ -103,10 +103,10 @@ module ArgumentPassing {
103103 * Used to limit the size of predicates.
104104 */
105105 predicate connects ( CallNode call , CallableValue callable ) {
106- exists ( NonLibraryNormalCall c , NonLibraryDataFlowCallable k |
106+ exists ( NormalCall c , NonLibraryDataFlowCallable k |
107107 call = c .getNode ( ) and
108108 callable = k .getCallableValue ( ) and
109- k = c .getNonLibraryCallable ( )
109+ k = c .getCallable ( )
110110 )
111111 }
112112
@@ -511,81 +511,64 @@ class NormalCall extends DataFlowSourceCall, TNormalCall {
511511
512512 abstract override Node getArg ( int n ) ;
513513
514- override ControlFlowNode getNode ( ) { result = call }
514+ override CallNode getNode ( ) { result = call }
515515
516516 abstract override DataFlowCallable getCallable ( ) ;
517517
518518 override DataFlowCallable getEnclosingCallable ( ) { result .getScope ( ) = call .getNode ( ) .getScope ( ) }
519519}
520520
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-
532521/**
533522 * A call to a function.
534523 * This excludes calls to bound methods, classes, and special methods.
535524 * Bound method calls and class calls insert an argument for the explicit
536525 * `self` parameter, and special method calls have special argument passing.
537526 */
538- class FunctionCall extends NonLibraryNormalCall {
527+ class FunctionCall extends NormalCall {
539528 NonLibraryDataFlowCallable callable ;
540529
541530 FunctionCall ( ) {
542531 call = any ( FunctionValue f ) .getAFunctionCall ( ) and
543532 call = callable .getACall ( )
544533 }
545534
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 ) }
549536
550- override DataFlowCallable getNonLibraryCallable ( ) { result = callable }
537+ override DataFlowCallable getCallable ( ) { result = callable }
551538}
552539
553540/** A call to a lambda. */
554- class LambdaCall extends NonLibraryNormalCall {
541+ class LambdaCall extends NormalCall {
555542 NonLibraryDataFlowCallable callable ;
556543
557544 LambdaCall ( ) {
558545 call = callable .getACall ( ) and
559546 callable = TLambda ( any ( Function f ) )
560547 }
561548
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 ) }
565550
566- override DataFlowCallable getNonLibraryCallable ( ) { result = callable }
551+ override DataFlowCallable getCallable ( ) { result = callable }
567552}
568553
569554/**
570555 * Represents a call to a bound method call.
571556 * The node representing the instance is inserted as argument to the `self` parameter.
572557 */
573- class MethodCall extends NonLibraryNormalCall {
558+ class MethodCall extends NormalCall {
574559 FunctionValue bm ;
575560
576561 MethodCall ( ) { call = bm .getAMethodCall ( ) }
577562
578563 private CallableValue getCallableValue ( ) { result = bm }
579564
580- override Node getNonLibraryArg ( int n ) {
565+ override Node getArg ( int n ) {
581566 n > 0 and result = getArg ( call , TShiftOneUp ( ) , this .getCallableValue ( ) , n )
582567 or
583568 n = 0 and result = TCfgNode ( call .getFunction ( ) .( AttrNode ) .getObject ( ) )
584569 }
585570
586- override DataFlowCallable getNonLibraryCallable ( ) {
587- result = TCallableValue ( this .getCallableValue ( ) )
588- }
571+ override DataFlowCallable getCallable ( ) { result = TCallableValue ( this .getCallableValue ( ) ) }
589572}
590573
591574/**
@@ -594,7 +577,7 @@ class MethodCall extends NonLibraryNormalCall {
594577 * That makes the call node be the post-update node holding the value of the object
595578 * after the constructor has run.
596579 */
597- class ClassCall extends NonLibraryNormalCall {
580+ class ClassCall extends NormalCall {
598581 ClassValue c ;
599582
600583 ClassCall ( ) {
@@ -604,15 +587,13 @@ class ClassCall extends NonLibraryNormalCall {
604587
605588 private CallableValue getCallableValue ( ) { c .getScope ( ) .getInitMethod ( ) = result .getScope ( ) }
606589
607- override Node getNonLibraryArg ( int n ) {
590+ override Node getArg ( int n ) {
608591 n > 0 and result = getArg ( call , TShiftOneUp ( ) , this .getCallableValue ( ) , n )
609592 or
610593 n = 0 and result = TSyntheticPreUpdateNode ( TCfgNode ( call ) )
611594 }
612595
613- override DataFlowCallable getNonLibraryCallable ( ) {
614- result = TCallableValue ( this .getCallableValue ( ) )
615- }
596+ override DataFlowCallable getCallable ( ) { result = TCallableValue ( this .getCallableValue ( ) ) }
616597}
617598
618599/** A call to a special method. */
0 commit comments