@@ -97,8 +97,65 @@ predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
9797//--------
9898// Global flow
9999//--------
100+ /**
101+ * IPA type for DataFlowCallable.
102+ * A callable is either a callable value or a class.
103+ */
104+ newtype TDataFlowCallable =
105+ TCallableValue ( CallableValue callable ) or
106+ TClassValue ( ClassValue c )
107+
100108/** Represents a callable */
101- class DataFlowCallable = CallableValue ;
109+ abstract class DataFlowCallable extends TDataFlowCallable {
110+ /** Gets a textual representation of this element. */
111+ abstract string toString ( ) ;
112+
113+ /** Gets a call to this callable. */
114+ abstract CallNode getACall ( ) ;
115+
116+ /** Gets the scope of this callable */
117+ abstract Scope getScope ( ) ;
118+
119+ /** Gets the specified parameter of this callable */
120+ abstract NameNode getParameter ( int n ) ;
121+
122+ /** Gets the name of this callable. */
123+ abstract string getName ( ) ;
124+ }
125+
126+ class DataFlowCallableValue extends DataFlowCallable , TCallableValue {
127+ CallableValue callable ;
128+
129+ DataFlowCallableValue ( ) { this = TCallableValue ( callable ) }
130+
131+ override string toString ( ) { result = callable .toString ( ) }
132+
133+ override CallNode getACall ( ) { result = callable .getACall ( ) }
134+
135+ override Scope getScope ( ) { result = callable .getScope ( ) }
136+
137+ override NameNode getParameter ( int n ) { result = callable .getParameter ( n ) }
138+
139+ override string getName ( ) { result = callable .getName ( ) }
140+ }
141+
142+ class DataFlowClassValue extends DataFlowCallable , TClassValue {
143+ ClassValue c ;
144+
145+ DataFlowClassValue ( ) { this = TClassValue ( c ) }
146+
147+ override string toString ( ) { result = c .toString ( ) }
148+
149+ override CallNode getACall ( ) { result = c .getACall ( ) }
150+
151+ override Scope getScope ( ) { result = c .getScope ( ) }
152+
153+ override NameNode getParameter ( int n ) {
154+ result .getNode ( ) = c .getScope ( ) .getInitMethod ( ) .getArg ( n + 1 ) .asName ( )
155+ }
156+
157+ override string getName ( ) { result = c .getName ( ) }
158+ }
102159
103160/** Represents a call to a callable */
104161class DataFlowCall extends CallNode {
0 commit comments