@@ -37,7 +37,7 @@ abstract class LibraryCallable extends string {
37
37
LibraryCallable ( ) { any ( ) }
38
38
39
39
/** Gets a call to this library callable. */
40
- Cmd getACall ( ) { none ( ) }
40
+ Call getACall ( ) { none ( ) }
41
41
}
42
42
43
43
/**
@@ -222,7 +222,8 @@ private module Cached {
222
222
223
223
cached
224
224
newtype TArgumentPosition =
225
- TKeywordArgumentPosition ( string name ) { name = any ( CmdParameter p ) .getName ( ) } or
225
+ TThisArgumentPosition ( ) or
226
+ TKeywordArgumentPosition ( string name ) { name = any ( Argument p ) .getName ( ) } or
226
227
TPositionalArgumentPosition ( int pos , NamedSet ns ) {
227
228
exists ( CfgNodes:: CallCfgNode call |
228
229
call = ns .getABindingCall ( ) and
@@ -232,7 +233,8 @@ private module Cached {
232
233
233
234
cached
234
235
newtype TParameterPosition =
235
- TKeywordParameter ( string name ) { name = any ( CmdParameter p ) .getName ( ) } or
236
+ TThisParameterPosition ( ) or
237
+ TKeywordParameter ( string name ) { name = any ( Argument p ) .getName ( ) } or
236
238
TPositionalParameter ( int pos , NamedSet ns ) {
237
239
exists ( CfgNodes:: CallCfgNode call |
238
240
call = ns .getABindingCall ( ) and
@@ -245,6 +247,9 @@ import Cached
245
247
246
248
/** A parameter position. */
247
249
class ParameterPosition extends TParameterPosition {
250
+ /** Holds if this position represents a `this` parameter. */
251
+ predicate isThis ( ) { this = TThisParameterPosition ( ) }
252
+
248
253
/**
249
254
* Holds if this position represents a positional parameter at position `pos`
250
255
* with function is called with exactly the named parameters from the set `ns`
@@ -256,6 +261,8 @@ class ParameterPosition extends TParameterPosition {
256
261
257
262
/** Gets a textual representation of this position. */
258
263
string toString ( ) {
264
+ this .isThis ( ) and result = "this"
265
+ or
259
266
exists ( int pos , NamedSet ns |
260
267
this .isPositional ( pos , ns ) and result = "pos(" + pos + ", " + ns .toString ( ) + ")"
261
268
)
@@ -266,13 +273,18 @@ class ParameterPosition extends TParameterPosition {
266
273
267
274
/** An argument position. */
268
275
class ArgumentPosition extends TArgumentPosition {
276
+ /** Holds if this position represents a `this` argument. */
277
+ predicate isThis ( ) { this = TThisArgumentPosition ( ) }
278
+
269
279
/** Holds if this position represents a positional argument at position `pos`. */
270
280
predicate isPositional ( int pos , NamedSet ns ) { this = TPositionalArgumentPosition ( pos , ns ) }
271
281
272
282
predicate isKeyword ( string name ) { this = TKeywordArgumentPosition ( name ) }
273
283
274
284
/** Gets a textual representation of this position. */
275
285
string toString ( ) {
286
+ this .isThis ( ) and result = "this"
287
+ or
276
288
exists ( int pos , NamedSet ns |
277
289
this .isPositional ( pos , ns ) and result = "pos(" + pos + ", " + ns .toString ( ) + ")"
278
290
)
@@ -284,6 +296,8 @@ class ArgumentPosition extends TArgumentPosition {
284
296
/** Holds if arguments at position `apos` match parameters at position `ppos`. */
285
297
pragma [ nomagic]
286
298
predicate parameterMatch ( ParameterPosition ppos , ArgumentPosition apos ) {
299
+ ppos .isThis ( ) and apos .isThis ( )
300
+ or
287
301
exists ( string name |
288
302
ppos .isKeyword ( name ) and
289
303
apos .isKeyword ( name )
0 commit comments